Re: [PATCH 1/1] ptrace: make sure do_wait() won't hang afterPTRACE_ATTACH

From: Oleg Nesterov
Date: Mon Feb 14 2011 - 12:47:54 EST


On 02/14, Denys Vlasenko wrote:
>
> On Mon, Feb 14, 2011 at 4:31 PM, Oleg Nesterov <oleg@xxxxxxxxxx> wrote:
> > On 02/13, Denys Vlasenko wrote:
> >>
> >> $ strace -tt sleep 30
> >> 23:02:15.619262 execve("/bin/sleep", ["sleep", "30"], [/* 30 vars */]) = 0
> >> ...
> >> 23:02:15.622112 nanosleep({30, 0}, NULL) = ? ERESTART_RESTARTBLOCK (To be restarted)
> >> 23:02:23.781165 --- SIGSTOP (Stopped (signal)) @ 0 (0) ---
> >> 23:02:23.781251 --- SIGSTOP (Stopped (signal)) @ 0 (0) ---
> >>     (I forgot again why we see it twice. Another quirk I guess...)
> >
> >      (this is correct, the tracee reports the signal=SIGSTOP, then
> >       it reports it actually stopps with exit_code=SIGSTOP)
>
> Ah, I see. Is there any way debugger can distinguish between these two
> different stops?

IIRC, the (only?) way to distinguish is to check last_siginfo != NULL
via ptrace(PTRACE_GETSIGINFO).

Oleg.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/