All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Vince Weaver <vweaver1@eecs.utk.edu>
Cc: linux-kernel@vger.kernel.org, mingo@elte.hu, paulus@samba.org,
	acme@ghostprotocols.net, Stephane Eranian <eranian@gmail.com>,
	krentel@cs.rice.edu
Subject: Re: perf: overflow signal survives an exec call starting in 3.0
Date: Thu, 25 Aug 2011 16:47:24 +0200	[thread overview]
Message-ID: <1314283644.27911.27.camel@twins> (raw)
In-Reply-To: alpine.DEB.2.00.1108231127380.30837@cl320.eecs.utk.edu

On Thu, 2011-08-25 at 16:37 +0200, Peter Zijlstra wrote:
> On Tue, 2011-08-23 at 11:36 -0400, Vince Weaver wrote:
> > I'm guessing this was an unintended change, although what to do in
> > this situation is a bit vague.
> 
> > 
> > commit f506b3dc0ec454a16d40cab9ee5d75435b39dc50
> > Author: Peter Zijlstra <a.p.zijlstra@chello.nl>
> > Date:   Thu May 26 17:02:53 2011 +0200
> > 
> >     perf: Fix SIGIO handling 
> 
> Ah, quite... its a combination of way too many weird things.
> 
> So that change made it possible (as requested) to receive a signal
> without having to mmap() the buffer, which seems like a perfectly sane
> thing.
> 
> Now, looking at fs/exec.c:setup_new_exec() we see that we only call
> perf_event_exit_task() when we cross a security domain. 
> 
> Previously the exec() would have wiped out the mmap, and hence the
> counter would have stopped sending signals (but not stopped counting).
> 
> Now exec() doesn't normally close fds, so the counter stays around and
> with the new scheme continues sending signals.
> 
> I think the message is, don't do that then.. and use fcntl(fd, F_SETFD,
> FD_CLOEXEC) or so.

That is, I suspect you can get into the same trouble by creating a pipe,
setting F_SETOWN on the read side and then calling exec() while ensuring
someone writes to the thing at the right moment.



      parent reply	other threads:[~2011-08-25 14:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-23 15:36 perf: overflow signal survives an exec call starting in 3.0 Vince Weaver
2011-08-25 14:37 ` Peter Zijlstra
2011-08-25 14:47 ` Peter Zijlstra [this message]

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=1314283644.27911.27.camel@twins \
    --to=peterz@infradead.org \
    --cc=acme@ghostprotocols.net \
    --cc=eranian@gmail.com \
    --cc=krentel@cs.rice.edu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=paulus@samba.org \
    --cc=vweaver1@eecs.utk.edu \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.