[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <4756D87A.3060103@suse.cz>
Date: Wed, 05 Dec 2007 17:57:30 +0100
From: Petr Tesarik <ptesarik@...e.cz>
To: linux-kernel@...r.kernel.org
Cc: Oleg Nesterov <oleg@...sign.ru>,
Roland McGrath <roland@...hat.com>,
Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH] prevent sending wrong signals to a traced process whose
tracer gets killed
Petr Tesarik wrote:
> Hi,
>
> I experienced troubles when tracing a process with strace. Sometimes,
> when I killed the strace process (SIGKILL), the traced process was also
> killed. I found out that it was getting SIGTRAP and, indeed, when the
> traced process set up a signal handler for SIGTRAP, it no longer died.
>
> I noticed that normally, when the traced process is continued (via
> PTRACE_CONT or similar), the signal to be sent to it is stored in
> current->exit_code, which is then examined by the arch-specific code and
> usually leads to something like:
>
> send_sig(current->exit_code, current, 1);
>
> The exit_code is set in ptrace_stop(), but the tracing process may go
> away while the traced process waits for it, and in that case exit_code
> is left as-is. I think we must set it to zero in ptrace_untrace().
My patch was very wrong, but at least I produced a test case. It fails
on all systems I could test. The only correct solution (TM) could be
achieved if we could tell the tracee in ptrace_stop() that the tracer
actually died and it should use nostop_code instead of exit_code.
Possibly a new flag?
Regards,
Petr Tesarik
View attachment "tracerkill.c" of type "text/x-csrc" (3891 bytes)
Powered by blists - more mailing lists