lkml.org 
[lkml]   [2011]   [May]   [29]   [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#4
Date
Hello,

This is the fourth take of PTRACE_SEIZE/INTERRUPT and group stop
notification patchset. This patchset contains both the prep and the
actual implementation patches.

I'm traveling from tomorrow and wanted to send out the revised version
before leaving, so I didn't spend enough time testing the notification
part. I haven't tested things like INTERRUPT cancelling listening or
immediate re-trap triggering on LISTEN. But the basics are tested and
it should be enough to decide on direction. BTW, Oleg, nice
suggestions. I much prefer this over the TRAPPING one. :)

Notable changes from the third take[1] are,

* PTRACE_TRAP_NOTIFY is now cleared on the next STOP trap instead of
PTRACE_GETSIGINFO as suggested by Oleg.

* PTRACE_LISTEN added. This puts tracee into quasi-active state where
wait(2) and sync ptrace requests fail and tracee is allowed to
re-trap into STOP to notify an async event. This makes re-trapping
protection with TRAPPING unnecessary and makes the implementation
noticeably simpler. Also suggested by Oleg.

Per patch changes:

* The following patches are dropped.

0008-ptrace-move-JOBCTL_TRAPPING-wait-to-wait-2-and-ptrac.patch
0009-ptrace-make-TRAPPING-wait-interruptible.patch
0014-ptrace-restructure-ptrace_getsiginfo.patch
0018-ptrace-add-JOBCTL_BLOCK_NOTIFY.patch
0019-ptrace-implement-group-stop-notification-for-ptracer.patch

* The following patches are added

0001-ptrace-remove-silly-wait_trap-variable-from-ptrace_a.patch
0016-ptrace-implement-TRAP_NOTIFY-and-use-it-for-group-st.patch
0017-ptrace-implement-PTRACE_LISTEN.patch

* 0002-job-control-rename-signal-group_stop-and-flags-to-jo.patch

JOBCTL_*_BIT macros defined to replace ilog2() usage as suggested by
Linus.

* 0010-job-control-introduce-JOBCTL_TRAP_STOP-and-use-it-fo.patch

PTRACE_TRAP_MASK handling in get_signal_delivery() is relocated
after group stop participation inside for(;;) and do_signal_stop()
now returns %false after scheduling STOP trap without releasing
siglock. This removes the extra re-locking and also avoids taking
consecutive traps by consuming group stop first.

* 0014-ptrace-make-group-stop-state-visible-via-PTRACE_GETS.patch

si_pt_flags and si_signo are set while taking trap instead of on
PTRACE_GETSIGINFO. Accordingly, NOTIFY is also cleared on STOP
trap.

This patchset contains the following 17 patches.

0001-ptrace-remove-silly-wait_trap-variable-from-ptrace_a.patch
0002-job-control-rename-signal-group_stop-and-flags-to-jo.patch
0003-ptrace-ptrace_check_attach-rename-kill-to-ignore_sta.patch
0004-ptrace-relocate-set_current_state-TASK_TRACED-in-ptr.patch
0005-job-control-introduce-JOBCTL_PENDING_MASK-and-task_c.patch
0006-job-control-make-task_clear_jobctl_pending-clear-TRA.patch
0007-job-control-introduce-task_set_jobctl_pending.patch
0008-ptrace-use-bit_waitqueue-for-TRAPPING-instead-of-wai.patch
0009-signal-remove-three-noop-tracehooks.patch
0010-job-control-introduce-JOBCTL_TRAP_STOP-and-use-it-fo.patch
0011-ptrace-implement-PTRACE_SEIZE.patch
0012-ptrace-implement-PTRACE_INTERRUPT.patch
0013-ptrace-add-siginfo.si_pt_flags.patch
0014-ptrace-make-group-stop-state-visible-via-PTRACE_GETS.patch
0015-ptrace-don-t-let-PTRACE_SETSIGINFO-override-__SI_TRA.patch
0016-ptrace-implement-TRAP_NOTIFY-and-use-it-for-group-st.patch
0017-ptrace-implement-PTRACE_LISTEN.patch

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 a48ca3deab (ptrace: implement PTRACE_LISTEN). If you see
older branch, please retry after a while (korg is still syncing).
The patchset is on top of today's (20110530) mainline - 139f37f5e1
(Merge branch 'for-linus' of
git://git.kernel.org/pub/scm/linux/kernel/git/vapier/blackfin).

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
fs/exec.c | 2
include/asm-generic/siginfo.h | 10
include/linux/ptrace.h | 16 +
include/linux/sched.h | 37 ++-
include/linux/tracehook.h | 52 -----
kernel/exit.c | 2
kernel/ptrace.c | 190 +++++++++++++++---
kernel/signal.c | 351 ++++++++++++++++++++++------------
23 files changed, 543 insertions(+), 218 deletions(-)
Thanks.

--
tejun

[1] http://thread.gmane.org/gmane.linux.kernel/1144997


\
 
 \ /
  Last update: 2011-05-30 01:15    [from the cache]
©2003-2014 Jasper Spaans. Advertise on this site