[PATCH] purgatory: force PIC/PIE/SSP off

Mike Frysinger vapier at gentoo.org
Wed Apr 15 22:15:04 PDT 2015


From: Mike Frysinger <vapier at chromium.org>

If the toolchain has these things turned on automatically, then the
purgatory code might be miscompiled leading to runtime errors like:
Unhandled rela relocation: R_X86_64_GOTPC64

It might look like the problem is with the kernel when in reality,
kexec is complaining about the purgatory module.  Force off harden
features that don't make sense in kernel space.

Signed-off-by: Mike Frysinger <vapier at chromium.org>
---
 purgatory/Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/purgatory/Makefile b/purgatory/Makefile
index 2d6b2c0..2b5c061 100644
--- a/purgatory/Makefile
+++ b/purgatory/Makefile
@@ -49,7 +49,8 @@ $(PURGATORY): CC=$(TARGET_CC)
 $(PURGATORY): CFLAGS+=$(PURGATORY_EXTRA_CFLAGS) \
 		      $($(ARCH)_PURGATORY_EXTRA_CFLAGS) \
 		      -Os -fno-builtin -ffreestanding \
-		      -fno-zero-initialized-in-bss
+		      -fno-zero-initialized-in-bss \
+		      -fno-PIC -fno-PIE -fno-stack-protector
 
 $(PURGATORY): CPPFLAGS=$($(ARCH)_PURGATORY_EXTRA_CFLAGS) \
 			-I$(srcdir)/purgatory/include \
-- 
2.3.5




More information about the kexec mailing list