On 24/07/2020 12:01, Kyrylo Tkachov wrote:
Hi Matthew,

-----Original Message-----
From: Matthew Malcomson <matthew.malcom...@arm.com>
Sent: 21 July 2020 16:16
To: gcc-patches@gcc.gnu.org
Cc: Richard Earnshaw <richard.earns...@arm.com>; Kyrylo Tkachov
<kyrylo.tkac...@arm.com>; Ross Burton <ross.bur...@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 via email to