public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Alexandre Oliva <oliva@adacore.com>
To: "Kewen.Lin" <linkw@linux.ibm.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>,
	Richard Biener <richard.guenther@gmail.com>,
	Jakub Jelinek <jakub@redhat.com>,
	Peter Bergner <bergner@linux.ibm.com>,
	Segher Boessenkool <segher@kernel.crashing.org>,
	Jeff Law <jeffreyalaw@gmail.com>,
	Richard Sandiford <richard.sandiford@arm.com>
Subject: Re: [PATCH] strub: Only unbias stack point for SPARC_STACK_BOUNDARY_HACK [PR113100]
Date: Thu, 11 Jan 2024 06:05:27 -0300	[thread overview]
Message-ID: <orttnkgrzc.fsf@lxoliva.fsfla.org> (raw)
In-Reply-To: <91d2c107-0168-791b-b5fa-de21c2345f84@linux.ibm.com> (Kewen Lin's message of "Mon, 8 Jan 2024 10:35:07 +0800")

On Jan  7, 2024, "Kewen.Lin" <linkw@linux.ibm.com> wrote:

> As PR113100 shows, the unbiasing introduced by r14-6737 can
> cause the scrubbing to overrun and screw some critical data
> on stack like saved toc base consequently cause segfault on
> Power.

Ugh.  Sorry about the breakage, and thanks for addressing it during my
absence.  Happy GNU Year! :-)

> By checking PR112917, IMHO we should keep this unbiasing
> guarded under SPARC_STACK_BOUNDARY_HACK (TARGET_ARCH64 &&
> TARGET_STACK_BIAS), similar to some existing code special
> treating SPARC stack bias.

I'm afraid this change will most certainly regress 32-bit sparc, because
of the large register save area.

I had been hesitant to introduce yet another target configuration knob,
but it looks like this is what we're going to have to do to accommodate
all targets.

> I also expect the culprit commit can
> affect those ports with nonzero STACK_POINTER_OFFSET.

IMHO it really shouldn't.  STACK_POINTER_OFFSET should be the "Offset
from the stack pointer register to the first location at which outgoing
arguments are placed", which suggests to me that no data that the callee
couldn't change should go in the area below (or above) %sp+S_P_O.

ISTM that PPC sets up a save area between the outgoing args and the
stack pointer; I don't think that's very common, but I suppose other
targets that do so would also define STACK_POINTER_OFFSET to nonzero so
as to reserve those bits.  But whether they should be cleared by stack
scrubbing, as on sparc, or preserved, as on ppc, depends on the ABI
conventions, so we probably can't help yet another knob :-/

I'll take care of that, and update the corresponding documentation.

Thanks,

-- 
Alexandre Oliva, happy hacker            https://FSFLA.org/blogs/lxo/
   Free Software Activist                   GNU Toolchain Engineer
More tolerance and less prejudice are key for inclusion and diversity
Excluding neuro-others for not behaving ""normal"" is *not* inclusive

  parent reply	other threads:[~2024-01-11  9:06 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-08  2:35 Kewen.Lin
2024-01-08 11:44 ` Richard Biener
2024-01-10  5:11   ` Kewen.Lin
2024-01-11  9:05 ` Alexandre Oliva [this message]
2024-01-12  3:02   ` Kewen.Lin
2024-01-12 11:03     ` Alexandre Oliva
2024-01-15  6:13       ` Kewen.Lin
2024-01-18  1:06 ` Alexandre Oliva
2024-01-18  1:27   ` David Edelsohn
2024-01-18  6:28     ` Kewen.Lin
2024-01-19  6:23       ` Alexandre Oliva
2024-01-30  3:35         ` Alexandre Oliva
2024-01-30  7:32           ` Richard Biener

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=orttnkgrzc.fsf@lxoliva.fsfla.org \
    --to=oliva@adacore.com \
    --cc=bergner@linux.ibm.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=jeffreyalaw@gmail.com \
    --cc=linkw@linux.ibm.com \
    --cc=richard.guenther@gmail.com \
    --cc=richard.sandiford@arm.com \
    --cc=segher@kernel.crashing.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).