public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCHv2 0/4] ROP support
@ 2021-05-14  3:34 Bill Schmidt
  2021-05-14  3:34 ` [PATCH 1/4] rs6000: Add -mrop-protect and -mprivileged flags Bill Schmidt
                   ` (4 more replies)
  0 siblings, 5 replies; 20+ messages in thread
From: Bill Schmidt @ 2021-05-14  3:34 UTC (permalink / raw)
  To: gcc-patches; +Cc: segher, dje.gcc, Bill Schmidt

This is version 2 of the ROP support patch, addressing comments by
Will Schmidt and Segher Boessenkool.  I've attempted to implement
all of your excellent suggestions; otherwise the series is unchanged.
I decided to repost the whole series rather than just the patches
needing further approval, since all have changed.

Add POWER10 support for hashst[p] and hashchk[p] operations.  When
the -mrop-protect option is selected, any function that loads the link
register from memory before returning must have protection in the
prologue and epilogue to ensure the link register save location has
not been compromised.  If -mprivileged is also specified, the
protection instructions generated require supervisor privilege.

The patches are broken up into logical chunks:
 - Option handling
 - Instruction generation
 - Predefined macro handling
 - Test cases

Bootstrapped and tested on a POWER10 system with no regressions.
Tests on a kernel that enables user-space ROP mitigation were
successful.  Is this series ok for trunk?  I would also like to
later backport these patches to GCC for the 11.2 release.

Thanks!
Bill

Bill Schmidt (4):
  rs6000: Add -mrop-protect and -mprivileged flags
  rs6000: Emit ROP-mitigation instructions in prologue and epilogue
  rs6000: Conditionally define __ROP_PROTECT__
  rs6000: Add ROP tests

 gcc/config/rs6000/rs6000-c.c             |  3 +
 gcc/config/rs6000/rs6000-internal.h      |  2 +
 gcc/config/rs6000/rs6000-logue.c         | 74 +++++++++++++++++++++---
 gcc/config/rs6000/rs6000.c               |  4 ++
 gcc/config/rs6000/rs6000.md              | 47 +++++++++++++++
 gcc/config/rs6000/rs6000.opt             |  8 +++
 gcc/doc/invoke.texi                      | 20 ++++++-
 gcc/testsuite/gcc.target/powerpc/rop-1.c | 17 ++++++
 gcc/testsuite/gcc.target/powerpc/rop-2.c | 17 ++++++
 gcc/testsuite/gcc.target/powerpc/rop-3.c | 18 ++++++
 gcc/testsuite/gcc.target/powerpc/rop-4.c | 15 +++++
 gcc/testsuite/gcc.target/powerpc/rop-5.c | 13 +++++
 12 files changed, 229 insertions(+), 9 deletions(-)
 create mode 100644 gcc/testsuite/gcc.target/powerpc/rop-1.c
 create mode 100644 gcc/testsuite/gcc.target/powerpc/rop-2.c
 create mode 100644 gcc/testsuite/gcc.target/powerpc/rop-3.c
 create mode 100644 gcc/testsuite/gcc.target/powerpc/rop-4.c
 create mode 100644 gcc/testsuite/gcc.target/powerpc/rop-5.c

-- 
2.27.0


^ permalink raw reply	[flat|nested] 20+ messages in thread
* [PATCH 0/4] [rs6000] ROP support
@ 2021-04-26  1:50 Bill Schmidt
  2021-04-26  1:50 ` [PATCH 1/4] rs6000: Add -mrop-protect and -mprivileged flags Bill Schmidt
  0 siblings, 1 reply; 20+ messages in thread
From: Bill Schmidt @ 2021-04-26  1:50 UTC (permalink / raw)
  To: gcc-patches; +Cc: segher, dje.gcc

Add POWER10 support for hashst[p] and hashchk[p] operations.  When
the -mrop-protect option is selected, any function that loads the link
register from memory before returning must have protection in the
prologue and epilogue to ensure the link register save location has
not been compromised.  If -mprivileged is also specified, the
protection instructions generated require supervisor privilege.

The patches are broken up into logical chunks:
 - Option handling
 - Instruction generation
 - Predefined macro handling
 - Test cases

Bootstrapped and tested on a POWER10 system with no regressions.
Tests on a kernel that enables user-space ROP mitigation were
successful.  Is this series ok for trunk?  I would also like to later
backport these patches to GCC for the 11.2 release.

Thanks!
Bill

Bill Schmidt (4):
  rs6000: Add -mrop-protect and -mprivileged flags
  rs6000: Emit ROP-protect instructions in prologue and epilogue
  rs6000: Conditionally define __ROP_PROTECT__
  rs6000: Add ROP tests

 gcc/config/rs6000/rs6000-c.c             |  3 +
 gcc/config/rs6000/rs6000-internal.h      |  2 +
 gcc/config/rs6000/rs6000-logue.c         | 86 +++++++++++++++++++++---
 gcc/config/rs6000/rs6000.c               |  7 ++
 gcc/config/rs6000/rs6000.md              | 39 +++++++++++
 gcc/config/rs6000/rs6000.opt             |  6 ++
 gcc/doc/invoke.texi                      | 19 +++++-
 gcc/testsuite/gcc.target/powerpc/rop-1.c | 16 +++++
 gcc/testsuite/gcc.target/powerpc/rop-2.c | 16 +++++
 gcc/testsuite/gcc.target/powerpc/rop-3.c | 19 ++++++
 gcc/testsuite/gcc.target/powerpc/rop-4.c | 14 ++++
 gcc/testsuite/gcc.target/powerpc/rop-5.c | 17 +++++
 12 files changed, 231 insertions(+), 13 deletions(-)
 create mode 100644 gcc/testsuite/gcc.target/powerpc/rop-1.c
 create mode 100644 gcc/testsuite/gcc.target/powerpc/rop-2.c
 create mode 100644 gcc/testsuite/gcc.target/powerpc/rop-3.c
 create mode 100644 gcc/testsuite/gcc.target/powerpc/rop-4.c
 create mode 100644 gcc/testsuite/gcc.target/powerpc/rop-5.c

-- 
2.27.0


^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2021-05-15 19:06 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-14  3:34 [PATCHv2 0/4] ROP support Bill Schmidt
2021-05-14  3:34 ` [PATCH 1/4] rs6000: Add -mrop-protect and -mprivileged flags Bill Schmidt
2021-05-14 14:18   ` Bill Schmidt
2021-05-14 15:55   ` Segher Boessenkool
2021-05-15 19:06     ` Bill Schmidt
2021-05-14  3:34 ` [PATCH 2/4] rs6000: Emit ROP-mitigation instructions in prologue and epilogue Bill Schmidt
2021-05-14 14:18   ` Bill Schmidt
2021-05-14 18:44   ` Segher Boessenkool
2021-05-14 19:10     ` Bill Schmidt
2021-05-14  3:34 ` [PATCH 3/4] rs6000: Conditionally define __ROP_PROTECT__ Bill Schmidt
2021-05-14 14:18   ` Bill Schmidt
2021-05-14 18:51   ` Segher Boessenkool
2021-05-14  3:34 ` [PATCH 4/4] rs6000: Add ROP tests Bill Schmidt
2021-05-14 14:18   ` Bill Schmidt
2021-05-14 19:36   ` Segher Boessenkool
2021-05-14 14:18 ` [PATCHv2 0/4] ROP support Bill Schmidt
  -- strict thread matches above, loose matches on Subject: below --
2021-04-26  1:50 [PATCH 0/4] [rs6000] " Bill Schmidt
2021-04-26  1:50 ` [PATCH 1/4] rs6000: Add -mrop-protect and -mprivileged flags Bill Schmidt
2021-04-26 16:02   ` will schmidt
2021-05-12 20:40     ` Segher Boessenkool
2021-05-12 20:26   ` Segher Boessenkool

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).