SLS Mitigation patches backported for GCC9

Sebastian Pop sebpop.gnu@gmail.com
Thu Nov 12 18:34:54 GMT 2020


Hi,

could the SLS Mitigation patches be back-ported to the gcc-8 branch?

https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=dc586a74922 aarch64:
Introduce SLS mitigation for RET and BR instructions
https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=20da13e395b aarch64:
New Straight Line Speculation (SLS) mitigation flags

Thanks,
Sebastian

On Tue, Aug 4, 2020 at 3:34 AM Kyrylo Tkachov <Kyrylo.Tkachov@arm.com> wrote:
>
> Hi Matthew,
>
> > -----Original Message-----
> > From: Matthew Malcomson <Matthew.Malcomson@arm.com>
> > Sent: 24 July 2020 17:03
> > To: Kyrylo Tkachov <Kyrylo.Tkachov@arm.com>; gcc-patches@gcc.gnu.org
> > Cc: Richard Earnshaw <Richard.Earnshaw@arm.com>; Ross Burton
> > <Ross.Burton@arm.com>; Richard Sandiford <Richard.Sandiford@arm.com>
> > Subject: Re: SLS Mitigation patches backported for GCC9
> >
> > On 24/07/2020 12:01, Kyrylo Tkachov wrote:
> > > Hi Matthew,
> > >
> > >> -----Original Message-----
> > >> From: Matthew Malcomson <Matthew.Malcomson@arm.com>
> > >> Sent: 21 July 2020 16:16
> > >> To: gcc-patches@gcc.gnu.org
> > >> Cc: Richard Earnshaw <Richard.Earnshaw@arm.com>; Kyrylo Tkachov
> > >> <Kyrylo.Tkachov@arm.com>; Ross Burton <Ross.Burton@arm.com>
> > >> Subject: SLS Mitigation patches backported for GCC9
> > >>
> > >> Hello,
> > >>
> > >> Eventually we will want to backport the SLS patches to older branches.
> > >>
> > >> When the GCC10 release is unfrozen we will work on getting the same
> > >> patches
> > >> already posted backported to that branch.  The patches already posted on
> > >> the
> > >> mailing list apply cleanly to the current releases/gcc-10 branch.
> > >>
> > >> I've heard interest in having the GCC 9 patches, so I'm posting the
> > modified
> > >> versions upstream sooner than otherwise.
> > >
> > > I'd say let's go ahead with the GCC 10 patches (assuming testing works out
> > well on there).
> > > For the GCC 9 patches it would be useful if you included a bit of text of how
> > they differ from the GCC 10/11 patches.
> > > This would speed up the technical review.
> > > Thanks,
> > > Kyrill
> > >
> > >>
> > >> Cheers,
> > >> Matthew
> > >>
> > >> Entire patch series attached to cover letter.
> >
> > Below were the only two "interesting" hunks that failed to apply after
> > `patch -p1`.
> >
> > The differences causing these were:
> > - in GCC-9 the `retab` instruction wasn't in the "do_return" pattern.
> > - `simple_return` had "aarch64_use_simple_return_insn_p ()" as a
> >     condition.
> >
> >
>
> Thanks, the backports to GCC 10 and GCC 9 are okay, let's go ahead with them.
> Kyrill
>
> >
> >
> > --- gcc/config/aarch64/aarch64.md
> > +++ gcc/config/aarch64/aarch64.md
> > @@ -863,18 +882,23 @@
> >     [(return)]
> >     ""
> >     {
> > +    const char *ret = NULL;
> >       if (aarch64_return_address_signing_enabled ()
> >          && TARGET_ARMV8_3
> >          && !crtl->calls_eh_return)
> >         {
> >          if (aarch64_ra_sign_key == AARCH64_KEY_B)
> > -         return "retab";
> > +         ret = "retab";
> >          else
> > -         return "retaa";
> > +         ret = "retaa";
> >         }
> > -    return "ret";
> > +    else
> > +      ret = "ret";
> > +    output_asm_insn (ret, operands);
> > +    return aarch64_sls_barrier (aarch64_harden_sls_retbr_p ());
> >     }
> > -  [(set_attr "type" "branch")]
> > +  [(set_attr "type" "branch")
> > +   (set_attr "sls_length" "retbr")]
> >   )
> >
> >   (define_expand "return"
> > @@ -886,8 +910,12 @@
> >   (define_insn "simple_return"
> >     [(simple_return)]
> >     ""
> > -  "ret"
> > -  [(set_attr "type" "branch")]
> > +  {
> > +    output_asm_insn ("ret", operands);
> > +    return aarch64_sls_barrier (aarch64_harden_sls_retbr_p ());
> > +  }
> > +  [(set_attr "type" "branch")
> > +   (set_attr "sls_length" "retbr")]
> >   )
> >
> >   (define_insn "*cb<optab><mode>1"


More information about the Gcc-patches mailing list