This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: [PATCH] uprobes: Fix limiting un-nested return probes
- From: Oleg Nesterov <oleg at redhat dot com>
- To: Hemant Kumar Shaw <hkshaw at linux dot vnet dot ibm dot com>
- Cc: linux-kernel at vger dot kernel dot org, Mikhail dot Kulemin at ru dot ibm dot com, srikar at linux dot vnet dot ibm dot com, peterz at infradead dot org, mingo at redhat dot com, anton at redhat dot com, systemtap at sourceware dot org, masami dot hiramatsu dot pt at hitachi dot com
- Date: Sun, 8 Sep 2013 18:32:32 +0200
- Subject: Re: [PATCH] uprobes: Fix limiting un-nested return probes
- Authentication-results: sourceware.org; auth=none
- References: <20130903060959 dot 1351 dot 16587 dot stgit at hemant-fedora>
Sorry for delay, vacation.
On 09/03, Hemant Kumar Shaw wrote:
>
> There exists a limit to the number of nested return probes. The current limit is 64.
> However this limit is getting enforced on even non nested return probes.
> Hence, registering 64 independent non nested return probes results in failure of
> return probes on the same task. The problem is utask->depth is getting incremented
> unconditionally but decremented only if chained.
Hmm. I'll try to recheck later, but at first glance this logic is indeed
wrong, thanks.
> --- a/kernel/events/uprobes.c
> +++ b/kernel/events/uprobes.c
> @@ -1442,7 +1442,8 @@ static void prepare_uretprobe(struct uprobe *uprobe, struct pt_regs *regs)
> ri->orig_ret_vaddr = orig_ret_vaddr;
> ri->chained = chained;
>
> - utask->depth++;
> + if (chained)
> + utask->depth++;
Not sure, but I can be easily wrong... afaics we need something like below, no?
Anton?
Oleg.
--- x/kernel/events/uprobes.c
+++ x/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);
}