[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH v3] 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. As we need to have a writable section and as we can't have code and data together to satisfy W^X requirement we need to have a data section. However tools like objdump by default do not disassemble data sections. Forcing disassembly of data sections would result in a very large output and possibly crash of tools. Putting in a separate section allows to selectively disassemble that part of code using a command like objdump -m i386 -j .init.trampoline -d xen-syms Signed-off-by: Frediano Ziglio <frediano.ziglio@xxxxxxxxx> --- Changes since last version: - use completely separate section even on final executables (suggested by Jan Beulich). Changes since v1: - remove useless align. Changes since v2: - remove change to alignment; - improved commit message. --- xen/arch/x86/boot/head.S | 5 +++-- xen/arch/x86/xen.lds.S | 4 ++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S index 12bbb97f33..493286a9fb 100644 --- a/xen/arch/x86/boot/head.S +++ b/xen/arch/x86/boot/head.S @@ -882,8 +882,9 @@ cmdline_parse_early: reloc: .incbin "reloc.bin" +#include "x86_64.S" + + .section .init.trampoline, "aw", @progbits ENTRY(trampoline_start) #include "trampoline.S" ENTRY(trampoline_end) - -#include "x86_64.S" diff --git a/xen/arch/x86/xen.lds.S b/xen/arch/x86/xen.lds.S index d48de67cfd..22fb7d8458 100644 --- a/xen/arch/x86/xen.lds.S +++ b/xen/arch/x86/xen.lds.S @@ -269,6 +269,10 @@ SECTIONS __ctors_end = .; } PHDR(text) + DECL_SECTION(.init.trampoline) { + *(.init.trampoline) + } PHDR(text) + #ifndef EFI /* * With --orphan-sections=warn (or =error) we need to handle certain linker -- 2.34.1
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |