kernel: forbid ptrace on system processes
authorNicolas Thery <nthery@gmail.com>
Wed, 18 Dec 2013 09:40:37 +0000 (10:40 +0100)
committerNicolas Thery <nthery@gmail.com>
Wed, 18 Dec 2013 09:51:41 +0000 (10:51 +0100)
commit763ff625ac026cdc723703d67216df6a4cd5d7d8
tree0c5f06ec6f87aebcea42866b0eedb1506d3d7f39
parent0b5d85aaca7aa724d8afcbff712e75c6689b9e5d
kernel: forbid ptrace on system processes

The scenario that triggered this change is the GDB test suite which
tries to attach to process 0 (the swapper).  This dereferenced a NULL
pointer while reparenting the swapper to GDB as the former has no
parent.

ptrace(2) is intended for debugging user processes so prevent it
altogether on system processes as this is deadlock prone.

There were already calls to procfs for preventing accesses to registers
of system processes.  Remove the now superfluous comments but leave
these calls as they may be extended someday to check for more
conditions.

Dragonfly-bug: <http://bugs.dragonflybsd.org/issue2615>
lib/libc/sys/ptrace.2
sys/kern/sys_process.c