lkml.org 
[lkml]   [2011]   [May]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Subject[PATCHSET ptrace] ptrace: implement PTRACE_SEIZE/INTERRUPT and group stop notification, take#2
Date
Hello,

This is the second try at implementing PTRACE_SEIZE/INTERRUPT and
group stop notification. Notable changes from the first take[1] are,

* Prep patches moved to a separate patchset[2].

* JOBCTL_EVENT_INTERRUPT renamed to JOBCTL_EVENT_STOP and now also
used for group stop. This means that PTRACE_GETSIGINFO will always
return a valid siginfo. For signal delivery traps, it will contain
the siginfo for the signal being delivered. For all other traps, it
will contain the trap information which includes group stop info.

* JOBCTL_TRAP_STOP trap doesn't carry signo in si_code and the signal
which initiated the group stop currently in effect can be obtained
from siginfo.si_signo.

* JOBCTL_INTERRUPT triggers JOBCTL_EVENT_STOP and gets cleared on any
trap, so the initial trap by JOBCTL_SEIZE is identical to
JOBCTL_INTERRUPT.

* PTRACE_SETSIGINFO disallows overriding __SI_TRAP siginfo.

* Re-trap delay mechanism added to avoid re-trapping while ptrace
request is in progress.

So, PTRACE_INTERRUPT simply puts the tracee into the same state as
group stop and this simplifies things a lot. Trap siginfo is also
accessible during group stop and group stop notification happening
during PTRACE_EVENT_STOP makes sense and there's no awkward careful
sequencing of traps to avoid unnecessary traps. I think it makes
whole lot more sense this way.

This patchset contains the following ten patches.

0001-signal-remove-three-noop-tracehooks.patch
0002-job-control-introduce-JOBCTL_TRAP_STOP-and-use-it-fo.patch
0003-ptrace-implement-PTRACE_SEIZE.patch
0004-ptrace-implement-PTRACE_INTERRUPT.patch
0005-ptrace-restructure-ptrace_getsiginfo.patch
0006-ptrace-add-siginfo.si_pt_flags.patch
0007-ptrace-make-group-stop-state-visible-via-PTRACE_GETS.patch
0008-ptrace-don-t-let-PTRACE_SETSIGINFO-override-__SI_TRA.patch
0009-ptrace-add-JOBCTL_BLOCK_NOTIFY.patch
0010-ptrace-implement-group-stop-notification-for-ptracer.patch

0001 removes three signal tracehooks. Will be moved to the prep
patchset on the next round.

0002 introduces TRAP_STOP and 0003-0004 implement SEIZE and INTERRUPT.

0005-0008 expose group stop info via GETSIGINFO.

0009-0010 implement group stop notification.

This patchset is on top of Oleg's ptrace branch[3] + prep patchset[2]
and available in the following git branch.

git://git.kernel.org/pub/scm/linux/kernel/git/tj/misc.git review-ptrace-seize

The HEAD is 8026ce454dd46dc3c8cf6bbc57bcd30f5efa4e55. If you see
older branch, please retry after a while (korg is still syncing).

diffstat follows.

arch/ia64/include/asm/siginfo.h | 7 +
arch/ia64/kernel/signal.c | 5
arch/mips/include/asm/compat-signal.h | 7 +
arch/mips/include/asm/siginfo.h | 7 +
arch/mips/kernel/signal32.c | 5
arch/parisc/kernel/signal32.c | 5
arch/parisc/kernel/signal32.h | 7 +
arch/powerpc/kernel/ppc32.h | 7 +
arch/powerpc/kernel/signal_32.c | 5
arch/s390/kernel/compat_linux.h | 7 +
arch/s390/kernel/compat_signal.c | 5
arch/sparc/kernel/signal32.c | 12 +
arch/tile/kernel/compat_signal.c | 11 +
arch/x86/ia32/ia32_signal.c | 4
arch/x86/include/asm/ia32.h | 7 +
include/asm-generic/siginfo.h | 10 +
include/linux/ptrace.h | 13 ++
include/linux/sched.h | 6
include/linux/tracehook.h | 52 --------
kernel/ptrace.c | 202 +++++++++++++++++++++++++++----
kernel/signal.c | 215 +++++++++++++++++++++++-----------
21 files changed, 452 insertions(+), 147 deletions(-)

--
tejun

[1] http://thread.gmane.org/gmane.linux.kernel/1136930
[2] http://thread.gmane.org/gmane.linux.kernel/1139751
[3] git://git.kernel.org/pub/scm/linux/kernel/git/oleg/misc.git


\
 
 \ /
  Last update: 2011-05-16 20:19    [W:0.279 / U:1.008 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site