public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: Hemant Kumar Shaw <hkshaw@linux.vnet.ibm.com>
Cc: linux-kernel@vger.kernel.org, Mikhail.Kulemin@ru.ibm.com,
	srikar@linux.vnet.ibm.com, peterz@infradead.org,
	mingo@redhat.com, anton@redhat.com, systemtap@sourceware.org,
	masami.hiramatsu.pt@hitachi.com
Subject: Re: [PATCH] uprobes: Fix limiting un-nested return probes
Date: Sun, 8 Sep 2013 18:32:32 +0200	[thread overview]
Message-ID: <20130908163232.GA32685@redhat.com> (raw)
In-Reply-To: <20130903060959.1351.16587.stgit@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);
 	}
 


  reply	other threads:[~2013-09-08 16:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-03  6:14 [PATCH] uprobes: Fix limiting un-nested return probes Hemant Kumar Shaw
2013-09-08 16:32 ` Oleg Nesterov [this message]
2013-09-09  8:36   ` Anton Arapov
2013-09-09 14:55     ` Oleg Nesterov
2013-09-12  4:49       ` Hemant

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130908163232.GA32685@redhat.com \
    --to=oleg@redhat.com \
    --cc=Mikhail.Kulemin@ru.ibm.com \
    --cc=anton@redhat.com \
    --cc=hkshaw@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masami.hiramatsu.pt@hitachi.com \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=srikar@linux.vnet.ibm.com \
    --cc=systemtap@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox