+ uml-fix-compilation-and-execution-with-hardened-gcc.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled

     uml: fix compilation and execution with hardened GCC

has been added to the -mm tree.  Its filename is

     uml-fix-compilation-and-execution-with-hardened-gcc.patch

See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find
out what to do about this


From: Paolo 'Blaisorblade' Giarrusso <blaisorblade@xxxxxxxx>

To make some half-assembly stubs compile, disable various "hardened" GCC
features:

*) we can't make it build PIC code as we need %ebx to do syscalls and GCC
   wants it free for PIC

*) we can't leave stack protection as the stub is moved (not relocated!) in
   memory so the RIP-relative access to the canary tries reading from an
   unmapped address and causes a segfault, since we move the stub of various
   megabytes (the exact amount will be decided at runtime) away from the
   link-time address.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@xxxxxxxx>
Cc: Jeff Dike <jdike@xxxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxx>
---

 arch/um/Makefile             |    6 +++++-
 arch/um/kernel/skas/Makefile |    9 ++++++++-
 arch/um/sys-i386/Makefile    |    2 ++
 arch/um/sys-x86_64/Makefile  |    2 ++
 4 files changed, 17 insertions(+), 2 deletions(-)

diff -puN arch/um/kernel/skas/Makefile~uml-fix-compilation-and-execution-with-hardened-gcc arch/um/kernel/skas/Makefile
--- devel/arch/um/kernel/skas/Makefile~uml-fix-compilation-and-execution-with-hardened-gcc	2006-04-30 13:23:20.000000000 -0700
+++ devel-akpm/arch/um/kernel/skas/Makefile	2006-04-30 13:23:20.000000000 -0700
@@ -11,4 +11,11 @@ USER_OBJS := clone.o
 include arch/um/scripts/Makefile.rules
 
 # clone.o is in the stub, so it can't be built with profiling
-$(obj)/clone.o : c_flags = -Wp,-MD,$(depfile) $(call unprofile,$(USER_CFLAGS))
+# GCC hardened also auto-enables -fpic, but we need %ebx so it can't work ->
+# disable it
+
+CFLAGS_clone.o := $(CFLAGS_NO_HARDENING)
+
+# since we're setting c_flags we _must_ add $(CFLAGS_$(*F).o).
+
+$(obj)/clone.o : c_flags = -Wp,-MD,$(depfile) $(call unprofile,$(USER_CFLAGS)) $(CFLAGS_$(*F).o)
diff -puN arch/um/Makefile~uml-fix-compilation-and-execution-with-hardened-gcc arch/um/Makefile
--- devel/arch/um/Makefile~uml-fix-compilation-and-execution-with-hardened-gcc	2006-04-30 13:23:20.000000000 -0700
+++ devel-akpm/arch/um/Makefile	2006-04-30 13:23:20.000000000 -0700
@@ -118,6 +118,10 @@ prepare: $(ARCH_DIR)/include/kern_consta
 LINK-$(CONFIG_LD_SCRIPT_STATIC) += -static
 LINK-$(CONFIG_LD_SCRIPT_DYN) += -Wl,-rpath,/lib
 
+CFLAGS_NO_HARDENING := $(call cc-option, -fno-PIC,) $(call cc-option, -fno-pic,) \
+	$(call cc-option, -fno-stack-protector,) \
+	$(call cc-option, -fno-stack-protector-all,)
+
 CPP_MODE-$(CONFIG_MODE_TT) := -DMODE_TT
 CONFIG_KERNEL_STACK_ORDER ?= 2
 STACK_SIZE := $(shell echo $$[ 4096 * (1 << $(CONFIG_KERNEL_STACK_ORDER)) ] )
@@ -227,4 +231,4 @@ $(ARCH_DIR)/include/kern_constants.h: $(
 	@echo '  SYMLINK $@'
 	$(Q)ln -sf ../../../include/asm-um/asm-offsets.h $@
 
-export SUBARCH USER_CFLAGS OS
+export SUBARCH USER_CFLAGS CFLAGS_NO_HARDENING OS
diff -puN arch/um/sys-i386/Makefile~uml-fix-compilation-and-execution-with-hardened-gcc arch/um/sys-i386/Makefile
--- devel/arch/um/sys-i386/Makefile~uml-fix-compilation-and-execution-with-hardened-gcc	2006-04-30 13:23:20.000000000 -0700
+++ devel-akpm/arch/um/sys-i386/Makefile	2006-04-30 13:23:20.000000000 -0700
@@ -13,6 +13,8 @@ USER_OBJS := bugs.o ptrace_user.o sigcon
 USER_OBJS += user-offsets.s
 extra-y += user-offsets.s
 
+CFLAGS_stub_segv.o := $(CFLAGS_NO_HARDENING)
+
 extra-$(CONFIG_MODE_TT) += unmap.o
 
 include arch/um/scripts/Makefile.rules
diff -puN arch/um/sys-x86_64/Makefile~uml-fix-compilation-and-execution-with-hardened-gcc arch/um/sys-x86_64/Makefile
--- devel/arch/um/sys-x86_64/Makefile~uml-fix-compilation-and-execution-with-hardened-gcc	2006-04-30 13:23:20.000000000 -0700
+++ devel-akpm/arch/um/sys-x86_64/Makefile	2006-04-30 13:23:20.000000000 -0700
@@ -21,6 +21,8 @@ USER_OBJS := ptrace_user.o sigcontext.o 
 USER_OBJS += user-offsets.s
 extra-y += user-offsets.s
 
+CFLAGS_stub_segv.o := $(CFLAGS_NO_HARDENING)
+
 extra-$(CONFIG_MODE_TT) += unmap.o
 
 include arch/um/scripts/Makefile.rules
_

Patches currently in -mm which might be from blaisorblade@xxxxxxxx are

uml-fix-iomem-list-traversal.patch
uml-skas0-support-for-2g-2g-hosts.patch
uml-remove-null-checks-and-add-some-codingstyle.patch
uml-clean-up-after-madvise_remove.patch
uml-update-defconfig.patch
uml-error-handling-fixes.patch
uml-fix-patch-mismerge.patch
uml-search-from-uml_net-in-a-more-reasonable-path.patch
uml-use-kbuild-tracking-for-all-files-and-fix-compilation-output.patch
uml-fix-compilation-and-execution-with-hardened-gcc.patch
uml-cleanup-unprofile-expression-and-build-infrastructure.patch
uml-export-symbols-added-by-gcc-hardened.patch
uml-make-copy__user-atomic.patch
uml-fix-not_dead_yet-when-directory-is-in-bad-state.patch
uml-rename-and-improve-actually_do_remove.patch

-
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux