From ef4e541ac47fd032d30148fc61dfe48e94d5cd19 Mon Sep 17 00:00:00 2001 From: cyanpencil Date: Thu, 30 Nov 2023 23:02:45 +0100 Subject: [PATCH] fix executable stack on aarch64 kernels older than v5.8-rc1 --- librw_arm64/rw.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/librw_arm64/rw.py b/librw_arm64/rw.py index 600914ae..a0d99093 100644 --- a/librw_arm64/rw.py +++ b/librw_arm64/rw.py @@ -319,6 +319,9 @@ def dump(self): # we need one fake section just to represent the copy of the base address of the binary fd.write(f".section .fake.elf_header, \"a\", @progbits" + "\n") + # this makes sure the stack is not executable in kernels older than v5.8-rc1 + fd.write(f".section .note.GNU-stack, \"\", @progbits" + "\n") + # add weak symbols for symbol in self.container.symbols: if "@@" in symbol.name: continue