]> git.karo-electronics.de Git - karo-tx-linux.git/commit
ptrace: fix fork event messages across pid namespaces
authorMatthew Dempsky <mdempsky@chromium.org>
Thu, 22 May 2014 00:44:01 +0000 (10:44 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Thu, 22 May 2014 00:44:01 +0000 (10:44 +1000)
commit0af43546945094535418167636e1322f28d572f6
tree2ca4d64c67804cc6ffae3c262a3cb5b679c8c88e
parent2ea308f9ac9c55cca5a26b7545d60eb0eb98cabb
ptrace: fix fork event messages across pid namespaces

When tracing a process in another pid namespace, it's important for fork
event messages to contain the child's pid as seen from the tracer's pid
namespace, not the parent's.  Otherwise, the tracer won't be able to
correlate the fork event with later SIGTRAP signals it receives from the
child.

We still risk a race condition if a ptracer from a different pid namespace
attaches after we compute the pid_t value.  However, sending a bogus fork
event message in this unlikely scenario is still a vast improvement over
the status quo where we always send bogus fork event messages to debuggers
in a different pid namespace than the forking process.

Signed-off-by: Matthew Dempsky <mdempsky@chromium.org>
Acked-by: Oleg Nesterov <oleg@redhat.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Julien Tinnes <jln@chromium.org>
Cc: Roland McGrath <mcgrathr@chromium.org>
Cc: Jan Kratochvil <jan.kratochvil@redhat.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
include/linux/ptrace.h
kernel/fork.c