• Oleg Nesterov's avatar
    ptrace: introduce PTRACE_O_EXITKILL · 992fb6e1
    Oleg Nesterov authored
    Ptrace jailers want to be sure that the tracee can never escape
    from the control. However if the tracer dies unexpectedly the
    tracee continues to run in potentially unsafe mode.
    
    Add the new ptrace option PTRACE_O_EXITKILL. If the tracer exits
    it sends SIGKILL to every tracee which has this bit set.
    
    Note that the new option is not equal to the last-option << 1.  Because
    currently all options have an event, and the new one starts the eventless
    group.  It uses the random 20 bit, so we have the room for 12 more events,
    but we can also add the new eventless options below this one.
    
    Suggested by Amnon Shiloh.
    Signed-off-by: default avatarOleg Nesterov <oleg@redhat.com>
    Tested-by: default avatarAmnon Shiloh <u3557@miso.sublimeip.com>
    Cc: Denys Vlasenko <dvlasenk@redhat.com>
    Cc: Michael Kerrisk <mtk.manpages@gmail.com>
    Cc: Serge Hallyn <serge.hallyn@canonical.com>
    Cc: Chris Evans <scarybeasts@gmail.com>
    Cc: David Howells <dhowells@redhat.com>
    Cc: "Eric W. Biederman" <ebiederm@xmission.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    992fb6e1
ptrace.c 26.5 KB