[ 084/110] uprobes: Fix utask->depth accounting in handle_trampoline()

From: Greg Kroah-Hartman
Date: Tue Sep 24 2013 - 20:58:43 EST


3.10-stable review patch. If anyone has any objections, please let me know.

------------------

From: Oleg Nesterov <oleg@xxxxxxxxxx>

commit 878b5a6efd38030c7a90895dc8346e8fb1e09b4c upstream.

Currently utask->depth is simply the number of allocated/pending
return_instance's in uprobe_task->return_instances list.

handle_trampoline() should decrement this counter every time we
handle/free an instance, but due to typo it does this only if
->chained == T. This means that in the likely case this counter
is never decremented and the probed task can't report more than
MAX_URETPROBE_DEPTH events.

Reported-by: Mikhail Kulemin <Mikhail.Kulemin@xxxxxxxxxx>
Reported-by: Hemant Kumar Shaw <hkshaw@xxxxxxxxxxxxxxxxxx>
Signed-off-by: Oleg Nesterov <oleg@xxxxxxxxxx>
Acked-by: Anton Arapov <anton@xxxxxxxxxx>
Cc: masami.hiramatsu.pt@xxxxxxxxxxx
Cc: srikar@xxxxxxxxxxxxxxxxxx
Cc: systemtap@xxxxxxxxxxxxxx
Link: http://lkml.kernel.org/r/20130911154726.GA8093@xxxxxxxxxx
Signed-off-by: Ingo Molnar <mingo@xxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>

---
kernel/events/uprobes.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

--- a/kernel/events/uprobes.c
+++ b/kernel/events/uprobes.c
@@ -1682,12 +1682,10 @@ static bool handle_trampoline(struct pt_
tmp = ri;
ri = ri->next;
kfree(tmp);
+ utask->depth--;

if (!chained)
break;
-
- utask->depth--;
-
BUG_ON(!ri);
}



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/