lkml.org 
[lkml]   [2009]   [Dec]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: x86: do_debug && PTRACE_SINGLESTEP broken by 08d68323d1f0c34452e614263b212ca556dae47f
On 12/18, K.Prasad wrote:
>
> On Fri, Dec 18, 2009 at 06:27:47PM +0100, Oleg Nesterov wrote:
> > On 12/18, Frederic Weisbecker wrote:
> > >
> > > On Fri, Dec 18, 2009 at 01:56:50AM +0100, Oleg Nesterov wrote:
> > > > Hi.
>
> <snipped>
>
> > > Single stepping works well for me, after a quick check on
> > > gdb. How did you trigger the bug?
> >
> > Please find the trivial test-case below. It hangs, because
> > PTRACE_SINGLESTEP doesn't trigger the trap.
> >
>
> aah...my other mail just criss-crossed yours.
>
> I quickly ran on the said x86 box, loaded with -tip (commit
> 7818b3d0fc68f5c2a85fed86d9fa37131c5a3068) and it runs fine.

Hmm. Just re-tested 2.6.33-rc1 under kvm, it hangs...

Oleg.

> [root@llm05 prasadkr]# cat oleg.c
> #include <stdio.h>
> #include <unistd.h>
> #include <signal.h>
> #include <sys/ptrace.h>
> #include <sys/wait.h>
> #include <assert.h>
>
> int main(void)
> {
> int pid, status, i;
>
> pid = fork();
> if (!pid)
> for (;;);
>
> sleep(1);
> assert(ptrace(PTRACE_ATTACH, pid, 0,0) == 0);
>
> assert(pid == wait(&status));
> assert(WIFSTOPPED(status));
>
> for (i = 0; i < 10; ++i) {
> assert(ptrace(PTRACE_SINGLESTEP, pid, 0,0) == 0);
>
> printf("wait %d ...\n", i);
> assert(pid == wait(&status));
>
> assert(WIFSTOPPED(status) && WSTOPSIG(status) == SIGTRAP);
> }
>
> kill(pid, SIGKILL);
> return 0;
> }
>
> [root@llm05 prasadkr]# gcc -o oleg oleg.c -g -Wall
> [root@llm05 prasadkr]# ./oleg
> wait 0 ...
> wait 1 ...
> wait 2 ...
> wait 3 ...
> wait 4 ...
> wait 5 ...
> wait 6 ...
> wait 7 ...
> wait 8 ...
> wait 9 ...
> [root@llm05 prasadkr]#
>
> Am I missing something here?
>
> Thanks,
> K.Prasad
>



\
 
 \ /
  Last update: 2009-12-18 19:35    [from the cache]
©2003-2011 Jasper Spaans