make bins built with asm disable exec stack #98

Add the `section .note.GNU-stack` markers to .asm files built with nasm
to make sure the final executables do not have an executable stack.

This is described here:

https://wiki.gentoo.org/wiki/Hardened/GNU_stack_quickstart
This commit is contained in:
Rafael Kitover 2017-03-25 03:58:30 -07:00
parent f56794e8a3
commit 5d4ce82d54
2 changed files with 19 additions and 1 deletions

View File

@ -24,7 +24,15 @@
;%define FAR_POINTER
%ifidn __OUTPUT_FORMAT__,elf
section .note.GNU-stack noalloc noexec nowrite progbits
%endif
%ifidn __OUTPUT_FORMAT__,elf32
section .note.GNU-stack noalloc noexec nowrite progbits
%endif
%ifidn __OUTPUT_FORMAT__,elf64
section .note.GNU-stack noalloc noexec nowrite progbits
%endif
BITS 32
GLOBAL __2xSaILine

View File

@ -1,3 +1,13 @@
%ifidn __OUTPUT_FORMAT__,elf
section .note.GNU-stack noalloc noexec nowrite progbits
%endif
%ifidn __OUTPUT_FORMAT__,elf32
section .note.GNU-stack noalloc noexec nowrite progbits
%endif
%ifidn __OUTPUT_FORMAT__,elf64
section .note.GNU-stack noalloc noexec nowrite progbits
%endif
%ifdef __AMD64__
bits 64
%else