Re: [RFC] TIF_NOTIFY_RESUME, arch/*/*/*signal*.c and all such

From: Oleg Nesterov
Date: Sun Apr 29 2012 - 14:26:04 EST


On 04/29, Al Viro wrote:
>
> On Sun, Apr 29, 2012 at 06:41:55PM +0200, Oleg Nesterov wrote:
> >
> > Besides, at least on x86 tracehook_signal_handler's logic is not exactly
> > right and should be fixed.
>
> Details, please...

See http://marc.info/?t=127550678000005 and
https://bugzilla.kernel.org/show_bug.cgi?id=16061

- the tracee reports a signal SIG

- the tracer does ptrace(SINGLESTEP, SIG), this approves the signal
and also sets TF

- the tracee dequeues the signal, changes its IP to sig_handler().

then it notices TIF_SINGLESTEP and notifies the tracer without
return to user-space _and_ without clearing TF or TIF_SINGLESTEP

- the tracer does ptrace(SINGLESTEP) again, but now enable_single_step()
looses TIF_FORCED_TF.

- the tracer does ptrace(CONT), but user_disable_single_step() doesn't
clear TF since TIF_FORCED_TF is not set

- the tracee returns to user-space with X86_EFLAGS_TF in eflags

Somehow we forgot about this bug...

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/