|
@@ -1404,6 +1404,13 @@ static void prepare_uretprobe(struct uprobe *uprobe, struct pt_regs *regs)
|
|
|
if (!utask)
|
|
|
return;
|
|
|
|
|
|
+ if (utask->depth >= MAX_URETPROBE_DEPTH) {
|
|
|
+ printk_ratelimited(KERN_INFO "uprobe: omit uretprobe due to"
|
|
|
+ " nestedness limit pid/tgid=%d/%d\n",
|
|
|
+ current->pid, current->tgid);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
ri = kzalloc(sizeof(struct return_instance), GFP_KERNEL);
|
|
|
if (!ri)
|
|
|
goto fail;
|
|
@@ -1439,6 +1446,8 @@ static void prepare_uretprobe(struct uprobe *uprobe, struct pt_regs *regs)
|
|
|
ri->orig_ret_vaddr = orig_ret_vaddr;
|
|
|
ri->chained = chained;
|
|
|
|
|
|
+ utask->depth++;
|
|
|
+
|
|
|
/* add instance to the stack */
|
|
|
ri->next = utask->return_instances;
|
|
|
utask->return_instances = ri;
|
|
@@ -1681,6 +1690,8 @@ static bool handle_trampoline(struct pt_regs *regs)
|
|
|
if (!chained)
|
|
|
break;
|
|
|
|
|
|
+ utask->depth--;
|
|
|
+
|
|
|
BUG_ON(!ri);
|
|
|
}
|
|
|
|