[PATCH 90] ptrace_wake_up: add "bool force_wakeup" argument for implicit detach
Oleg Nesterov
oleg at redhat.com
Fri Oct 16 09:26:22 UTC 2009
On 10/15, Roland McGrath wrote:
>
> > ptrace_detach(sig) checks valid_signal(sig) to detect the
> > explicit detach and passes "bool voluntary" to ptrace_wake_up().
>
> ptrace_detach_task() does. ptrace_detach() has already bailed out
> if !valid_signal(sig) was really pass in from userland.
>
> valid_signal(0) => true, so this is checking specifically for the
> exit_ptrace() call that passes -1 to ptrace_do_detach()->ptrace_detach_task().
>
> That is all rather nonobvious. But once you do figure it all out, the
> "voluntary" variable name stops being confusing. :-)
Yes, agreed, this needs a comment. I tried, but can't invent a clean
and concise one... Perhaps,
/*
* If we are called when the tracer does PTRACE_DETACH
* valid_signal(sig) == T. Otherwise the caller does the
* implicit detach during exit.
*/
> It is strange to use valid_signal() at all inside ptrace_detach_task(),
> where the possible values for sig are -1 from exit_ptrace(), 0, or a valid
> signal number.
OK, agreed. We can check sig >= 0 instead
> Passing 0 to send_sig_info looks like it will get through and then confuse
> the lower layers.
No, send_sig_info() is called under "if (sig)", but I guess I misunderstood
you.
> If sig==0, remind me why we're not just doing action=UTRACE_DETACH anyway?
Hmm. Again, I am not sure I understand you correctly.
But, if sig == 0, then we only do utrace_control(DETACH), because
sig == 0 means PTRACE_DETACH wants to cancel the signal.
The code does
action = UTRACE_DETACH;
if (sig) {
... change if needed ...
}
utrace_control(action);
> But remember that ptrace-tests has only the problem
> cases we've noticed before, not necessarily everything that matters.
Yes, yes, I know.
> We
> should feel comfortable when running the gdb testsuite has no regressions
> vs the vanilla kernel, for a variety of past and present gdb versions.
> (That suite tends to have many failures, but all we need to do is match the
> vanilla kernel's behavior in which ones pass or fail.)
You or Jan have alredy mentioned this testsuite... is it gdb-6.8/sim/testsuite/
which I see in gdb-6.8.tar.gz or something else?
Oleg.
More information about the utrace-devel
mailing list