uprobes: Change uprobe_copy_process() to dup return_instances
authorOleg Nesterov <oleg@redhat.com>
Sun, 13 Oct 2013 19:18:41 +0000 (21:18 +0200)
committerOleg Nesterov <oleg@redhat.com>
Tue, 29 Oct 2013 17:02:53 +0000 (18:02 +0100)
commit248d3a7b2f100078c5f6878351177859380582e9
tree68332322c85a53e47f3db1be0b2556d6c15b27b1
parentaf0d95af79773f7637107cd3871aaabcb425f15a
uprobes: Change uprobe_copy_process() to dup return_instances

uprobe_copy_process() assumes that the new child doesn't need
->utask, it should be allocated by demand.

But this is not true if the forking task has the pending ret-
probes, the child should report them as well and thus it needs
the copy of parent's ->return_instances chain. Otherwise the
child crashes when it returns from the probed function.

Alternatively we could cleanup the child's stack, but this needs
per-arch changes and this is not what we want. At least systemtap
expects a .return in the child too.

Note: this change alone doesn't fix the problem, see the next
change.

Reported-by: Martin Cermak <mcermak@redhat.com>
Reported-by: David Smith <dsmith@redhat.com>
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Acked-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
kernel/events/uprobes.c