[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20090525193932.GA22261@redhat.com>
Date: Mon, 25 May 2009 21:39:32 +0200
From: Oleg Nesterov <oleg@...hat.com>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: Christoph Hellwig <hch@...radead.org>, Ingo Molnar <mingo@...e.hu>,
Pavel Emelyanov <xemul@...nvz.org>,
Roland McGrath <roland@...hat.com>,
Sukadev Bhattiprolu <sukadev@...ux.vnet.ibm.com>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/1] ptrace: do_notify_parent_cldstop: fix the wrong
->nsproxy usage
On 05/25, Oleg Nesterov wrote:
>
> If the non-traced sub-thread calls do_notify_parent_cldstop(), we send the
> notification to group_leader->real_parent and we report group_leader's pid.
>
> But, if group_leader is traced we use the wrong ->parent->nsproxy->pid_ns,
> the tracer and parent can live in different namespaces. Change the code
> to use "parent" instead of tsk->parent.
>
> Signed-off-by: Oleg Nesterov <oleg@...hat.com>
>
> --- PTRACE/kernel/signal.c~CLDSTOP_NS 2009-05-25 20:24:50.000000000 +0200
> +++ PTRACE/kernel/signal.c 2009-05-25 20:33:37.000000000 +0200
> @@ -1496,7 +1496,7 @@ static void do_notify_parent_cldstop(str
> * see comment in do_notify_parent() abot the following 3 lines
> */
> rcu_read_lock();
> - info.si_pid = task_pid_nr_ns(tsk, tsk->parent->nsproxy->pid_ns);
> + info.si_pid = task_pid_nr_ns(tsk, parent->nsproxy->pid_ns);
While this change is correct in any case (I hope), I wonder whether
we need another one:
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -1483,12 +1483,12 @@ static void do_notify_parent_cldstop(str
struct task_struct *parent;
struct sighand_struct *sighand;
+ if (!task_ptrace(tsk))
+ tsk = tsk->group_leader;
+
+ parent = tsk->real_parent;
if (task_ptrace(tsk))
parent = tsk->parent;
- else {
- tsk = tsk->group_leader;
- parent = tsk->real_parent;
- }
info.si_signo = SIGCHLD;
info.si_errno = 0;
If the sub-thread is not traced, but ->group_leader is, perhaps it makes
more sense to notify the leader's tracer, not parent?
Not that I think this is really important. Just curious about what was
the intent.
Oleg.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists