The patch titled
     wait_task_continued/zombie: don't use task_pid_nr_ns() lockless
has been added to the -mm tree.  Its filename is
     wait_task_continued-zombie-dont-use-task_pid_nr_ns-lockless.patch

*** Remember to use Documentation/SubmitChecklist when testing your code ***

See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find
out what to do about this

------------------------------------------------------
Subject: wait_task_continued/zombie: don't use task_pid_nr_ns() lockless
From: Oleg Nesterov <[EMAIL PROTECTED]>

Surprise, other 2 wait_task_() functions also abuse task_pid_nr_ns().  May
cause read-after-free or report nr == 0 in wait_task_continued(). 
wait_task_zombie() doesn't have this problem, but still it is better to cache
pid_t rather than call task_pid_nr_ns() 3 times on the saved pid_namespace.

Signed-off-by: Oleg Nesterov <[EMAIL PROTECTED]>
Cc: Roland McGrath <[EMAIL PROTECTED]>
Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
---

 kernel/exit.c |   15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

diff -puN 
kernel/exit.c~wait_task_continued-zombie-dont-use-task_pid_nr_ns-lockless 
kernel/exit.c
--- a/kernel/exit.c~wait_task_continued-zombie-dont-use-task_pid_nr_ns-lockless
+++ a/kernel/exit.c
@@ -1186,12 +1186,9 @@ static int wait_task_zombie(struct task_
 {
        unsigned long state;
        int retval, status, traced;
-       struct pid_namespace *ns;
-
-       ns = current->nsproxy->pid_ns;
+       pid_t pid = task_pid_nr_ns(p, current->nsproxy->pid_ns);
 
        if (unlikely(noreap)) {
-               pid_t pid = task_pid_nr_ns(p, ns);
                uid_t uid = p->uid;
                int exit_code = p->exit_code;
                int why, status;
@@ -1310,11 +1307,11 @@ static int wait_task_zombie(struct task_
                        retval = put_user(status, &infop->si_status);
        }
        if (!retval && infop)
-               retval = put_user(task_pid_nr_ns(p, ns), &infop->si_pid);
+               retval = put_user(pid, &infop->si_pid);
        if (!retval && infop)
                retval = put_user(p->uid, &infop->si_uid);
        if (!retval)
-               retval = task_pid_nr_ns(p, ns);
+               retval = pid;
 
        if (traced) {
                write_lock_irq(&tasklist_lock);
@@ -1433,7 +1430,6 @@ static int wait_task_continued(struct ta
        int retval;
        pid_t pid;
        uid_t uid;
-       struct pid_namespace *ns;
 
        if (!(p->signal->flags & SIGNAL_STOP_CONTINUED))
                return 0;
@@ -1448,8 +1444,7 @@ static int wait_task_continued(struct ta
                p->signal->flags &= ~SIGNAL_STOP_CONTINUED;
        spin_unlock_irq(&p->sighand->siglock);
 
-       ns = current->nsproxy->pid_ns;
-       pid = task_pid_nr_ns(p, ns);
+       pid = task_pid_nr_ns(p, current->nsproxy->pid_ns);
        uid = p->uid;
        get_task_struct(p);
        read_unlock(&tasklist_lock);
@@ -1460,7 +1455,7 @@ static int wait_task_continued(struct ta
                if (!retval && stat_addr)
                        retval = put_user(0xffff, stat_addr);
                if (!retval)
-                       retval = task_pid_nr_ns(p, ns);
+                       retval = pid;
        } else {
                retval = wait_noreap_copyout(p, pid, uid,
                                             CLD_CONTINUED, SIGCONT,
_

Patches currently in -mm which might be from [EMAIL PROTECTED] are

wait_task_stopped-dont-use-task_pid_nr_ns-lockless.patch
proc-remove-races-from-proc_id_readdir.patch
wait_task_stopped-pass-correct-exit_code-to.patch
use-__set_task_state-for-traced-stopped-tasks.patch
add-task_wakekill.patch
do_wait-remove-one-else-if-branch.patch
proc-implement-proc_single_file_operations.patch
proc-rewrite-do_task_stat-to-correctly-handle-pid-namespaces.patch
proc-seqfile-convert-proc_pid_statm.patch
proc-proper-pidns-handling-for-proc-self.patch
proc-fix-the-threaded-proc-self.patch
kill-pt_attached.patch
kill-my_ptrace_child.patch
ptrace_check_attach-remove-unneeded-signal-=-null-check.patch
ptrace_stop-fix-the-race-with-ptrace-detachattach.patch
wait_task_stopped-simplify-and-fix-races-with-sigcont-sigkill-untrace.patch
do_wait-factor-out-retval-=-0-checks.patch
ptrace_stop-fix-racy-nonstop_code-setting.patch
wait_task_stopped-remove-unneeded-delay_group_leader-check.patch
do_wait-cleanup-delay_group_leader-usage.patch
do_wait-fix-security-checks.patch
wait_task_continued-zombie-dont-use-task_pid_nr_ns-lockless.patch
wait_task_zombie-remove-exit_state-exit_signal-checks-for-wnowait.patch

-
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to