ptrace: simplify ptrace_exit()->ignoring_children() path

Previous thread: ptrace: kill __ptrace_detach(), fix ->exit_state check by Linux Kernel Mailing List on Thursday, April 2, 2009 - 10:02 pm. (1 message)

Next thread: ptrace: reintroduce __ptrace_detach() as a callee of ptrace_exit() by Linux Kernel Mailing List on Thursday, April 2, 2009 - 10:02 pm. (1 message)
From: Linux Kernel Mailing List
Date: Thursday, April 2, 2009 - 10:02 pm

Gitweb:     http://git.kernel.org/linus/6d69cb87f05eef3b02370b2f7bae608ad2301a00
Commit:     6d69cb87f05eef3b02370b2f7bae608ad2301a00
Parent:     95c3eb76dc07fd81289888ffc42948196b34b444
Author:     Oleg Nesterov <oleg@redhat.com>
AuthorDate: Thu Apr 2 16:58:12 2009 -0700
Committer:  Linus Torvalds <torvalds@linux-foundation.org>
CommitDate: Thu Apr 2 19:04:59 2009 -0700

    ptrace: simplify ptrace_exit()->ignoring_children() path
    
    ignoring_children() takes parent->sighand->siglock and checks
    k_sigaction[SIGCHLD] atomically.  But this buys nothing, we can't get the
    "really" wrong result even if we race with sigaction(SIGCHLD).  If we read
    the "stale" sa_handler/sa_flags we can pretend it was changed right after
    the check.
    
    Remove spin_lock(->siglock), and kill "int ign" which caches the result of
    ignoring_children() which becomes rather trivial.
    
    Perhaps it makes sense to export this helper, do_notify_parent() can use
    it too.
    
    Signed-off-by: Oleg Nesterov <oleg@redhat.com>
    Cc: Jerome Marchand <jmarchan@redhat.com>
    Cc: Roland McGrath <roland@redhat.com>
    Cc: Denys Vlasenko <dvlasenk@redhat.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
---
 kernel/exit.c |   25 ++++++++-----------------
 1 files changed, 8 insertions(+), 17 deletions(-)

diff --git a/kernel/exit.c b/kernel/exit.c
index 0c06b9e..7a83114 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -732,19 +732,15 @@ static void exit_mm(struct task_struct * tsk)
 }
 
 /*
- * Return nonzero if @parent's children should reap themselves.
- *
- * Called with write_lock_irq(&tasklist_lock) held.
+ * Called with irqs disabled, returns true if childs should reap themselves.
  */
-static int ignoring_children(struct task_struct *parent)
+static int ignoring_children(struct sighand_struct *sigh)
 {
 	int ret;
-	struct sighand_struct *psig = ...
Previous thread: ptrace: kill __ptrace_detach(), fix ->exit_state check by Linux Kernel Mailing List on Thursday, April 2, 2009 - 10:02 pm. (1 message)

Next thread: ptrace: reintroduce __ptrace_detach() as a callee of ptrace_exit() by Linux Kernel Mailing List on Thursday, April 2, 2009 - 10:02 pm. (1 message)