1. 27 7月, 2008 6 次提交
    • R
      tracehook: release_task · dae33574
      Roland McGrath 提交于
      This moves the ptrace-related logic from release_task into tracehook.h and
      ptrace.h inlines.  It provides clean hooks both before and after locking
      tasklist_lock, for future tracing logic to do more cleanup without the
      lock.
      
      This also changes release_task() itself in the rare "zap_leader" case to
      set the leader to EXIT_DEAD before iterating.  This maintains the
      invariant that release_task() only ever handles a task in EXIT_DEAD.  This
      is a common-sense invariant that is already always true except in this one
      arcane case of zombie leader whose parent ignores SIGCHLD.
      
      This change is harmless and only costs one store in this one rare case.
      It keeps the expected state more consisently sane, which is nicer when
      debugging weirdness in release_task().  It also lets some future code in
      the tracehook entry points rely on this invariant for bookkeeping.
      Signed-off-by: NRoland McGrath <roland@redhat.com>
      Cc: Oleg Nesterov <oleg@tv-sign.ru>
      Reviewed-by: NIngo Molnar <mingo@elte.hu>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      dae33574
    • R
      tracehook: vfork-done · daded34b
      Roland McGrath 提交于
      This moves the PTRACE_EVENT_VFORK_DONE tracing into a tracehook.h inline,
      tracehook_report_vfork_done().  The change has no effect, just clean-up.
      Signed-off-by: NRoland McGrath <roland@redhat.com>
      Cc: Oleg Nesterov <oleg@tv-sign.ru>
      Reviewed-by: NIngo Molnar <mingo@elte.hu>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      daded34b
    • R
      tracehook: clone · 09a05394
      Roland McGrath 提交于
      This moves all the ptrace initialization and tracing logic for task
      creation into tracehook.h and ptrace.h inlines.  It reorganizes the code
      slightly, but should not change any behavior.
      
      There are four tracehook entry points, at each important stage of task
      creation.  This keeps the interface from the core fork.c code fairly
      clean, while supporting the complex setup required for ptrace or something
      like it.
      Signed-off-by: NRoland McGrath <roland@redhat.com>
      Cc: Oleg Nesterov <oleg@tv-sign.ru>
      Reviewed-by: NIngo Molnar <mingo@elte.hu>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      09a05394
    • R
      tracehook: exit · 30199f5a
      Roland McGrath 提交于
      This moves the PTRACE_EVENT_EXIT tracing into a tracehook.h inline,
      tracehook_report_exec().  The change has no effect, just clean-up.
      Signed-off-by: NRoland McGrath <roland@redhat.com>
      Cc: Oleg Nesterov <oleg@tv-sign.ru>
      Reviewed-by: NIngo Molnar <mingo@elte.hu>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      30199f5a
    • R
      tracehook: exec · 6341c393
      Roland McGrath 提交于
      This moves all the ptrace hooks related to exec into tracehook.h inlines.
      
      This also lifts the calls for tracing out of the binfmt load_binary hooks
      into search_binary_handler() after it calls into the binfmt module.  This
      change has no effect, since all the binfmt modules' load_binary functions
      did the call at the end on success, and now search_binary_handler() does
      it immediately after return if successful.  We consolidate the repeated
      code, and binfmt modules no longer need to import ptrace_notify().
      Signed-off-by: NRoland McGrath <roland@redhat.com>
      Cc: Oleg Nesterov <oleg@tv-sign.ru>
      Reviewed-by: NIngo Molnar <mingo@elte.hu>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      6341c393
    • R
      tracehook: add linux/tracehook.h · 88ac2921
      Roland McGrath 提交于
      This patch series introduces the "tracehook" interface layer of inlines in
      <linux/tracehook.h>.  There are more details in the log entry for patch
      01/23 and in the header file comments inside that patch.  Most of these
      changes move code around with little or no change, and they should not
      break anything or change any behavior.
      
      This sets a new standard for uniform arch support to enable clean
      arch-independent implementations of new debugging and tracing stuff,
      denoted by CONFIG_HAVE_ARCH_TRACEHOOK.  Patch 20/23 adds that symbol to
      arch/Kconfig, with comments listing everything an arch has to do before
      setting "select HAVE_ARCH_TRACEHOOK".  These are elaborted a bit at:
      
      	http://sourceware.org/systemtap/wiki/utrace/arch/HowTo
      
      The new inlines that arch code must define or call have detailed kerneldoc
      comments in the generic header files that say what is required.
      
      No arch is obligated to do any work, and no arch's build should be broken
      by these changes.  There are several steps that each arch should take so
      it can set HAVE_ARCH_TRACEHOOK.  Most of these are simple.  Providing this
      support will let new things people add for doing debugging and tracing of
      user-level threads "just work" for your arch in the future.  For an arch
      that does not provide HAVE_ARCH_TRACEHOOK, some new options for such
      features will not be available for config.
      
      I have done some arch work and will submit this to the arch maintainers
      after the generic tracehook series settles in.  For now, that work is
      available in my GIT repositories, and in patch and mbox-of-patches form at
      http://people.redhat.com/roland/utrace/2.6-current/
      
      This paves the way for my "utrace" work, to be submitted later.  But it is
      not innately tied to that.  I hope that the tracehook series can go in
      soon regardless of what eventually does or doesn't go on top of it.  For
      anyone implementing any kind of new tracing/debugging plan, or just
      understanding all the context of the existing ptrace implementation,
      having tracehook.h makes things much easier to find and understand.
      
      This patch:
      
      This adds the new kernel-internal header file <linux/tracehook.h>.  This
      is not yet used at all.  The comments in the header introduce what the
      following series of patches is about.
      
      The aim is to formalize and consolidate all the places that the core
      kernel code and the arch code now ties into the ptrace implementation.
      
      These patches mostly don't cause any functional change.  They just move
      the details of ptrace logic out of core code into tracehook.h inlines,
      where they are mostly compiled away to the same as before.  All that
      changes is that everything is thoroughly documented and any future
      reworking of ptrace, or addition of something new, would not have to touch
      core code all over, just change the tracehook.h inlines.
      
      The new linux/ptrace.h inlines are used by the following patches in the
      new tracehook_*() inlines.  Using these helpers for the ptrace event stops
      makes it simple to change or disable the old ptrace implementation of
      these stops conditionally later.
      Signed-off-by: NRoland McGrath <roland@redhat.com>
      Cc: Oleg Nesterov <oleg@tv-sign.ru>
      Reviewed-by: NIngo Molnar <mingo@elte.hu>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      88ac2921