From: Mike Frysinger <vapier@gentoo.org>
authorRyan C. Gordon <icculus@icculus.org>
Mon, 12 Dec 2005 09:13:12 +0000
changeset 11992d6dc7de1145
parent 1198 b616ac4f39d1
child 1200 8f418dce02b2
From: Mike Frysinger <vapier@gentoo.org>
To: sdl@libsdl.org
Date: Sun, 11 Dec 2005 22:57:37 -0500
Subject: [SDL] exec stack in libsdl update

i posted back in September a patch to remove executable stacks:
http://www.devolution.com/pipermail/sdl/2005-September/070626.html

later in November, a similar patch was merged it seems:
http://www.libsdl.org/cgi/cvsweb.cgi/SDL12/src/hermes/mmx_main.asm

however, this lacks the additional output format checks that i posted in my
patch ... this isnt a problem if the hermes asm code is only ever used to
produce ELF objects, but if this is not true, then the additional checks in
my original patch will need to be merged
-mike
src/hermes/mmx_main.asm
src/hermes/mmxp2_32.asm
src/hermes/x86_main.asm
src/hermes/x86p_16.asm
src/hermes/x86p_32.asm
     1.1 --- a/src/hermes/mmx_main.asm	Thu Dec 08 14:48:21 2005 +0000
     1.2 +++ b/src/hermes/mmx_main.asm	Mon Dec 12 09:13:12 2005 +0000
     1.3 @@ -12,8 +12,6 @@
     1.4  GLOBAL _ConvertMMX
     1.5  GLOBAL _mmxreturn
     1.6  
     1.7 -
     1.8 -SECTION .note.GNU-stack noalloc progbits noexec nowrite
     1.9  SECTION .text
    1.10  		
    1.11  ;; _ConvertMMX:	 
    1.12 @@ -71,5 +69,6 @@
    1.13  	
    1.14  	ret		
    1.15  
    1.16 -
    1.17 -
    1.18 +%ifidn __OUTPUT_FORMAT__,elf
    1.19 +section .note.GNU-stack noalloc noexec nowrite progbits
    1.20 +%endif
     2.1 --- a/src/hermes/mmxp2_32.asm	Thu Dec 08 14:48:21 2005 +0000
     2.2 +++ b/src/hermes/mmxp2_32.asm	Mon Dec 12 09:13:12 2005 +0000
     2.3 @@ -29,7 +29,6 @@
     2.4  
     2.5  EXTERN _mmxreturn
     2.6   
     2.7 -SECTION .note.GNU-stack noalloc progbits noexec nowrite
     2.8  SECTION .data
     2.9  	
    2.10  ALIGN 8
    2.11 @@ -383,5 +382,6 @@
    2.12  .L4:		
    2.13  	jmp _mmxreturn
    2.14  
    2.15 -
    2.16 -
    2.17 +%ifidn __OUTPUT_FORMAT__,elf
    2.18 +section .note.GNU-stack noalloc noexec nowrite progbits
    2.19 +%endif
     3.1 --- a/src/hermes/x86_main.asm	Thu Dec 08 14:48:21 2005 +0000
     3.2 +++ b/src/hermes/x86_main.asm	Mon Dec 12 09:13:12 2005 +0000
     3.3 @@ -16,7 +16,6 @@
     3.4  	
     3.5  GLOBAL _Hermes_X86_CPU
     3.6  
     3.7 -SECTION .note.GNU-stack noalloc progbits noexec nowrite
     3.8  SECTION .data
     3.9  	
    3.10  cpu_flags dd 0
    3.11 @@ -123,3 +122,7 @@
    3.12  
    3.13  .L1:	
    3.14  	ret
    3.15 +
    3.16 +%ifidn __OUTPUT_FORMAT__,elf
    3.17 +section .note.GNU-stack noalloc noexec nowrite progbits
    3.18 +%endif
     4.1 --- a/src/hermes/x86p_16.asm	Thu Dec 08 14:48:21 2005 +0000
     4.2 +++ b/src/hermes/x86p_16.asm	Mon Dec 12 09:13:12 2005 +0000
     4.3 @@ -27,11 +27,8 @@
     4.4  EXTERN _ConvertX86
     4.5  EXTERN _x86return
     4.6  
     4.7 -SECTION .note.GNU-stack noalloc progbits noexec nowrite
     4.8  SECTION .text
     4.9  
    4.10 -
    4.11 -
    4.12  _ConvertX86p16_16BGR565:
    4.13  
    4.14      ; check short
    4.15 @@ -494,3 +491,6 @@
    4.16  .L7 pop ebp
    4.17      jmp _x86return
    4.18  
    4.19 +%ifidn __OUTPUT_FORMAT__,elf
    4.20 +section .note.GNU-stack noalloc noexec nowrite progbits
    4.21 +%endif
     5.1 --- a/src/hermes/x86p_32.asm	Thu Dec 08 14:48:21 2005 +0000
     5.2 +++ b/src/hermes/x86p_32.asm	Mon Dec 12 09:13:12 2005 +0000
     5.3 @@ -25,10 +25,8 @@
     5.4  
     5.5  EXTERN _x86return
     5.6  	
     5.7 -SECTION .note.GNU-stack noalloc progbits noexec nowrite
     5.8  SECTION .text
     5.9  
    5.10 -
    5.11  ;; _Convert_*
    5.12  ;; Paramters:	
    5.13  ;;   ESI = source 
    5.14 @@ -1042,3 +1040,7 @@
    5.15  	
    5.16  .L4:	
    5.17  	jmp _x86return
    5.18 +
    5.19 +%ifidn __OUTPUT_FORMAT__,elf
    5.20 +section .note.GNU-stack noalloc noexec nowrite progbits
    5.21 +%endif