Re: [PATCH 1/1] ptrace: do_notify_parent_cldstop: fix the wrong ->nsproxy usage

Oleg Nesterov
2009-05-27T23:48:41Z

On 05/27, Roland McGrath wrote:
>
> > No, task_pid_vnr(current) in ptrace_notify() is not right. If the tracer
> > does PTRACE_GETSIGINFO it gets the wrong .si_pid.
>
> I don't follow. PTRACE_GETSIGINFO gets the tracee's siginfo_t data--modulo
> 32/64 conversions it's the data structure the tracee process sees on its
> stack when running a handler. It's not like a signal sent into the
> tracer's queue (like SIGCHLD in do_notify_*), where the kernel doing
> translation to the tracer's context makes sense. It's more like some
> memory you read from the tracee.

Yes, but the (minor and low priority) problem is that .si_pid recorded
in ->last_siginfo does not match the tracee's pid from the tracer pov
(if they run in different namespaces).

Suppose that that we trace the task from the sub-namespace. We see its
pid == 100, but when this tracee calls ptrace_notify() it does
info.si_pid = task_pid_vnr(current), and task_pid_vnr() returns (say) 10.

Oleg.