mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Anton Arapov <anton@redhat.com>
To: Oleg Nesterov <oleg@redhat.com>
Cc: Hemant Kumar Shaw <hkshaw@linux.vnet.ibm.com>,
	linux-kernel@vger.kernel.org, Mikhail.Kulemin@ru.ibm.com,
	srikar@linux.vnet.ibm.com, peterz@infradead.org,
	mingo@redhat.com, systemtap@sourceware.org,
	masami.hiramatsu.pt@hitachi.com
Subject: Re: [PATCH] uprobes: Fix limiting un-nested return probes
Date: Mon, 9 Sep 2013 10:36:35 +0200	[thread overview]
Message-ID: <20130909083635.GA3270@bandura.laptop> (raw)
In-Reply-To: <20130908163232.GA32685@redhat.com>

On Sun, Sep 08, 2013 at 06:32:32PM +0200, Oleg Nesterov wrote:
> 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, your guess is correct. 

My original intention was to limit by depth the chained only probes. But later,
after your review, we've decided /based on safety concerns/ to limit it hard.

The decrement 'utask->depth--;' in my own tree is above the 'if (!chained)' 
check. I think it got mangled somehow when I rebased the code before I sent it
to lkml.

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-09  8:37 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-03  6:14 Hemant Kumar Shaw
2013-09-08 16:32 ` Oleg Nesterov
2013-09-09  8:36   ` Anton Arapov [this message]
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=20130909083635.GA3270@bandura.laptop \
    --to=anton@redhat.com \
    --cc=Mikhail.Kulemin@ru.ibm.com \
    --cc=hkshaw@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masami.hiramatsu.pt@hitachi.com \
    --cc=mingo@redhat.com \
    --cc=oleg@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

all inboxes | Powered by JetHome®