x86: Put trampoline in separate .init.trampoline section
PATCH 1/1 x86: Put trampoline in separate .init.trampoline section
This change put the trampoline in a separate, not executable section. The trampoline contains a mix of code and data (data which is modified from C code during early start so must be writable). This is in preparation for W^X patch in order to satisfy UEFI CA memory mitigation requirements.
At the moment .init.text and .init.data in EFI mode are put together so they will be in the same final section as before this patch. Putting in a separate section (even in final executables) allows to easily disassembly that section.
Signed-off-by Frediano Ziglio <[email protected]>
---
Changes since last version:
- use completely separate section even on final executables (suggested by Jan Beulich).
--- xen/arch/x86/boot/head.S | 6 ++++-- xen/arch/x86/xen.lds.S | 5 +++++ 2 files changed, 9 insertions(+), 2 deletions(-)
xen/arch/x86/boot/head.S +4 -2
@@ -882,8 +882,10 @@ cmdline_parse_early: reloc: .incbin "reloc.bin" +#include "x86_64.S" + + .section .init.trampoline, "aw", @progbits + .align 4 ENTRY(trampoline_start) #include "trampoline.S" ENTRY(trampoline_end) - -#include "x86_64.S"
xen/arch/x86/xen.lds.S +5 -0
@@ -269,6 +269,11 @@ SECTIONS __ctors_end = .; } PHDR(text) + . = ALIGN(PAGE_SIZE); + DECL_SECTION(.init.trampoline) { + *(.init.trampoline) + } PHDR(text) + #ifndef EFI /* * With --orphan-sections=warn (or =error) we need to handle certain linker
Signature · 1 line
2.34.1