]> gcc.gnu.org Git - gcc.git/commit
rs6000: ROP - Emit hashst and hashchk insns on Power8 and later [PR114759]
authorPeter Bergner <bergner@linux.ibm.com>
Wed, 19 Jun 2024 21:07:29 +0000 (16:07 -0500)
committerPeter Bergner <bergner@linux.ibm.com>
Wed, 24 Jul 2024 01:28:24 +0000 (20:28 -0500)
commitaa293f40770bae5e94f33d4700f2f0ce9eff712b
treef0bb6dd164ee657c41ef2fa383d91d8c3996f6b7
parent60e513cd47aadd8f139079f8388b14930e6e0913
rs6000: ROP - Emit hashst and hashchk insns on Power8 and later [PR114759]

We currently only emit the ROP-protect hash* insns for Power10, where the
insns were added to the architecture.  We want to emit them for earlier
cpus (where they operate as NOPs), so that if those older binaries are
ever executed on a Power10, then they'll be protected from ROP attacks.
Binutils accepts hashst and hashchk back to Power8, so change GCC to emit
them for Power8 and later.  This matches clang's behavior.

2024-06-19  Peter Bergner  <bergner@linux.ibm.com>

gcc/
PR target/114759
* config/rs6000/rs6000-logue.cc (rs6000_stack_info): Use TARGET_POWER8.
(rs6000_emit_prologue): Likewise.
* config/rs6000/rs6000.md (hashchk): Likewise.
(hashst): Likewise.
Fix whitespace.

gcc/testsuite/
PR target/114759
* gcc.target/powerpc/pr114759-2.c: New test.
* lib/target-supports.exp (rop_ok): Use
check_effective_target_has_arch_pwr8.

(cherry picked from commit a05c3d23d1e1c8d2971b123804fc7a61a3561adb)
gcc/config/rs6000/rs6000-logue.cc
gcc/config/rs6000/rs6000.md
gcc/testsuite/gcc.target/powerpc/pr114759-2.c [new file with mode: 0644]
gcc/testsuite/lib/target-supports.exp
This page took 0.054374 seconds and 6 git commands to generate.