From: Richard Biener <richard.guenther@gmail.com>
To: "Kewen.Lin" <linkw@linux.ibm.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>,
Alexandre Oliva <oliva@adacore.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: Mon, 8 Jan 2024 12:44:51 +0100 [thread overview]
Message-ID: <CAFiYyc3xnUb3V=6twTk-yj2aYEoPWZo3qp4bVEVNbkQbNqJB6Q@mail.gmail.com> (raw)
In-Reply-To: <91d2c107-0168-791b-b5fa-de21c2345f84@linux.ibm.com>
On Mon, Jan 8, 2024 at 3:35 AM Kewen.Lin <linkw@linux.ibm.com> wrote:
>
> Hi,
>
> 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.
>
> 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.
>
> Bootstrapped and regtested on x86_64-redhat-linux and
> powerpc64{,le}-linux-gnu. All reported failures in
> PR113100 are gone. I also expect the culprit commit can
> affect those ports with nonzero STACK_POINTER_OFFSET.
>
> Is it ok for trunk?
OK
> BR,
> Kewen
> -----
> PR middle-end/113100
>
> gcc/ChangeLog:
>
> * builtins.cc (expand_builtin_stack_address): Guard stack point
> adjustment with SPARC_STACK_BOUNDARY_HACK.
> ---
> gcc/builtins.cc | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/gcc/builtins.cc b/gcc/builtins.cc
> index 125ea158ebf..9bad1e962b4 100644
> --- a/gcc/builtins.cc
> +++ b/gcc/builtins.cc
> @@ -5450,6 +5450,7 @@ expand_builtin_stack_address ()
> rtx ret = convert_to_mode (ptr_mode, copy_to_reg (stack_pointer_rtx),
> STACK_UNSIGNED);
>
> +#ifdef SPARC_STACK_BOUNDARY_HACK
> /* Unbias the stack pointer, bringing it to the boundary between the
> stack area claimed by the active function calling this builtin,
> and stack ranges that could get clobbered if it called another
> @@ -5476,7 +5477,9 @@ expand_builtin_stack_address ()
> (caller) function's active area as well, whereas those pushed or
> allocated temporarily for a call are regarded as part of the
> callee's stack range, rather than the caller's. */
> - ret = plus_constant (ptr_mode, ret, STACK_POINTER_OFFSET);
> + if (SPARC_STACK_BOUNDARY_HACK)
> + ret = plus_constant (ptr_mode, ret, STACK_POINTER_OFFSET);
> +#endif
>
> return force_reg (ptr_mode, ret);
> }
> --
> 2.39.3
next prev parent reply other threads:[~2024-01-08 11:50 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 [this message]
2024-01-10 5:11 ` Kewen.Lin
2024-01-11 9:05 ` Alexandre Oliva
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='CAFiYyc3xnUb3V=6twTk-yj2aYEoPWZo3qp4bVEVNbkQbNqJB6Q@mail.gmail.com' \
--to=richard.guenther@gmail.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=oliva@adacore.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).