public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Segher Boessenkool <segher@kernel.crashing.org>
To: Olivier Hainque <hainque@adacore.com>
Cc: Jeff Law <law@redhat.com>,
	Andreas Krebbel <krebbel@linux.vnet.ibm.com>,
	       Alan Modra <amodra@gmail.com>,
	GCC Patches <gcc-patches@gcc.gnu.org>,
	       Richard Henderson <rth@redhat.com>,
	uweigand@de.ibm.com
Subject: Re: rs6000 stack_tie mishap again
Date: Fri, 15 Apr 2016 17:26:00 -0000	[thread overview]
Message-ID: <20160415172610.GB17251@gate.crashing.org> (raw)
In-Reply-To: <EEFAD047-68EB-4C42-9867-7B7CE0F68065@adacore.com>

On Fri, Apr 15, 2016 at 07:05:25PM +0200, Olivier Hainque wrote:
> > But don't you run the risk that the stack could be deallocated before the restores are done?  This came up on the PA port a long time ago. IIRC the situations was something like this:
> > 
> > We had a frame pointer and all the restores were being done via the frame pointer.  So the scheduler moved the stack pointer adjustment up past the register restores.  At which point the restores were reading from unallocated stack space.
> > 
> > 99.99% of the time it didn't cause a problem.  But if we got an interrupt in that brief window, boom, the interrupt handler could allocate a frame on the current stack, store some data in there which clobbered the saved register state.
> 
> Yes, that's exactly the kind of problem we're fighting and, indeed,
> the memory barrier alone isn't enough.
> 
> Here, the idea is to add a memory barrier to the set of things that the rs6000
> back-end already does, which tries to be better than a complete scheduling
> barrier (see rs6000_emit_stack_tie), but turns out to still fail in some corner
> cases due to alias analysis intricacies (original problem description at
> the very beginning of this now long thread: 
> https://gcc.gnu.org/ml/gcc-patches/2016-03/msg01337.html)

I think the best thing to do is add the clobber-of-mem-scratch to the
final stack deallocate (as a parallel).  I don't see anything else that
will work reliably.


Segher

  reply	other threads:[~2016-04-15 17:26 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-23 16:24 Olivier Hainque
2016-03-24  7:51 ` Alan Modra
2016-03-24 10:32   ` Olivier Hainque
2016-03-24 17:00     ` Jeff Law
2016-03-28 19:58   ` Richard Henderson
2016-04-08  8:25     ` Olivier Hainque
2016-04-08 15:37       ` Segher Boessenkool
2016-04-08 16:01         ` Olivier Hainque
2016-04-11 10:15     ` Olivier Hainque
2016-04-14 15:47       ` Andreas Krebbel
2016-04-14 16:50         ` Jeff Law
2016-04-14 17:10           ` Olivier Hainque
2016-04-15  4:37             ` Andreas Krebbel
2016-04-15  7:43               ` Olivier Hainque
2016-04-15 16:42             ` Jeff Law
2016-04-15 17:05               ` Olivier Hainque
2016-04-15 17:26                 ` Segher Boessenkool [this message]
2016-04-14 22:42       ` Segher Boessenkool
2016-04-15 15:17         ` Olivier Hainque
2016-03-28  4:48 ` Segher Boessenkool
2016-03-28 11:23   ` Olivier Hainque
2016-03-28 12:44     ` Segher Boessenkool
2016-03-30  9:40       ` Olivier Hainque
2016-03-30 15:15         ` Alan Modra
2016-03-23 17:42 David Edelsohn
2016-03-24  8:17 ` Alan Modra
2016-03-24 10:17   ` Olivier Hainque

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=20160415172610.GB17251@gate.crashing.org \
    --to=segher@kernel.crashing.org \
    --cc=amodra@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hainque@adacore.com \
    --cc=krebbel@linux.vnet.ibm.com \
    --cc=law@redhat.com \
    --cc=rth@redhat.com \
    --cc=uweigand@de.ibm.com \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).