aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/events/uprobes.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/events/uprobes.c')
-rw-r--r--kernel/events/uprobes.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c
index 65429ad2ce51..6ab00e090c87 100644
--- a/kernel/events/uprobes.c
+++ b/kernel/events/uprobes.c
@@ -1404,6 +1404,13 @@ static void prepare_uretprobe(struct uprobe *uprobe, struct pt_regs *regs)
1404 if (!utask) 1404 if (!utask)
1405 return; 1405 return;
1406 1406
1407 if (utask->depth >= MAX_URETPROBE_DEPTH) {
1408 printk_ratelimited(KERN_INFO "uprobe: omit uretprobe due to"
1409 " nestedness limit pid/tgid=%d/%d\n",
1410 current->pid, current->tgid);
1411 return;
1412 }
1413
1407 ri = kzalloc(sizeof(struct return_instance), GFP_KERNEL); 1414 ri = kzalloc(sizeof(struct return_instance), GFP_KERNEL);
1408 if (!ri) 1415 if (!ri)
1409 goto fail; 1416 goto fail;
@@ -1439,6 +1446,8 @@ static void prepare_uretprobe(struct uprobe *uprobe, struct pt_regs *regs)
1439 ri->orig_ret_vaddr = orig_ret_vaddr; 1446 ri->orig_ret_vaddr = orig_ret_vaddr;
1440 ri->chained = chained; 1447 ri->chained = chained;
1441 1448
1449 utask->depth++;
1450
1442 /* add instance to the stack */ 1451 /* add instance to the stack */
1443 ri->next = utask->return_instances; 1452 ri->next = utask->return_instances;
1444 utask->return_instances = ri; 1453 utask->return_instances = ri;
@@ -1681,6 +1690,8 @@ static bool handle_trampoline(struct pt_regs *regs)
1681 if (!chained) 1690 if (!chained)
1682 break; 1691 break;
1683 1692
1693 utask->depth--;
1694
1684 BUG_ON(!ri); 1695 BUG_ON(!ri);
1685 } 1696 }
1686 1697