Skip to contentSkip to conversation

xen/efi: Explicitly set NX_COMPAT on xen.efi

PATCH In review Andrew Cooper 2 participants 3 messages Nov 25

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen/efi: Explicitly set NX_COMPAT on xen.efi

Binutils since 2.45 no longer set NX_COMPAT. Programs have to ask for it explicitly.

Xen is NX_COMPAT-able; Xen does not execute from it's stack at all. The property is mandated by the Microsoft UEFI signing requirements.

The --nxcompat option is available since binutils 2.20 and llvm 6, so can be used unconditionally given our toolchain baseline.

---
CC: Jan Beulich <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Teddy Astie <[email protected]>
CC: Ross Lagerwall <[email protected]>

Backporting notes: 4.20 and earlier need this turning into an $(ld-option).

---
 xen/arch/x86/Makefile | 1 +
 1 file changed, 1 insertion(+)
xen/arch/x86/Makefile +1 -0
index 2be90ea09880..320593a1e824 100644
@@ -131,6 +131,7 @@ EFI_LDFLAGS += --major-image-version=$(XEN_VERSION)
 EFI_LDFLAGS += --minor-image-version=$(XEN_SUBVERSION)
 EFI_LDFLAGS += --major-os-version=2 --minor-os-version=0
 EFI_LDFLAGS += --major-subsystem-version=2 --minor-subsystem-version=0
+EFI_LDFLAGS += --nxcompat
 # It seems ld unfortunately can't set a custom timestamp, so add a zero value
 # for the timestamp (option --no-insert-timestamp) if SOURCE_DATE_EPOCH is
 # defined to make reproducible builds possible.

base-commit: 56e231174e1050a43cf199411d5b8a041f5625c6

Signature · 1 line
2.39.5
Reviewed-by on v1 1/1
#1 lore raw
Quoted 1 line · Andrew Cooper

Binutils since 2.45 no longer set NX_COMPAT.

For completeness - ld prior to 2.36 doesn't either.

Quoted 9 lines

Programs have to ask for it explicitly.

Xen is NX_COMPAT-able; Xen does not execute from it's stack at all. The property is mandated by the Microsoft UEFI signing requirements.

The --nxcompat option is available since binutils 2.20 and llvm 6, so can be used unconditionally given our toolchain baseline.

#2 lore raw
Quoted 3 lines · Jan Beulich
Quoted 1 line · Andrew Cooper

Binutils since 2.45 no longer set NX_COMPAT.

For completeness - ld prior to 2.36 doesn't either.

Oh, does it not?  In which case I'll adjust the sentence to this:

Binutils between 2.36 and 2.44 set NX_COMPAT by default.  Outside of this range, programs have to ask for it explicitly.

Quoted 11 lines
Quoted 10 lines

Programs have to ask for it explicitly.

Xen is NX_COMPAT-able; Xen does not execute from it's stack at all. The property is mandated by the Microsoft UEFI signing requirements.

The --nxcompat option is available since binutils 2.20 and llvm 6, so can be used unconditionally given our toolchain baseline.

Thanks.

~Andrew