Skip to content

arm64: Enable BTI for the executable as well as the interpreter

Mark Brown linux-arch linux-arm-kernel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 11 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2elf: Allow architectures to parse properties on the main executablearch/arm64/include/asm/elf.h fs/binfmt_elf.c include/linux/elf.h+22 -102 replies
2/2arm64: Enable BTI for main executable as well as the interpreterarch/arm64/include/asm/elf.h arch/arm64/kernel/process.c+16 -169 replies

Reviews trailers per patch

1 of 2 patches has a Reviewed-by or Acked-by.

PatchDave Martin
1/2
2/2R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH v1 0/2] arm64: Enable BTI for the executable as well as the interpreter

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

Signature · 1 line
2.20.1