linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCHSET ptrace] ptrace: prepare for PTRACE_SEIZE/INTERRUPT
@ 2011-05-13 15:46 Tejun Heo
  2011-05-13 15:46 ` [PATCH 1/9] job control: reorganize wait_task_stopped() Tejun Heo
                   ` (8 more replies)
  0 siblings, 9 replies; 24+ messages in thread
From: Tejun Heo @ 2011-05-13 15:46 UTC (permalink / raw)
  To: oleg, jan.kratochvil, vda.linux
  Cc: linux-kernel, torvalds, akpm, indan, bdonlan

Hello,

This patchset is extension of preparation patches extracted from
"ptrace: implement PTRACE_SEIZE/INTERRUPT and group stop notification"
patchset[1].

Trivial and reviewed ones are collected at the beginning so that they
can be applied to the ptrace tree.  The latter half concentrates on
improving TRAPPING handling without actually implementing any new
ptrace request.

This patchset makes the following changes to TRAPPING wait.

* TRAPPING is cleared when an action which requires cancellation
  happens and the fallback clearing at the end of do_signal_stop() is
  removed.  This doesn't require adding any extra callsite to
  clear_trapping() explicitly.  Jobctl flag clearing automatically
  handles cancellation of TRAPPING.

* Instead of signal->wait_chldexit, bit waitqueue is used.  This
  removes the unnecessary complexity and dependency on parent/child
  hierarchy of TRAPPING wait.  Note that this removes the wrong wait
  queue bug Oleg pointed out in wait_trapping().

* TRAPPING wait is moved from PTRACE_ATTACH to wait_task_stopped() and
  ptrace_check_attach().  In both cases, TRAPPING uses
  restart_syscall() to retry.  This simplifies the code and combined
  with the next change makes TRAPPING much safer.

* TRAPPING now uses interruptible sleep.  This makes it way safer even
  if we get something wrong - at least, the tracer can be easily
  killed no matter what.  Also, this makes TRAPPING wait behave just
  like other syscall retries and mixing TRAPPING waits with freezing
  becomes much easier.

Other than making the transient TASK_RUNNING during TRAPPING visible
through /proc and using automatically restarted interruptible sleep,
this patchset doesn't make userland visible changes.

This patchset contains the following nine patches.

  0001-job-control-reorganize-wait_task_stopped.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-ptrace-use-bit_waitqueue-for-TRAPPING-instead-of-wai.patch
  0008-ptrace-move-JOBCTL_TRAPPING-wait-to-wait-2-and-ptrac.patch
  0009-ptrace-make-TRAPPING-wait-interruptible.patch

0001-0004 are reviewed or mostly trivial prep patches.

0005-0006 move clearing of TRAPPING to the actions requiring it.

0007 makes TRAPPING wait use bit waitqueue.

0008-0009 moves TRAPPING wait to wait(2) and ptrace_check_attach() and
makes it interruptible.

This patchset is on top of the current ptrace branch[2] - 40ae717d1e
"ptrace: fix signal->wait_chldexit usage in
task_clear_group_stop_trapping()" and is availble in the following git
branch.

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

diffstat follows.

 fs/exec.c              |    2 
 include/linux/ptrace.h |    3 -
 include/linux/sched.h  |   19 ++++--
 kernel/exit.c          |   46 +++++++++++++---
 kernel/ptrace.c        |   92 ++++++++++++++++++++++++++++-----
 kernel/signal.c        |  134 +++++++++++++++++++++++++------------------------
 6 files changed, 200 insertions(+), 96 deletions(-)

Thanks.

--
tejun

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

^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2011-05-16 16:36 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-13 15:46 [PATCHSET ptrace] ptrace: prepare for PTRACE_SEIZE/INTERRUPT Tejun Heo
2011-05-13 15:46 ` [PATCH 1/9] job control: reorganize wait_task_stopped() Tejun Heo
2011-05-16 11:56   ` Oleg Nesterov
2011-05-13 15:46 ` [PATCH 2/9] job control: rename signal->group_stop and flags to jobctl and rearrange flags Tejun Heo
2011-05-13 15:46 ` [PATCH 3/9] ptrace: ptrace_check_attach(): rename @kill to @ignore_state and add comments Tejun Heo
2011-05-13 15:46 ` [PATCH 4/9] ptrace: relocate set_current_state(TASK_TRACED) in ptrace_stop() Tejun Heo
2011-05-16 11:57   ` Oleg Nesterov
2011-05-16 13:16     ` Tejun Heo
2011-05-16 15:51       ` Oleg Nesterov
2011-05-16 15:59         ` Tejun Heo
2011-05-16 16:34           ` Oleg Nesterov
2011-05-13 15:46 ` [PATCH 5/9] job control: introduce JOBCTL_PENDING_MASK and task_clear_jobctl_pending() Tejun Heo
2011-05-13 15:46 ` [PATCH 6/9] job control: make task_clear_jobctl_pending() clear TRAPPING automatically Tejun Heo
2011-05-16 12:25   ` Oleg Nesterov
2011-05-16 13:24     ` Tejun Heo
2011-05-16 16:00       ` Oleg Nesterov
2011-05-16 16:09         ` Tejun Heo
2011-05-13 15:46 ` [PATCH 7/9] ptrace: use bit_waitqueue for TRAPPING instead of wait_chldexit Tejun Heo
2011-05-13 15:46 ` [PATCH 8/9] ptrace: move JOBCTL_TRAPPING wait to wait(2) and ptrace_check_attach() Tejun Heo
2011-05-14 14:22   ` [PATCH UPDATED " Tejun Heo
2011-05-16 12:11     ` Oleg Nesterov
2011-05-16 13:36       ` Tejun Heo
2011-05-16 16:04         ` Oleg Nesterov
2011-05-13 15:46 ` [PATCH 9/9] ptrace: make TRAPPING wait interruptible Tejun Heo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).