uprobes: Teach uprobe_copy_process() to handle CLONE_VFORK
authorOleg Nesterov <oleg@redhat.com>
Wed, 16 Oct 2013 17:39:37 +0000 (19:39 +0200)
committerOleg Nesterov <oleg@redhat.com>
Tue, 29 Oct 2013 17:02:55 +0000 (18:02 +0100)
commit3ab679661721b1ec2aaad99a801870ed59ab1110
treef651a01eb98dd5454d433da9ae35579242a2cb36
parentaa59c53fd4599c91ccf9629af0c2777b89929076
uprobes: Teach uprobe_copy_process() to handle CLONE_VFORK

uprobe_copy_process() does nothing if the child shares ->mm with
the forking process, but there is a special case: CLONE_VFORK.
In this case it would be more correct to do dup_utask() but avoid
dup_xol(). This is not that important, the child should not unwind
its stack too much, this can corrupt the parent's stack, but at
least we need this to allow to ret-probe __vfork() itself.

Note: in theory, it would be better to check task_pt_regs(p)->sp
instead of CLONE_VFORK, we need to dup_utask() if and only if the
child can return from the function called by the parent. But this
needs the arch-dependant helper, and I think that nobody actually
does clone(same_stack, CLONE_VM).

Reported-by: Martin Cermak <mcermak@redhat.com>
Reported-by: David Smith <dsmith@redhat.com>
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
include/linux/uprobes.h
kernel/events/uprobes.c
kernel/fork.c