[CRIU] [PATCH] make: Disable stack executable bit

Cyrill Gorcunov gorcunov at openvz.org
Fri Jul 20 08:04:56 EDT 2012


Otherwise crtools built with stack executable, in result
kernel sets up

	current->personality |= READ_IMPLIES_EXEC;

when our crtools get loaded into memory and mmap
calls in restorer create VMAs with EXEC bit set.

Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 Makefile.pie     |    2 +-
 Makefile.syscall |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/Makefile.pie b/Makefile.pie
index d349425..6f6a3d4 100644
--- a/Makefile.pie
+++ b/Makefile.pie
@@ -24,7 +24,7 @@ DEPS		+= $(patsubst %.o,%.d,$(POBJS))
 DEPS		+= $(patsubst %.o,%.d,$(ROBJS))
 
 PIELDS		:= pie.lds.S
-PIEFLAGS	:= -fpie
+PIEFLAGS	:= -fpie  -Wa,--noexecstack
 ASMFLAGS	:= -D__ASSEMBLY__
 
 $(PASM-OBJS): $(PASM-SRC) $(SYS-OBJ)
diff --git a/Makefile.syscall b/Makefile.syscall
index d307ebd..29e61a7 100644
--- a/Makefile.syscall
+++ b/Makefile.syscall
@@ -10,7 +10,7 @@ SYS-GEN		:= syscalls-x86-64.sh
 
 SYS-OBJ		:= $(patsubst %.S,%.o,$(SYS-ASM))
 
-SYS-FLAGS	:= -fpie -Wstrict-prototypes -D__ASSEMBLY__ -nostdlib -fomit-frame-pointer
+SYS-FLAGS	:= -fpie -Wstrict-prototypes -Wa,--noexecstack -D__ASSEMBLY__ -nostdlib -fomit-frame-pointer
 
 $(SYS-ASM): $(SYS-GEN) $(SYS-DEF) $(SYS-ASM-COMMON) $(SYS-TYPES)
 	$(E) "  GEN     " $@
-- 
1.7.7.6



More information about the CRIU mailing list