diff options
author | florian <florian@a5019735-40e9-0310-863c-91ae7b9d1cf9> | 2015-09-30 20:30:48 +0000 |
---|---|---|
committer | florian <florian@a5019735-40e9-0310-863c-91ae7b9d1cf9> | 2015-09-30 20:30:48 +0000 |
commit | 3f1d6138db68f2aa74c5d005c3333cbe94788c7b (patch) | |
tree | 914e3c9572599ab679a09a6f6ce036d1cc9b2848 /include | |
parent | cecfc6aef54fbacde4a1e2911a9c991a9635c09f (diff) | |
download | valgrind-3f1d6138db68f2aa74c5d005c3333cbe94788c7b.tar.gz |
Make sure no executable stack gets created.
Explanation by Matthias Schwarzott:
The linker will request an executable stack as soon as at least one
object file, that is linked in, wants an executable stack.
And the absence of the
.section .note.GNU-stack."",@progbits
is enough to tell the linker that an executable stack is needed.
So even an empty asm-file must at least contain this statement to not
force executable stacks on the whole executable.
* Define a helper macro MARK_STACK_NO_EXEC that disables the
executable stack.
* Instantiate this macro unconditionally at the end of each asm file.
Patch by Matthias Schwarzott <zzam@gentoo.org>.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15692 a5019735-40e9-0310-863c-91ae7b9d1cf9
Diffstat (limited to 'include')
-rw-r--r-- | include/pub_tool_basics_asm.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/include/pub_tool_basics_asm.h b/include/pub_tool_basics_asm.h index becf91844..d73c91e93 100644 --- a/include/pub_tool_basics_asm.h +++ b/include/pub_tool_basics_asm.h @@ -58,6 +58,20 @@ # error Unknown OS #endif +/* Let the linker know we don't need an executable stack. + The call to MARK_STACK_NO_EXEC should be put unconditionally + at the end of all asm source files. +*/ +#if defined(VGO_linux) +# if defined(VGA_arm) +# define MARK_STACK_NO_EXEC .section .note.GNU-stack,"",%progbits +# else +# define MARK_STACK_NO_EXEC .section .note.GNU-stack,"",@progbits +# endif +#else +# define MARK_STACK_NO_EXEC +#endif + #endif /* __PUB_TOOL_BASICS_ASM_H */ /*--------------------------------------------------------------------*/ |