* [ptrace] Problem with ptrace cleanup logic.
@ 2012-02-23 5:26 Tetsuo Handa
2012-02-23 15:17 ` Oleg Nesterov
0 siblings, 1 reply; 2+ messages in thread
From: Tetsuo Handa @ 2012-02-23 5:26 UTC (permalink / raw)
To: oleg, tj; +Cc: linux-kernel
I noticed that ptrace(PTRACE_ATTACH, 1) makes the global init process remain
killable even after a process that called ptrace(PTRACE_ATTACH, 1) exits.
Steps to reproduce:
(1) Compile ptrace-init.c as ./a.out .
----- ptrace-init.c -----
#include <sys/ptrace.h>
#include <stdio.h>
int main(int argc, char *argv[])
{
printf("PTRACE_ATTACH=%ld\n", ptrace(PTRACE_ATTACH, 1));
return 0;
}
----- ptrace-init.c -----
(2) Run below commands as root user.
# ./a.out
# kill -KILL 1
Result on 2.6.26.8 to 2.6.29.6 is
# head -n 2 /proc/1/status
Name: init
State: S (sleeping)
# ./a.out
PTRACE_ATTACH=0
# head -n 2 /proc/1/status
Name: init
State: S (sleeping)
# kill -KILL 1
Result on 2.6.30.10 to 3.3-rc4 is
# head -n 2 /proc/1/status
Name: init
State: S (sleeping)
# ./a.out
PTRACE_ATTACH=0
# head -n 2 /proc/1/status
Name: init
State: T (stopped)
# kill -KILL 1
Kernel panic - not syncing: Attempted to kill init!
As you can see, the global init process remains "T (stopped)" state. I think
this is a regression because it always triggers kernel panic upon sysvinit's
shutdown sequence.
Sending all processes the TERM signal...done.
Sending all processes the KILL signal...
Kernel panic - not syncing: Attempted to kill init!
Pid: 1, comm: init Not tainted 3.2.7 #1
Call Trace:
[<c10354c3>] panic+0x63/0x170
[<c1038123>] find_new_reaper+0xa3/0xb0
[<c103824c>] forget_original_parent+0x2c/0x180
[<c11c7f24>] ? get_current_tty+0x54/0x70
If ptrace-init.c were expected to do some cleanup logic before exit, we can't
force ptrace-init.c to do it, for ptrace-init.c can be terminated unexpectedly.
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [ptrace] Problem with ptrace cleanup logic.
2012-02-23 5:26 [ptrace] Problem with ptrace cleanup logic Tetsuo Handa
@ 2012-02-23 15:17 ` Oleg Nesterov
0 siblings, 0 replies; 2+ messages in thread
From: Oleg Nesterov @ 2012-02-23 15:17 UTC (permalink / raw)
To: Tetsuo Handa; +Cc: tj, linux-kernel
On 02/23, Tetsuo Handa wrote:
>
> I noticed that ptrace(PTRACE_ATTACH, 1) makes the global init process remain
> killable even after a process that called ptrace(PTRACE_ATTACH, 1) exits.
Yes, known problem. We should cleanup the usage of signal->flags.
This also allows to kill the new bitfields in signal_struct.
But firstly we should cleanup force_sig_info(), I sent the initial
patches.
The problem is: init loses SIGNAL_UNKILLABLE.
Oleg.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-02-23 15:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-23 5:26 [ptrace] Problem with ptrace cleanup logic Tetsuo Handa
2012-02-23 15:17 ` Oleg Nesterov
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.