public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Matthew Malcomson <matthew.malcomson@arm.com>
To: Kyrylo Tkachov <Kyrylo.Tkachov@arm.com>,
	"gcc-patches@gcc.gnu.org" <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
Date: Fri, 24 Jul 2020 17:02:32 +0100	[thread overview]
Message-ID: <b5b006d6-67ed-7932-8ef4-617aa6d2db57@arm.com> (raw)
In-Reply-To: <DB7PR08MB3002511A0512D701E0B0C0BA93770@DB7PR08MB3002.eurprd08.prod.outlook.com>

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.




--- 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"

  reply	other threads:[~2020-07-24 16:02 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-21 15:15 Matthew Malcomson
2020-07-21 15:15 ` aarch64: (GCC-9 Backport) Mitigate SLS for BLR instruction Matthew Malcomson
2020-07-21 15:15 ` aarch64: (GCC-9 Backport) Introduce SLS mitigation for RET and BR instructions Matthew Malcomson
2020-07-21 15:15 ` aarch64: (GCC-9 Backport) New Straight Line Speculation (SLS) mitigation flags Matthew Malcomson
2020-07-24 11:01 ` SLS Mitigation patches backported for GCC9 Kyrylo Tkachov
2020-07-24 16:02   ` Matthew Malcomson [this message]
2020-08-04  8:33     ` Kyrylo Tkachov
2020-11-12 18:34       ` Sebastian Pop

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=b5b006d6-67ed-7932-8ef4-617aa6d2db57@arm.com \
    --to=matthew.malcomson@arm.com \
    --cc=Kyrylo.Tkachov@arm.com \
    --cc=Richard.Earnshaw@arm.com \
    --cc=Ross.Burton@arm.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=richard.sandiford@arm.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).