On 11/15, Oleg Nesterov wrote:
>
> In short, the code in utrace.c was broken even before utrace-cleanup
> was merged (but I bet utrace-cleanup adds more problems which I don't
> understand yet), and the patch below "fixes" utrace.c (without
> utrace-cleanup applied).

Please see the patch below.

I know it is too late to fix this old branch (utrace without utrace-cleanup
changes), just fyi.

The race is simple. utrace_attach_task() sets ->pending_attach, but
utrace_get_signal() can miss it and dequeue/report a signal without
splice_attaching().

Now everything in ptrace-tests works again as before. Just in case,
the last commit in my utrace.c now is

        utrace_set_events: nit clean up
        9e0f357ab8de409cb722921e7fca7e6a94fd6e09


Now I am going to switch to your tree again, make the similar fix
and test.

---

 kernel/utrace.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- PU/kernel/utrace.c~UTRACE_ATTACH_SIGNAL_RACE        2009-11-15 
18:36:38.000000000 +0100
+++ PU/kernel/utrace.c  2009-11-15 18:44:44.000000000 +0100
@@ -1899,7 +1899,8 @@ int utrace_get_signal(struct task_struct
        int signr;
 
        utrace = &task->utrace;
-       if (utrace->interrupt || utrace->report || utrace->signal_handler) {
+       if (utrace->report || utrace->interrupt ||
+           utrace->pending_attach || utrace->signal_handler) {
                /*
                 * We've been asked for an explicit report before we
                 * even check for pending signals.

Reply via email to