From: Taylor R Campbell Date: Sat, 17 Apr 2010 06:10:44 +0000 (-0400) Subject: Under Linux/ELF on i386 and x86-64, mark the stack nonexecutable. X-Git-Tag: 20100708-Gtk~69 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=a24dc2c558df3e3b67e15adf02e4fcc2e0c9ce9d;p=mit-scheme.git Under Linux/ELF on i386 and x86-64, mark the stack nonexecutable. This is apparently what a `.note.GNU-stack' section does. --- diff --git a/src/microcode/cmpauxmd/i386.m4 b/src/microcode/cmpauxmd/i386.m4 index d7024e7ce..c1c61e0d9 100644 --- a/src/microcode/cmpauxmd/i386.m4 +++ b/src/microcode/cmpauxmd/i386.m4 @@ -1164,6 +1164,12 @@ asm_fixnum_rsh_overflow_negative: IFDASM(`end') +# Mark the stack nonexecutable. If we ever put code (e.g., +# dynamic-extent closure entry points) on the stack, this would have +# to change. + +ifdef(`__linux__', `ifdef(`__ELF__', `.section .note.GNU-stack,"",%progbits')') + ### Edwin Variables: ### comment-column: 56 ### End: diff --git a/src/microcode/cmpauxmd/x86-64.m4 b/src/microcode/cmpauxmd/x86-64.m4 index ee9fae39d..5524b9a11 100644 --- a/src/microcode/cmpauxmd/x86-64.m4 +++ b/src/microcode/cmpauxmd/x86-64.m4 @@ -909,6 +909,12 @@ asm_fixnum_rsh_overflow_negative: IFDASM(`end') +# Mark the stack nonexecutable. If we ever put code (e.g., +# dynamic-extent closure entry points) on the stack, this would have +# to change. + +ifdef(`__linux__', `ifdef(`__ELF__', `.section .note.GNU-stack,"",%progbits')') + ### Edwin Variables: ### comment-column: 56 ### comment-start: "#" diff --git a/src/microcode/configure.ac b/src/microcode/configure.ac index 3f171d6e1..205b4e582 100644 --- a/src/microcode/configure.ac +++ b/src/microcode/configure.ac @@ -286,6 +286,7 @@ DO_GCC_TESTS=no GNU_LD=no case ${host_os} in linux-gnu) + M4_FLAGS="${M4_FLAGS} -P __linux__,1" DO_GCC_TESTS=yes GNU_LD=yes ;; @@ -387,6 +388,7 @@ if test "${DO_GCC_TESTS}" = yes; then [ AC_MSG_RESULT([yes]) M4_FLAGS="${M4_FLAGS} -P SUPPRESS_LEADING_UNDERSCORE,1" + M4_FLAGS="${M4_FLAGS} -P __ELF__,1" ], [AC_MSG_RESULT([no])]) fi