linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 0/2] arm64: Enable BTI for the executable as well as the interpreter
@ 2021-05-21 14:46 Mark Brown
  2021-05-21 14:46 ` [PATCH v1 1/2] elf: Allow architectures to parse properties on the main executable Mark Brown
  2021-05-21 14:46 ` [PATCH v1 2/2] arm64: Enable BTI for main executable as well as the interpreter Mark Brown
  0 siblings, 2 replies; 14+ messages in thread
From: Mark Brown @ 2021-05-21 14:46 UTC (permalink / raw)
  To: Catalin Marinas, Will Deacon
  Cc: Szabolcs Nagy, Jeremy Linton, Dave Martin, H . J . Lu,
	linux-arch, linux-arm-kernel, libc-alpha, Mark Brown

Deployments of BTI on arm64 have run into issues interacting with
systemd's MemoryDenyWriteExecute feature.  Currently for dynamically
linked executables the kernel will only handle architecture specific
properties like BTI for the interpreter, the expectation is that the
interpreter will then handle any properties on the main executable.
For BTI this means remapping the executable segments PROT_EXEC |
PROT_BTI.

This interacts poorly with MemoryDenyWriteExecute since that is
implemented using a seccomp filter which prevents setting PROT_EXEC on
already mapped memory and lacks the context to be able to detect that
memory is already mapped with PROT_EXEC.  This series resolves this by
handling the BTI property for both the interpreter and the main
executable.

This does mean that we may get more code with BTI enabled if running on
a system without BTI support in the dynamic linker, this is expected to
be a safe configuration and testing seems to confirm that. It also
reduces the flexibility userspace has to disable BTI but it is expected
that for cases where there are problems which require BTI to be disabled
it is more likely that it will need to be disabled on a system level.

Mark Brown (2):
  elf: Allow architectures to parse properties on the main executable
  arm64: Enable BTI for main executable as well as the interpreter

 arch/arm64/include/asm/elf.h | 13 ++++++++++---
 arch/arm64/kernel/process.c  | 18 ++++++------------
 fs/binfmt_elf.c              | 25 +++++++++++++++++--------
 include/linux/elf.h          |  4 +++-
 4 files changed, 36 insertions(+), 24 deletions(-)


base-commit: d07f6ca923ea0927a1024dfccafc5b53b61cfecc
-- 
2.20.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2021-06-10 10:38 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-21 14:46 [PATCH v1 0/2] arm64: Enable BTI for the executable as well as the interpreter Mark Brown
2021-05-21 14:46 ` [PATCH v1 1/2] elf: Allow architectures to parse properties on the main executable Mark Brown
2021-06-03 15:40   ` Dave Martin
2021-06-03 18:52     ` Mark Brown
2021-05-21 14:46 ` [PATCH v1 2/2] arm64: Enable BTI for main executable as well as the interpreter Mark Brown
2021-06-03 15:40   ` Dave Martin
2021-06-03 16:51     ` Mark Brown
2021-06-03 18:04       ` Catalin Marinas
2021-06-07 11:25         ` Dave Martin
2021-06-07 18:12           ` Catalin Marinas
2021-06-08 11:33             ` Mark Brown
2021-06-08 15:19               ` Dave Martin
2021-06-08 15:42                 ` Jeremy Linton
2021-06-10 10:33                   ` Dave Martin

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 NNTP newsgroup(s).