mailing list of musl libc
 help / color / mirror / code / Atom feed
* noexecstack
@ 2012-08-05 21:35 Daniel Cegiełka
  2012-08-05 21:41 ` noexecstack Anthony G. Basile
                   ` (2 more replies)
  0 siblings, 3 replies; 19+ messages in thread
From: Daniel Cegiełka @ 2012-08-05 21:35 UTC (permalink / raw)
  To: musl

[-- Attachment #1: Type: text/plain, Size: 274 bytes --]

Vasily Kulikov published a patch for nonexecutable stack for glibc in Owl.

http://openwall.com/lists/owl-dev/2012/08/05/1
http://openwall.com/lists/owl-dev/2012/08/05/3

Should we support this in the musl?

The patch for musl asm files is attached...

best regards,
Daniel

[-- Attachment #2: musl_noexecstack.diff --]
[-- Type: application/octet-stream, Size: 56459 bytes --]

diff -urN musl.orig//crt/arm/crt1.s musl/crt/arm/crt1.s
--- musl.orig//crt/arm/crt1.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/crt/arm/crt1.s	2012-08-05 23:21:58.000000000 +0200
@@ -14,3 +14,6 @@
 	ldr a1,=main
 	bl __libc_start_main
 1:	b 1b
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//crt/arm/crti.s musl/crt/arm/crti.s
--- musl.orig//crt/arm/crti.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/crt/arm/crti.s	2012-08-05 23:21:58.000000000 +0200
@@ -7,3 +7,6 @@
 .global _fini
 _fini:
 	push {lr}
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//crt/arm/crtn.s musl/crt/arm/crtn.s
--- musl.orig//crt/arm/crtn.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/crt/arm/crtn.s	2012-08-05 23:21:58.000000000 +0200
@@ -9,3 +9,6 @@
 	tst lr,#1
 	moveq pc,lr
 	bx lr
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//crt/i386/crt1.s musl/crt/i386/crt1.s
--- musl.orig//crt/i386/crt1.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/crt/i386/crt1.s	2012-08-05 23:21:58.000000000 +0200
@@ -17,3 +17,6 @@
 	push $main
 	call __libc_start_main
 1:	jmp 1b
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//crt/i386/crti.s musl/crt/i386/crti.s
--- musl.orig//crt/i386/crti.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/crt/i386/crti.s	2012-08-05 23:21:58.000000000 +0200
@@ -5,3 +5,6 @@
 .section .fini
 .global _fini
 _fini:
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//crt/i386/crtn.s musl/crt/i386/crtn.s
--- musl.orig//crt/i386/crtn.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/crt/i386/crtn.s	2012-08-05 23:21:58.000000000 +0200
@@ -3,3 +3,6 @@
 
 .section .fini
 	ret
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//crt/i386/Scrt1.s musl/crt/i386/Scrt1.s
--- musl.orig//crt/i386/Scrt1.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/crt/i386/Scrt1.s	2012-08-05 23:21:58.000000000 +0200
@@ -22,3 +22,6 @@
 	push main@GOT(%ebx)
 	call __libc_start_main@plt
 1:	jmp 1b
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//crt/mips/crt1.s musl/crt/mips/crt1.s
--- musl.orig//crt/mips/crt1.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/crt/mips/crt1.s	2012-08-05 23:21:58.000000000 +0200
@@ -23,3 +23,6 @@
 	nop
 	b       .                        # Never gets here.
 	nop
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//crt/mips/crti.s musl/crt/mips/crti.s
--- musl.orig//crt/mips/crti.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/crt/mips/crti.s	2012-08-05 23:21:58.000000000 +0200
@@ -15,3 +15,6 @@
 	subu $sp,$sp,32
 	sw $gp,24($sp)
 	sw $ra,28($sp)
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//crt/mips/crtn.s musl/crt/mips/crtn.s
--- musl.orig//crt/mips/crtn.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/crt/mips/crtn.s	2012-08-05 23:21:58.000000000 +0200
@@ -11,3 +11,6 @@
 	lw $ra,28($sp)
 	j $ra
 	addu $sp,$sp,32
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//crt/x86_64/crt1.s musl/crt/x86_64/crt1.s
--- musl.orig//crt/x86_64/crt1.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/crt/x86_64/crt1.s	2012-08-05 23:21:58.000000000 +0200
@@ -14,3 +14,6 @@
 	mov $main,%rdi  /* 1st arg: application entry ip */
 	call __libc_start_main /* musl init will run the program */
 1:	jmp 1b
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//crt/x86_64/crti.s musl/crt/x86_64/crti.s
--- musl.orig//crt/x86_64/crti.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/crt/x86_64/crti.s	2012-08-05 23:21:58.000000000 +0200
@@ -5,3 +5,6 @@
 .section .fini
 .global _fini
 _fini:
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//crt/x86_64/crtn.s musl/crt/x86_64/crtn.s
--- musl.orig//crt/x86_64/crtn.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/crt/x86_64/crtn.s	2012-08-05 23:21:58.000000000 +0200
@@ -3,3 +3,6 @@
 
 .section .fini
 	ret
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//crt/x86_64/Scrt1.s musl/crt/x86_64/Scrt1.s
--- musl.orig//crt/x86_64/Scrt1.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/crt/x86_64/Scrt1.s	2012-08-05 23:21:58.000000000 +0200
@@ -14,3 +14,6 @@
 	mov main@GOTPCREL(%rip),%rdi  /* 1st arg: application entry ip */
 	call __libc_start_main@PLT    /* musl init will run the program */
 1:	jmp 1b
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/fenv/i386/fenv.s musl/src/fenv/i386/fenv.s
--- musl.orig//src/fenv/i386/fenv.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/fenv/i386/fenv.s	2012-08-05 23:21:58.000000000 +0200
@@ -88,3 +88,6 @@
 	fnstsw %ax
 	and %ecx,%eax
 	ret
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/fenv/x86_64/fenv.s musl/src/fenv/x86_64/fenv.s
--- musl.orig//src/fenv/x86_64/fenv.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/fenv/x86_64/fenv.s	2012-08-05 23:21:58.000000000 +0200
@@ -99,3 +99,6 @@
 	or %esi,%eax
 	and %edi,%eax
 	ret
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/internal/arm/syscall.s musl/src/internal/arm/syscall.s
--- musl.orig//src/internal/arm/syscall.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/internal/arm/syscall.s	2012-08-05 23:21:58.000000000 +0200
@@ -13,3 +13,6 @@
 	tst lr,#1
 	moveq pc,lr
 	bx lr
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/internal/i386/syscall.s musl/src/internal/i386/syscall.s
--- musl.orig//src/internal/i386/syscall.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/internal/i386/syscall.s	2012-08-05 23:21:58.000000000 +0200
@@ -18,3 +18,6 @@
 	popl %esi
 	popl %ebx
 	ret
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/internal/mips/syscall.s musl/src/internal/mips/syscall.s
--- musl.orig//src/internal/mips/syscall.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/internal/mips/syscall.s	2012-08-05 23:21:58.000000000 +0200
@@ -20,3 +20,6 @@
 	subu    $2, $0, $2
 1:	jr      $ra
 	nop
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/internal/x86_64/syscall.s musl/src/internal/x86_64/syscall.s
--- musl.orig//src/internal/x86_64/syscall.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/internal/x86_64/syscall.s	2012-08-05 23:21:58.000000000 +0200
@@ -10,3 +10,6 @@
 	movq 8(%rsp),%r9
 	syscall
 	ret
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/ldso/arm/dlsym.s musl/src/ldso/arm/dlsym.s
--- musl.orig//src/ldso/arm/dlsym.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/ldso/arm/dlsym.s	2012-08-05 23:21:58.000000000 +0200
@@ -4,3 +4,6 @@
 dlsym:
 	mov r2,lr
 	b __dlsym
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/ldso/arm/start.s musl/src/ldso/arm/start.s
--- musl.orig//src/ldso/arm/start.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/ldso/arm/start.s	2012-08-05 23:21:58.000000000 +0200
@@ -16,3 +16,6 @@
 	tst r1,#1
 	moveq pc,r1
 	bx r1
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/ldso/i386/dlsym.s musl/src/ldso/i386/dlsym.s
--- musl.orig//src/ldso/i386/dlsym.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/ldso/i386/dlsym.s	2012-08-05 23:21:58.000000000 +0200
@@ -8,3 +8,6 @@
 	call __dlsym
 	add $12,%esp
 	ret
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/ldso/i386/start.s musl/src/ldso/i386/start.s
--- musl.orig//src/ldso/i386/start.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/ldso/i386/start.s	2012-08-05 23:21:58.000000000 +0200
@@ -20,3 +20,6 @@
 	push %edi
 	xor %edx,%edx
 	jmp *%eax
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/ldso/mips/dlsym.s musl/src/ldso/mips/dlsym.s
--- musl.orig//src/ldso/mips/dlsym.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/ldso/mips/dlsym.s	2012-08-05 23:21:58.000000000 +0200
@@ -13,3 +13,6 @@
 	lw $ra, 12($sp)
 	jr $ra
 	addiu $sp, $sp, 16
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/ldso/mips/start.s musl/src/ldso/mips/start.s
--- musl.orig//src/ldso/mips/start.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/ldso/mips/start.s	2012-08-05 23:21:58.000000000 +0200
@@ -44,3 +44,6 @@
 	nop
 2:	sw $4, ($sp)
 	jr $2
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/ldso/x86_64/dlsym.s musl/src/ldso/x86_64/dlsym.s
--- musl.orig//src/ldso/x86_64/dlsym.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/ldso/x86_64/dlsym.s	2012-08-05 23:21:58.000000000 +0200
@@ -4,3 +4,6 @@
 dlsym:
 	mov (%rsp),%rdx
 	jmp __dlsym
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/ldso/x86_64/start.s musl/src/ldso/x86_64/start.s
--- musl.orig//src/ldso/x86_64/start.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/ldso/x86_64/start.s	2012-08-05 23:21:58.000000000 +0200
@@ -14,3 +14,6 @@
 	push %rdi
 	xor %edx,%edx
 	jmp *%rax
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/i386/acosf.s musl/src/math/i386/acosf.s
--- musl.orig//src/math/i386/acosf.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/i386/acosf.s	2012-08-05 23:21:58.000000000 +0200
@@ -1 +1,4 @@
 # see acos.s
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/i386/acosl.s musl/src/math/i386/acosl.s
--- musl.orig//src/math/i386/acosl.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/i386/acosl.s	2012-08-05 23:21:58.000000000 +0200
@@ -1 +1,4 @@
 # see acos.s
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/i386/acos.s musl/src/math/i386/acos.s
--- musl.orig//src/math/i386/acos.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/i386/acos.s	2012-08-05 23:21:58.000000000 +0200
@@ -26,3 +26,6 @@
 	fxch %st(1)
 	fpatan
 	ret
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/i386/asinf.s musl/src/math/i386/asinf.s
--- musl.orig//src/math/i386/asinf.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/i386/asinf.s	2012-08-05 23:21:58.000000000 +0200
@@ -1 +1,4 @@
 # see asin.s
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/i386/asinl.s musl/src/math/i386/asinl.s
--- musl.orig//src/math/i386/asinl.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/i386/asinl.s	2012-08-05 23:21:58.000000000 +0200
@@ -1 +1,4 @@
 # see asin.s
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/i386/asin.s musl/src/math/i386/asin.s
--- musl.orig//src/math/i386/asin.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/i386/asin.s	2012-08-05 23:21:58.000000000 +0200
@@ -22,3 +22,6 @@
 	fsqrt
 	fpatan
 	ret
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/i386/atan2f.s musl/src/math/i386/atan2f.s
--- musl.orig//src/math/i386/atan2f.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/i386/atan2f.s	2012-08-05 23:21:58.000000000 +0200
@@ -5,3 +5,6 @@
 	flds 8(%esp)
 	fpatan
 	ret
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/i386/atan2l.s musl/src/math/i386/atan2l.s
--- musl.orig//src/math/i386/atan2l.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/i386/atan2l.s	2012-08-05 23:21:58.000000000 +0200
@@ -5,3 +5,6 @@
 	fldt 16(%esp)
 	fpatan
 	ret
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/i386/atan2.s musl/src/math/i386/atan2.s
--- musl.orig//src/math/i386/atan2.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/i386/atan2.s	2012-08-05 23:21:58.000000000 +0200
@@ -5,3 +5,6 @@
 	fldl 12(%esp)
 	fpatan
 	ret
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/i386/atanf.s musl/src/math/i386/atanf.s
--- musl.orig//src/math/i386/atanf.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/i386/atanf.s	2012-08-05 23:21:58.000000000 +0200
@@ -5,3 +5,6 @@
 	fld1
 	fpatan
 	ret
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/i386/atanl.s musl/src/math/i386/atanl.s
--- musl.orig//src/math/i386/atanl.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/i386/atanl.s	2012-08-05 23:21:58.000000000 +0200
@@ -5,3 +5,6 @@
 	fld1
 	fpatan
 	ret
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/i386/atan.s musl/src/math/i386/atan.s
--- musl.orig//src/math/i386/atan.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/i386/atan.s	2012-08-05 23:21:58.000000000 +0200
@@ -5,3 +5,6 @@
 	fld1
 	fpatan
 	ret
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/i386/ceilf.s musl/src/math/i386/ceilf.s
--- musl.orig//src/math/i386/ceilf.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/i386/ceilf.s	2012-08-05 23:21:58.000000000 +0200
@@ -1 +1,4 @@
 # see floor.s
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/i386/ceill.s musl/src/math/i386/ceill.s
--- musl.orig//src/math/i386/ceill.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/i386/ceill.s	2012-08-05 23:21:58.000000000 +0200
@@ -1 +1,4 @@
 # see floor.s
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/i386/ceil.s musl/src/math/i386/ceil.s
--- musl.orig//src/math/i386/ceil.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/i386/ceil.s	2012-08-05 23:21:58.000000000 +0200
@@ -1 +1,4 @@
 # see floor.s
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/i386/exp2f.s musl/src/math/i386/exp2f.s
--- musl.orig//src/math/i386/exp2f.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/i386/exp2f.s	2012-08-05 23:21:58.000000000 +0200
@@ -1 +1,4 @@
 # see exp.s
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/i386/exp2l.s musl/src/math/i386/exp2l.s
--- musl.orig//src/math/i386/exp2l.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/i386/exp2l.s	2012-08-05 23:21:58.000000000 +0200
@@ -1 +1,4 @@
 # see exp.s
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/i386/exp2.s musl/src/math/i386/exp2.s
--- musl.orig//src/math/i386/exp2.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/i386/exp2.s	2012-08-05 23:21:58.000000000 +0200
@@ -1 +1,4 @@
 # see exp.s
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/i386/expf.s musl/src/math/i386/expf.s
--- musl.orig//src/math/i386/expf.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/i386/expf.s	2012-08-05 23:21:58.000000000 +0200
@@ -1 +1,4 @@
 # see exp.s
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/i386/expl.s musl/src/math/i386/expl.s
--- musl.orig//src/math/i386/expl.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/i386/expl.s	2012-08-05 23:21:58.000000000 +0200
@@ -1 +1,4 @@
 # see exp.s
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/i386/expm1f.s musl/src/math/i386/expm1f.s
--- musl.orig//src/math/i386/expm1f.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/i386/expm1f.s	2012-08-05 23:21:58.000000000 +0200
@@ -1 +1,4 @@
 # see expm1.s
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/i386/expm1l.s musl/src/math/i386/expm1l.s
--- musl.orig//src/math/i386/expm1l.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/i386/expm1l.s	2012-08-05 23:21:58.000000000 +0200
@@ -1 +1,4 @@
 # see expm1.s
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/i386/expm1.s musl/src/math/i386/expm1.s
--- musl.orig//src/math/i386/expm1.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/i386/expm1.s	2012-08-05 23:21:58.000000000 +0200
@@ -1 +1,4 @@
 # see exp.s
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/i386/exp.s musl/src/math/i386/exp.s
--- musl.orig//src/math/i386/exp.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/i386/exp.s	2012-08-05 23:21:58.000000000 +0200
@@ -117,3 +117,6 @@
 	fstp %st(1)
 	add $12,%esp
 	ret
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/i386/fabsf.s musl/src/math/i386/fabsf.s
--- musl.orig//src/math/i386/fabsf.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/i386/fabsf.s	2012-08-05 23:21:58.000000000 +0200
@@ -4,3 +4,6 @@
 	flds 4(%esp)
 	fabs
 	ret
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/i386/fabsl.s musl/src/math/i386/fabsl.s
--- musl.orig//src/math/i386/fabsl.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/i386/fabsl.s	2012-08-05 23:21:58.000000000 +0200
@@ -4,3 +4,6 @@
 	fldt 4(%esp)
 	fabs
 	ret
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/i386/fabs.s musl/src/math/i386/fabs.s
--- musl.orig//src/math/i386/fabs.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/i386/fabs.s	2012-08-05 23:21:58.000000000 +0200
@@ -4,3 +4,6 @@
 	fldl 4(%esp)
 	fabs
 	ret
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/i386/floorf.s musl/src/math/i386/floorf.s
--- musl.orig//src/math/i386/floorf.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/i386/floorf.s	2012-08-05 23:21:58.000000000 +0200
@@ -1 +1,4 @@
 # see floor.s
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/i386/floorl.s musl/src/math/i386/floorl.s
--- musl.orig//src/math/i386/floorl.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/i386/floorl.s	2012-08-05 23:21:58.000000000 +0200
@@ -1 +1,4 @@
 # see floor.s
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/i386/floor.s musl/src/math/i386/floor.s
--- musl.orig//src/math/i386/floor.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/i386/floor.s	2012-08-05 23:21:58.000000000 +0200
@@ -65,3 +65,6 @@
 	fldt 4(%esp)
 	mov $0xf,%al
 	jmp 1b
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/i386/fmodf.s musl/src/math/i386/fmodf.s
--- musl.orig//src/math/i386/fmodf.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/i386/fmodf.s	2012-08-05 23:21:58.000000000 +0200
@@ -9,3 +9,6 @@
 	jp 1b
 	fstp %st(1)
 	ret
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/i386/fmodl.s musl/src/math/i386/fmodl.s
--- musl.orig//src/math/i386/fmodl.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/i386/fmodl.s	2012-08-05 23:21:58.000000000 +0200
@@ -9,3 +9,6 @@
 	jp 1b
 	fstp %st(1)
 	ret
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/i386/fmod.s musl/src/math/i386/fmod.s
--- musl.orig//src/math/i386/fmod.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/i386/fmod.s	2012-08-05 23:21:58.000000000 +0200
@@ -9,3 +9,6 @@
 	jp 1b
 	fstp %st(1)
 	ret
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/i386/hypotf.s musl/src/math/i386/hypotf.s
--- musl.orig//src/math/i386/hypotf.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/i386/hypotf.s	2012-08-05 23:21:58.000000000 +0200
@@ -40,3 +40,6 @@
 	jnz 1f
 	fabs
 1:	ret
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/i386/hypot.s musl/src/math/i386/hypot.s
--- musl.orig//src/math/i386/hypot.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/i386/hypot.s	2012-08-05 23:21:58.000000000 +0200
@@ -43,3 +43,6 @@
 	jnz 1f
 	fabs
 1:	ret
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/i386/ldexpf.s musl/src/math/i386/ldexpf.s
--- musl.orig//src/math/i386/ldexpf.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/i386/ldexpf.s	2012-08-05 23:21:58.000000000 +0200
@@ -1 +1,4 @@
 # see scalbnf.s
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/i386/ldexpl.s musl/src/math/i386/ldexpl.s
--- musl.orig//src/math/i386/ldexpl.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/i386/ldexpl.s	2012-08-05 23:21:58.000000000 +0200
@@ -1 +1,4 @@
 # see scalbnl.s
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/i386/ldexp.s musl/src/math/i386/ldexp.s
--- musl.orig//src/math/i386/ldexp.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/i386/ldexp.s	2012-08-05 23:21:58.000000000 +0200
@@ -1 +1,4 @@
 # see scalbn.s
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/i386/llrintf.s musl/src/math/i386/llrintf.s
--- musl.orig//src/math/i386/llrintf.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/i386/llrintf.s	2012-08-05 23:21:58.000000000 +0200
@@ -7,3 +7,6 @@
 	pop %eax
 	pop %edx
 	ret
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/i386/llrintl.s musl/src/math/i386/llrintl.s
--- musl.orig//src/math/i386/llrintl.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/i386/llrintl.s	2012-08-05 23:21:58.000000000 +0200
@@ -6,3 +6,6 @@
 	mov 4(%esp),%eax
 	mov 8(%esp),%edx
 	ret
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/i386/llrint.s musl/src/math/i386/llrint.s
--- musl.orig//src/math/i386/llrint.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/i386/llrint.s	2012-08-05 23:21:58.000000000 +0200
@@ -6,3 +6,6 @@
 	mov 4(%esp),%eax
 	mov 8(%esp),%edx
 	ret
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/i386/log10f.s musl/src/math/i386/log10f.s
--- musl.orig//src/math/i386/log10f.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/i386/log10f.s	2012-08-05 23:21:58.000000000 +0200
@@ -5,3 +5,6 @@
 	flds 4(%esp)
 	fyl2x
 	ret
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/i386/log10l.s musl/src/math/i386/log10l.s
--- musl.orig//src/math/i386/log10l.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/i386/log10l.s	2012-08-05 23:21:58.000000000 +0200
@@ -5,3 +5,6 @@
 	fldt 4(%esp)
 	fyl2x
 	ret
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/i386/log10.s musl/src/math/i386/log10.s
--- musl.orig//src/math/i386/log10.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/i386/log10.s	2012-08-05 23:21:58.000000000 +0200
@@ -5,3 +5,6 @@
 	fldl 4(%esp)
 	fyl2x
 	ret
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/i386/log1pf.s musl/src/math/i386/log1pf.s
--- musl.orig//src/math/i386/log1pf.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/i386/log1pf.s	2012-08-05 23:21:58.000000000 +0200
@@ -13,3 +13,6 @@
 	faddp
 	fyl2x
 	ret
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/i386/log1pl.s musl/src/math/i386/log1pl.s
--- musl.orig//src/math/i386/log1pl.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/i386/log1pl.s	2012-08-05 23:21:58.000000000 +0200
@@ -13,3 +13,6 @@
 	faddp
 	fyl2x
 	ret
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/i386/log1p.s musl/src/math/i386/log1p.s
--- musl.orig//src/math/i386/log1p.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/i386/log1p.s	2012-08-05 23:21:58.000000000 +0200
@@ -13,3 +13,6 @@
 	faddp
 	fyl2x
 	ret
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/i386/log2f.s musl/src/math/i386/log2f.s
--- musl.orig//src/math/i386/log2f.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/i386/log2f.s	2012-08-05 23:21:58.000000000 +0200
@@ -5,3 +5,6 @@
 	flds 4(%esp)
 	fyl2x
 	ret
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/i386/log2l.s musl/src/math/i386/log2l.s
--- musl.orig//src/math/i386/log2l.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/i386/log2l.s	2012-08-05 23:21:58.000000000 +0200
@@ -5,3 +5,6 @@
 	fldt 4(%esp)
 	fyl2x
 	ret
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/i386/log2.s musl/src/math/i386/log2.s
--- musl.orig//src/math/i386/log2.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/i386/log2.s	2012-08-05 23:21:58.000000000 +0200
@@ -5,3 +5,6 @@
 	fldl 4(%esp)
 	fyl2x
 	ret
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/i386/logf.s musl/src/math/i386/logf.s
--- musl.orig//src/math/i386/logf.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/i386/logf.s	2012-08-05 23:21:58.000000000 +0200
@@ -5,3 +5,6 @@
 	flds 4(%esp)
 	fyl2x
 	ret
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/i386/logl.s musl/src/math/i386/logl.s
--- musl.orig//src/math/i386/logl.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/i386/logl.s	2012-08-05 23:21:58.000000000 +0200
@@ -5,3 +5,6 @@
 	fldt 4(%esp)
 	fyl2x
 	ret
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/i386/log.s musl/src/math/i386/log.s
--- musl.orig//src/math/i386/log.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/i386/log.s	2012-08-05 23:21:58.000000000 +0200
@@ -5,3 +5,6 @@
 	fldl 4(%esp)
 	fyl2x
 	ret
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/i386/lrintf.s musl/src/math/i386/lrintf.s
--- musl.orig//src/math/i386/lrintf.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/i386/lrintf.s	2012-08-05 23:21:58.000000000 +0200
@@ -5,3 +5,6 @@
 	fistpl 4(%esp)
 	mov 4(%esp),%eax
 	ret
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/i386/lrintl.s musl/src/math/i386/lrintl.s
--- musl.orig//src/math/i386/lrintl.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/i386/lrintl.s	2012-08-05 23:21:58.000000000 +0200
@@ -5,3 +5,6 @@
 	fistpl 4(%esp)
 	mov 4(%esp),%eax
 	ret
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/i386/lrint.s musl/src/math/i386/lrint.s
--- musl.orig//src/math/i386/lrint.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/i386/lrint.s	2012-08-05 23:21:58.000000000 +0200
@@ -5,3 +5,6 @@
 	fistpl 4(%esp)
 	mov 4(%esp),%eax
 	ret
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/i386/remainderf.s musl/src/math/i386/remainderf.s
--- musl.orig//src/math/i386/remainderf.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/i386/remainderf.s	2012-08-05 23:21:58.000000000 +0200
@@ -9,3 +9,6 @@
 	jp 1b
 	fstp %st(1)
 	ret
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/i386/remainderl.s musl/src/math/i386/remainderl.s
--- musl.orig//src/math/i386/remainderl.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/i386/remainderl.s	2012-08-05 23:21:58.000000000 +0200
@@ -9,3 +9,6 @@
 	jp 1b
 	fstp %st(1)
 	ret
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/i386/remainder.s musl/src/math/i386/remainder.s
--- musl.orig//src/math/i386/remainder.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/i386/remainder.s	2012-08-05 23:21:58.000000000 +0200
@@ -9,3 +9,6 @@
 	jp 1b
 	fstp %st(1)
 	ret
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/i386/remquof.s musl/src/math/i386/remquof.s
--- musl.orig//src/math/i386/remquof.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/i386/remquof.s	2012-08-05 23:21:58.000000000 +0200
@@ -1 +1,4 @@
 # see remquo.s
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/i386/remquol.s musl/src/math/i386/remquol.s
--- musl.orig//src/math/i386/remquol.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/i386/remquol.s	2012-08-05 23:21:58.000000000 +0200
@@ -1 +1,4 @@
 # see remquo.s
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/i386/remquo.s musl/src/math/i386/remquo.s
--- musl.orig//src/math/i386/remquo.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/i386/remquo.s	2012-08-05 23:21:58.000000000 +0200
@@ -48,3 +48,6 @@
 1:	movsbl %dl,%edx
 	mov %edx,(%ecx)
 	ret
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/i386/rintf.s musl/src/math/i386/rintf.s
--- musl.orig//src/math/i386/rintf.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/i386/rintf.s	2012-08-05 23:21:58.000000000 +0200
@@ -4,3 +4,6 @@
 	flds 4(%esp)
 	frndint
 	ret
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/i386/rintl.s musl/src/math/i386/rintl.s
--- musl.orig//src/math/i386/rintl.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/i386/rintl.s	2012-08-05 23:21:58.000000000 +0200
@@ -4,3 +4,6 @@
 	fldt 4(%esp)
 	frndint
 	ret
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/i386/rint.s musl/src/math/i386/rint.s
--- musl.orig//src/math/i386/rint.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/i386/rint.s	2012-08-05 23:21:58.000000000 +0200
@@ -4,3 +4,6 @@
 	fldl 4(%esp)
 	frndint
 	ret
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/i386/scalblnf.s musl/src/math/i386/scalblnf.s
--- musl.orig//src/math/i386/scalblnf.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/i386/scalblnf.s	2012-08-05 23:21:58.000000000 +0200
@@ -1 +1,4 @@
 # see scalbnf.s
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/i386/scalblnl.s musl/src/math/i386/scalblnl.s
--- musl.orig//src/math/i386/scalblnl.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/i386/scalblnl.s	2012-08-05 23:21:58.000000000 +0200
@@ -1 +1,4 @@
 # see scalbnl.s
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/i386/scalbln.s musl/src/math/i386/scalbln.s
--- musl.orig//src/math/i386/scalbln.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/i386/scalbln.s	2012-08-05 23:21:58.000000000 +0200
@@ -1 +1,4 @@
 # see scalbn.s
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/i386/scalbnf.s musl/src/math/i386/scalbnf.s
--- musl.orig//src/math/i386/scalbnf.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/i386/scalbnf.s	2012-08-05 23:21:58.000000000 +0200
@@ -30,3 +30,6 @@
 	fstps 4(%esp)
 	flds 4(%esp)
 	ret
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/i386/scalbnl.s musl/src/math/i386/scalbnl.s
--- musl.orig//src/math/i386/scalbnl.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/i386/scalbnl.s	2012-08-05 23:21:58.000000000 +0200
@@ -30,3 +30,6 @@
 	fscale
 	fstp %st(1)
 	ret
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/i386/scalbn.s musl/src/math/i386/scalbn.s
--- musl.orig//src/math/i386/scalbn.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/i386/scalbn.s	2012-08-05 23:21:58.000000000 +0200
@@ -31,3 +31,6 @@
 	fstpl 4(%esp)
 	fldl 4(%esp)
 	ret
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/i386/sqrtf.s musl/src/math/i386/sqrtf.s
--- musl.orig//src/math/i386/sqrtf.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/i386/sqrtf.s	2012-08-05 23:21:58.000000000 +0200
@@ -5,3 +5,6 @@
 	fstps 4(%esp)
 	flds 4(%esp)
 	ret
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/i386/sqrtl.s musl/src/math/i386/sqrtl.s
--- musl.orig//src/math/i386/sqrtl.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/i386/sqrtl.s	2012-08-05 23:21:58.000000000 +0200
@@ -3,3 +3,6 @@
 sqrtl:	fldt 4(%esp)
 	fsqrt
 	ret
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/i386/sqrt.s musl/src/math/i386/sqrt.s
--- musl.orig//src/math/i386/sqrt.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/i386/sqrt.s	2012-08-05 23:21:58.000000000 +0200
@@ -19,3 +19,6 @@
 	fstpl 4(%esp)
 	fldl 4(%esp)
 	ret
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/i386/truncf.s musl/src/math/i386/truncf.s
--- musl.orig//src/math/i386/truncf.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/i386/truncf.s	2012-08-05 23:21:58.000000000 +0200
@@ -1 +1,4 @@
 # see floor.s
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/i386/truncl.s musl/src/math/i386/truncl.s
--- musl.orig//src/math/i386/truncl.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/i386/truncl.s	2012-08-05 23:21:58.000000000 +0200
@@ -1 +1,4 @@
 # see floor.s
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/i386/trunc.s musl/src/math/i386/trunc.s
--- musl.orig//src/math/i386/trunc.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/i386/trunc.s	2012-08-05 23:21:58.000000000 +0200
@@ -1 +1,4 @@
 # see floor.s
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/x86_64/acosl.s musl/src/math/x86_64/acosl.s
--- musl.orig//src/math/x86_64/acosl.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/x86_64/acosl.s	2012-08-05 23:21:58.000000000 +0200
@@ -14,3 +14,6 @@
 	fxch %st(1)
 	fpatan
 	ret
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/x86_64/asinl.s musl/src/math/x86_64/asinl.s
--- musl.orig//src/math/x86_64/asinl.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/x86_64/asinl.s	2012-08-05 23:21:58.000000000 +0200
@@ -10,3 +10,6 @@
 	fsqrt
 	fpatan
 	ret
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/x86_64/atan2l.s musl/src/math/x86_64/atan2l.s
--- musl.orig//src/math/x86_64/atan2l.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/x86_64/atan2l.s	2012-08-05 23:21:58.000000000 +0200
@@ -5,3 +5,6 @@
 	fldt 24(%rsp)
 	fpatan
 	ret
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/x86_64/atanl.s musl/src/math/x86_64/atanl.s
--- musl.orig//src/math/x86_64/atanl.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/x86_64/atanl.s	2012-08-05 23:21:58.000000000 +0200
@@ -5,3 +5,6 @@
 	fld1
 	fpatan
 	ret
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/x86_64/ceill.s musl/src/math/x86_64/ceill.s
--- musl.orig//src/math/x86_64/ceill.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/x86_64/ceill.s	2012-08-05 23:21:58.000000000 +0200
@@ -1 +1,4 @@
 # see floor.s
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/x86_64/exp2l.s musl/src/math/x86_64/exp2l.s
--- musl.orig//src/math/x86_64/exp2l.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/x86_64/exp2l.s	2012-08-05 23:21:58.000000000 +0200
@@ -1 +1,4 @@
 # see expl.s
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/x86_64/expl.s musl/src/math/x86_64/expl.s
--- musl.orig//src/math/x86_64/expl.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/x86_64/expl.s	2012-08-05 23:21:58.000000000 +0200
@@ -83,3 +83,6 @@
 	fscale
 	fstp %st(1)
 	ret
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/x86_64/expm1l.s musl/src/math/x86_64/expm1l.s
--- musl.orig//src/math/x86_64/expm1l.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/x86_64/expm1l.s	2012-08-05 23:21:58.000000000 +0200
@@ -1 +1,4 @@
 # see expm1.s
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/x86_64/fabsf.s musl/src/math/x86_64/fabsf.s
--- musl.orig//src/math/x86_64/fabsf.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/x86_64/fabsf.s	2012-08-05 23:21:58.000000000 +0200
@@ -5,3 +5,6 @@
 	movq %rax,%xmm1
 	andps %xmm1,%xmm0
 	ret
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/x86_64/fabsl.s musl/src/math/x86_64/fabsl.s
--- musl.orig//src/math/x86_64/fabsl.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/x86_64/fabsl.s	2012-08-05 23:21:58.000000000 +0200
@@ -4,3 +4,6 @@
 	fldt 8(%rsp)
 	fabs
 	ret
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/x86_64/fabs.s musl/src/math/x86_64/fabs.s
--- musl.orig//src/math/x86_64/fabs.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/x86_64/fabs.s	2012-08-05 23:21:58.000000000 +0200
@@ -7,3 +7,6 @@
 	movq %rax,%xmm1
 	andpd %xmm1,%xmm0
 	ret
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/x86_64/floorl.s musl/src/math/x86_64/floorl.s
--- musl.orig//src/math/x86_64/floorl.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/x86_64/floorl.s	2012-08-05 23:21:58.000000000 +0200
@@ -25,3 +25,6 @@
 	fldt 8(%rsp)
 	mov $0xf,%al
 	jmp 1b
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/x86_64/fmodl.s musl/src/math/x86_64/fmodl.s
--- musl.orig//src/math/x86_64/fmodl.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/x86_64/fmodl.s	2012-08-05 23:21:58.000000000 +0200
@@ -9,3 +9,6 @@
 	jp 1b
 	fstp %st(1)
 	ret
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/x86_64/llrintf.s musl/src/math/x86_64/llrintf.s
--- musl.orig//src/math/x86_64/llrintf.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/x86_64/llrintf.s	2012-08-05 23:21:58.000000000 +0200
@@ -3,3 +3,6 @@
 llrintf:
 	cvtss2si %xmm0,%rax
 	ret
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/x86_64/llrintl.s musl/src/math/x86_64/llrintl.s
--- musl.orig//src/math/x86_64/llrintl.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/x86_64/llrintl.s	2012-08-05 23:21:58.000000000 +0200
@@ -5,3 +5,6 @@
 	fistpll 8(%rsp)
 	mov 8(%rsp),%rax
 	ret
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/x86_64/llrint.s musl/src/math/x86_64/llrint.s
--- musl.orig//src/math/x86_64/llrint.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/x86_64/llrint.s	2012-08-05 23:21:58.000000000 +0200
@@ -3,3 +3,6 @@
 llrint:
 	cvtsd2si %xmm0,%rax
 	ret
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/x86_64/log10l.s musl/src/math/x86_64/log10l.s
--- musl.orig//src/math/x86_64/log10l.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/x86_64/log10l.s	2012-08-05 23:21:58.000000000 +0200
@@ -5,3 +5,6 @@
 	fldt 8(%rsp)
 	fyl2x
 	ret
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/x86_64/log1pl.s musl/src/math/x86_64/log1pl.s
--- musl.orig//src/math/x86_64/log1pl.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/x86_64/log1pl.s	2012-08-05 23:21:58.000000000 +0200
@@ -13,3 +13,6 @@
 	faddp
 	fyl2x
 	ret
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/x86_64/log2l.s musl/src/math/x86_64/log2l.s
--- musl.orig//src/math/x86_64/log2l.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/x86_64/log2l.s	2012-08-05 23:21:58.000000000 +0200
@@ -5,3 +5,6 @@
 	fldt 8(%rsp)
 	fyl2x
 	ret
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/x86_64/logl.s musl/src/math/x86_64/logl.s
--- musl.orig//src/math/x86_64/logl.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/x86_64/logl.s	2012-08-05 23:21:58.000000000 +0200
@@ -5,3 +5,6 @@
 	fldt 8(%rsp)
 	fyl2x
 	ret
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/x86_64/lrintf.s musl/src/math/x86_64/lrintf.s
--- musl.orig//src/math/x86_64/lrintf.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/x86_64/lrintf.s	2012-08-05 23:21:58.000000000 +0200
@@ -3,3 +3,6 @@
 lrintf:
 	cvtss2si %xmm0,%rax
 	ret
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/x86_64/lrintl.s musl/src/math/x86_64/lrintl.s
--- musl.orig//src/math/x86_64/lrintl.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/x86_64/lrintl.s	2012-08-05 23:21:58.000000000 +0200
@@ -5,3 +5,6 @@
 	fistpl 8(%rsp)
 	mov 8(%rsp),%eax
 	ret
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/x86_64/lrint.s musl/src/math/x86_64/lrint.s
--- musl.orig//src/math/x86_64/lrint.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/x86_64/lrint.s	2012-08-05 23:21:58.000000000 +0200
@@ -3,3 +3,6 @@
 lrint:
 	cvtsd2si %xmm0,%rax
 	ret
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/x86_64/remainderl.s musl/src/math/x86_64/remainderl.s
--- musl.orig//src/math/x86_64/remainderl.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/x86_64/remainderl.s	2012-08-05 23:21:58.000000000 +0200
@@ -9,3 +9,6 @@
 	jp 1b
 	fstp %st(1)
 	ret
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/x86_64/rintl.s musl/src/math/x86_64/rintl.s
--- musl.orig//src/math/x86_64/rintl.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/x86_64/rintl.s	2012-08-05 23:21:58.000000000 +0200
@@ -4,3 +4,6 @@
 	fldt 8(%rsp)
 	frndint
 	ret
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/x86_64/sqrtf.s musl/src/math/x86_64/sqrtf.s
--- musl.orig//src/math/x86_64/sqrtf.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/x86_64/sqrtf.s	2012-08-05 23:21:58.000000000 +0200
@@ -2,3 +2,6 @@
 .type sqrtf,@function
 sqrtf:  sqrtss %xmm0, %xmm0
 	ret
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/x86_64/sqrtl.s musl/src/math/x86_64/sqrtl.s
--- musl.orig//src/math/x86_64/sqrtl.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/x86_64/sqrtl.s	2012-08-05 23:21:58.000000000 +0200
@@ -3,3 +3,6 @@
 sqrtl:	fldt 8(%rsp)
 	fsqrt
 	ret
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/x86_64/sqrt.s musl/src/math/x86_64/sqrt.s
--- musl.orig//src/math/x86_64/sqrt.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/x86_64/sqrt.s	2012-08-05 23:21:58.000000000 +0200
@@ -2,3 +2,6 @@
 .type sqrt,@function
 sqrt:	sqrtsd %xmm0, %xmm0
 	ret
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/math/x86_64/truncl.s musl/src/math/x86_64/truncl.s
--- musl.orig//src/math/x86_64/truncl.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/math/x86_64/truncl.s	2012-08-05 23:21:58.000000000 +0200
@@ -1 +1,4 @@
 # see floor.s
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/process/i386/vfork.s musl/src/process/i386/vfork.s
--- musl.orig//src/process/i386/vfork.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/process/i386/vfork.s	2012-08-05 23:21:58.000000000 +0200
@@ -12,3 +12,6 @@
 	call __syscall_ret
 	pop %edx
 	ret
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/process/x86_64/vfork.s musl/src/process/x86_64/vfork.s
--- musl.orig//src/process/x86_64/vfork.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/process/x86_64/vfork.s	2012-08-05 23:21:58.000000000 +0200
@@ -10,3 +10,6 @@
 	push %rdx
 	mov %rax,%rdi
 	jmp __syscall_ret
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/setjmp/arm/longjmp.s musl/src/setjmp/arm/longjmp.s
--- musl.orig//src/setjmp/arm/longjmp.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/setjmp/arm/longjmp.s	2012-08-05 23:21:58.000000000 +0200
@@ -37,3 +37,6 @@
 
 .hidden __hwcap
 1:	.word __hwcap-1b
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/setjmp/arm/setjmp.s musl/src/setjmp/arm/setjmp.s
--- musl.orig//src/setjmp/arm/setjmp.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/setjmp/arm/setjmp.s	2012-08-05 23:21:58.000000000 +0200
@@ -39,3 +39,6 @@
 
 .hidden __hwcap
 1:	.word __hwcap-1b
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/setjmp/i386/longjmp.s musl/src/setjmp/i386/longjmp.s
--- musl.orig//src/setjmp/i386/longjmp.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/setjmp/i386/longjmp.s	2012-08-05 23:21:58.000000000 +0200
@@ -18,3 +18,6 @@
 	mov     %ecx,%esp
 	mov 20(%edx),%ecx
 	jmp *%ecx
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/setjmp/i386/setjmp.s musl/src/setjmp/i386/setjmp.s
--- musl.orig//src/setjmp/i386/setjmp.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/setjmp/i386/setjmp.s	2012-08-05 23:21:58.000000000 +0200
@@ -18,3 +18,6 @@
 	mov    %ecx, 20(%eax)
 	xor    %eax, %eax
 	ret
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/setjmp/mips/longjmp.s musl/src/setjmp/mips/longjmp.s
--- musl.orig//src/setjmp/mips/longjmp.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/setjmp/mips/longjmp.s	2012-08-05 23:21:58.000000000 +0200
@@ -37,3 +37,6 @@
 	lw      $30, 40($4)
 	jr      $ra
 	lw      $28, 44($4)
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/setjmp/mips/setjmp.s musl/src/setjmp/mips/setjmp.s
--- musl.orig//src/setjmp/mips/setjmp.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/setjmp/mips/setjmp.s	2012-08-05 23:21:58.000000000 +0200
@@ -37,3 +37,6 @@
 	swc1    $31, 100($4)
 	jr      $ra
 	li      $2, 0
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/setjmp/x86_64/longjmp.s musl/src/setjmp/x86_64/longjmp.s
--- musl.orig//src/setjmp/x86_64/longjmp.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/setjmp/x86_64/longjmp.s	2012-08-05 23:21:58.000000000 +0200
@@ -20,3 +20,6 @@
 	mov %rdx,%rsp
 	mov 56(%rdi),%rdx       /* this is the instruction pointer */
 	jmp *%rdx               /* goto saved address without altering rsp */
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/setjmp/x86_64/setjmp.s musl/src/setjmp/x86_64/setjmp.s
--- musl.orig//src/setjmp/x86_64/setjmp.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/setjmp/x86_64/setjmp.s	2012-08-05 23:21:58.000000000 +0200
@@ -20,3 +20,6 @@
 	mov %rdx,56(%rdi)
 	xor %rax,%rax           /* always return 0 */
 	ret
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/signal/arm/restore.s musl/src/signal/arm/restore.s
--- musl.orig//src/signal/arm/restore.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/signal/arm/restore.s	2012-08-05 23:21:58.000000000 +0200
@@ -9,3 +9,6 @@
 __restore_rt:
 	mov r7,#173
 	swi 0x0
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/signal/arm/sigsetjmp.s musl/src/signal/arm/sigsetjmp.s
--- musl.orig//src/signal/arm/sigsetjmp.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/signal/arm/sigsetjmp.s	2012-08-05 23:21:58.000000000 +0200
@@ -11,3 +11,6 @@
 	bl sigprocmask
 	pop {a1,lr}
 	b setjmp
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/signal/i386/restore.s musl/src/signal/i386/restore.s
--- musl.orig//src/signal/i386/restore.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/signal/i386/restore.s	2012-08-05 23:21:58.000000000 +0200
@@ -10,3 +10,6 @@
 __restore_rt:
 	movl $173, %eax
 	int $0x80
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/signal/i386/sigsetjmp.s musl/src/signal/i386/sigsetjmp.s
--- musl.orig//src/signal/i386/sigsetjmp.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/signal/i386/sigsetjmp.s	2012-08-05 23:21:58.000000000 +0200
@@ -12,3 +12,6 @@
 	call sigprocmask
 	add $12,%esp
 1:	jmp setjmp
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/signal/mips/restore.s musl/src/signal/mips/restore.s
--- musl.orig//src/signal/mips/restore.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/signal/mips/restore.s	2012-08-05 23:21:58.000000000 +0200
@@ -11,3 +11,6 @@
 __restore:
 	li $2, 4119
 	syscall
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/signal/mips/sigsetjmp.s musl/src/signal/mips/sigsetjmp.s
--- musl.orig//src/signal/mips/sigsetjmp.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/signal/mips/sigsetjmp.s	2012-08-05 23:21:58.000000000 +0200
@@ -25,3 +25,6 @@
 1:	lw $25, %call16(setjmp)($gp)
 	jr $25
 	nop
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/signal/x86_64/restore.s musl/src/signal/x86_64/restore.s
--- musl.orig//src/signal/x86_64/restore.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/signal/x86_64/restore.s	2012-08-05 23:21:58.000000000 +0200
@@ -6,3 +6,6 @@
 __restore:
 	movl $15, %eax
 	syscall
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/signal/x86_64/sigsetjmp.s musl/src/signal/x86_64/sigsetjmp.s
--- musl.orig//src/signal/x86_64/sigsetjmp.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/signal/x86_64/sigsetjmp.s	2012-08-05 23:21:58.000000000 +0200
@@ -12,3 +12,6 @@
 	call sigprocmask
 	popq %rdi
 1:	jmp setjmp
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/thread/arm/clone.s musl/src/thread/arm/clone.s
--- musl.orig//src/thread/arm/clone.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/thread/arm/clone.s	2012-08-05 23:21:58.000000000 +0200
@@ -34,3 +34,6 @@
 1:	mov lr,pc
 	bx r5
 	b 2b
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/thread/arm/__set_thread_area.s musl/src/thread/arm/__set_thread_area.s
--- musl.orig//src/thread/arm/__set_thread_area.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/thread/arm/__set_thread_area.s	2012-08-05 23:21:58.000000000 +0200
@@ -10,3 +10,6 @@
 	tst lr,#1
 	moveq pc,lr
 	bx lr
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/thread/arm/syscall_cp.s musl/src/thread/arm/syscall_cp.s
--- musl.orig//src/thread/arm/syscall_cp.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/thread/arm/syscall_cp.s	2012-08-05 23:21:58.000000000 +0200
@@ -19,3 +19,6 @@
 	tst lr,#1
 	moveq pc,lr
 	bx lr
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/thread/arm/__unmapself.s musl/src/thread/arm/__unmapself.s
--- musl.orig//src/thread/arm/__unmapself.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/thread/arm/__unmapself.s	2012-08-05 23:21:58.000000000 +0200
@@ -6,3 +6,6 @@
 	svc 0
 	mov r7,#1
 	svc 0
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/thread/i386/clone.s musl/src/thread/i386/clone.s
--- musl.orig//src/thread/i386/clone.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/thread/i386/clone.s	2012-08-05 23:21:58.000000000 +0200
@@ -49,3 +49,6 @@
 	pop %ebx
 	pop %ebp
 	ret
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/thread/i386/__set_thread_area.s musl/src/thread/i386/__set_thread_area.s
--- musl.orig//src/thread/i386/__set_thread_area.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/thread/i386/__set_thread_area.s	2012-08-05 23:21:58.000000000 +0200
@@ -20,3 +20,6 @@
 	addl $16,%esp
 	popl %ebx
 	ret
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/thread/i386/syscall_cp.s musl/src/thread/i386/syscall_cp.s
--- musl.orig//src/thread/i386/syscall_cp.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/thread/i386/syscall_cp.s	2012-08-05 23:21:58.000000000 +0200
@@ -27,3 +27,6 @@
 	popl %esi
 	popl %ebx
 	ret
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/thread/i386/__unmapself.s musl/src/thread/i386/__unmapself.s
--- musl.orig//src/thread/i386/__unmapself.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/thread/i386/__unmapself.s	2012-08-05 23:21:58.000000000 +0200
@@ -9,3 +9,6 @@
 	xorl %ebx,%ebx
 	movl $1,%eax
 	int $128
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/thread/mips/clone.s musl/src/thread/mips/clone.s
--- musl.orig//src/thread/mips/clone.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/thread/mips/clone.s	2012-08-05 23:21:58.000000000 +0200
@@ -26,3 +26,6 @@
 	lw $4, 4($sp)
 	jr $25
 	nop
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/thread/mips/syscall_cp.s musl/src/thread/mips/syscall_cp.s
--- musl.orig//src/thread/mips/syscall_cp.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/thread/mips/syscall_cp.s	2012-08-05 23:21:58.000000000 +0200
@@ -29,3 +29,6 @@
 2:	lw      $25, %call16(__cancel)($gp)
 	jr      $25
 	nop
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/thread/mips/__unmapself.s musl/src/thread/mips/__unmapself.s
--- musl.orig//src/thread/mips/__unmapself.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/thread/mips/__unmapself.s	2012-08-05 23:21:58.000000000 +0200
@@ -7,3 +7,6 @@
 	li $4, 0
 	li $2, 4001
 	syscall
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/thread/x86_64/clone.s musl/src/thread/x86_64/clone.s
--- musl.orig//src/thread/x86_64/clone.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/thread/x86_64/clone.s	2012-08-05 23:21:58.000000000 +0200
@@ -28,3 +28,6 @@
 	syscall
 	hlt
 1:	ret
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/thread/x86_64/__set_thread_area.s musl/src/thread/x86_64/__set_thread_area.s
--- musl.orig//src/thread/x86_64/__set_thread_area.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/thread/x86_64/__set_thread_area.s	2012-08-05 23:21:58.000000000 +0200
@@ -8,3 +8,6 @@
         movl $158,%eax          /* set fs segment to */
         syscall                 /* arch_prctl(SET_FS, arg)*/
 	ret
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/thread/x86_64/syscall_cp.s musl/src/thread/x86_64/syscall_cp.s
--- musl.orig//src/thread/x86_64/syscall_cp.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/thread/x86_64/syscall_cp.s	2012-08-05 23:21:58.000000000 +0200
@@ -21,3 +21,6 @@
 .global __cp_end
 __cp_end:
 	ret
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/thread/x86_64/__unmapself.s musl/src/thread/x86_64/__unmapself.s
--- musl.orig//src/thread/x86_64/__unmapself.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/thread/x86_64/__unmapself.s	2012-08-05 23:21:58.000000000 +0200
@@ -8,3 +8,6 @@
 	xor %rdi,%rdi   /* exit() args: always return success */
 	movl $60,%eax   /* SYS_exit */
 	syscall         /* exit(0) */
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif
diff -urN musl.orig//src/unistd/mips/pipe.s musl/src/unistd/mips/pipe.s
--- musl.orig//src/unistd/mips/pipe.s	2012-08-05 23:20:30.000000000 +0200
+++ musl/src/unistd/mips/pipe.s	2012-08-05 23:21:58.000000000 +0200
@@ -18,3 +18,6 @@
 	move $2, $0
 	jr $ra
 	nop
+#if defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+#endif

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: noexecstack
  2012-08-05 21:35 noexecstack Daniel Cegiełka
@ 2012-08-05 21:41 ` Anthony G. Basile
  2012-08-05 21:46 ` noexecstack Rich Felker
  2012-08-06  6:45 ` noexecstack orc
  2 siblings, 0 replies; 19+ messages in thread
From: Anthony G. Basile @ 2012-08-05 21:41 UTC (permalink / raw)
  To: musl

On 08/05/2012 05:35 PM, Daniel Cegiełka wrote:
> Vasily Kulikov published a patch for nonexecutable stack for glibc in Owl.
>
> http://openwall.com/lists/owl-dev/2012/08/05/1
> http://openwall.com/lists/owl-dev/2012/08/05/3
>
> Should we support this in the musl?
>
> The patch for musl asm files is attached...
>
> best regards,
> Daniel

Yes please.  This is a QA requirement in Gentoo and I was going to 
suggest it alla http://www.gentoo.org/proj/en/hardened/gnu-stack.xml

-- 
Anthony G. Basile, Ph. D.
Chair of Information Technology
D'Youville College
Buffalo, NY 14201
(716) 829-8197


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: noexecstack
  2012-08-05 21:35 noexecstack Daniel Cegiełka
  2012-08-05 21:41 ` noexecstack Anthony G. Basile
@ 2012-08-05 21:46 ` Rich Felker
  2012-08-05 22:01   ` noexecstack Nathan McSween
  2012-08-06  6:43   ` noexecstack Szabolcs Nagy
  2012-08-06  6:45 ` noexecstack orc
  2 siblings, 2 replies; 19+ messages in thread
From: Rich Felker @ 2012-08-05 21:46 UTC (permalink / raw)
  To: musl

On Sun, Aug 05, 2012 at 11:35:36PM +0200, Daniel Cegiełka wrote:
> Vasily Kulikov published a patch for nonexecutable stack for glibc in Owl.
> 
> http://openwall.com/lists/owl-dev/2012/08/05/1
> http://openwall.com/lists/owl-dev/2012/08/05/3
> 
> Should we support this in the musl?

Yes, but there should be a way to do it without putting ugly stuff
like this in every single asm file. Why isn't there a command-line
option to the assembler to do it? Or a way to do it globally with
objcopy?

Better yet, why is executable stack even still supported by Linux at
all?

Rich


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: noexecstack
  2012-08-05 21:46 ` noexecstack Rich Felker
@ 2012-08-05 22:01   ` Nathan McSween
  2012-08-05 22:45     ` noexecstack Rich Felker
  2012-08-06  6:43   ` noexecstack Szabolcs Nagy
  1 sibling, 1 reply; 19+ messages in thread
From: Nathan McSween @ 2012-08-05 22:01 UTC (permalink / raw)
  To: musl

On Sun, Aug 5, 2012 at 2:46 PM, Rich Felker <dalias@aerifal.cx> wrote:
> On Sun, Aug 05, 2012 at 11:35:36PM +0200, Daniel Cegiełka wrote:
>> Vasily Kulikov published a patch for nonexecutable stack for glibc in Owl.
>>
>> http://openwall.com/lists/owl-dev/2012/08/05/1
>> http://openwall.com/lists/owl-dev/2012/08/05/3
>>
>> Should we support this in the musl?
>
> Yes, but there should be a way to do it without putting ugly stuff
> like this in every single asm file. Why isn't there a command-line
> option to the assembler to do it? Or a way to do it globally with
> objcopy?
>
> Better yet, why is executable stack even still supported by Linux at
> all?
>
> Rich

GCC nested functions require executable stack and consequently quite a
few GNU / bad projects utilize this 'feature'.


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: noexecstack
  2012-08-05 22:01   ` noexecstack Nathan McSween
@ 2012-08-05 22:45     ` Rich Felker
  0 siblings, 0 replies; 19+ messages in thread
From: Rich Felker @ 2012-08-05 22:45 UTC (permalink / raw)
  To: musl

On Sun, Aug 05, 2012 at 03:01:08PM -0700, Nathan McSween wrote:
> On Sun, Aug 5, 2012 at 2:46 PM, Rich Felker <dalias@aerifal.cx> wrote:
> > On Sun, Aug 05, 2012 at 11:35:36PM +0200, Daniel Cegiełka wrote:
> >> Vasily Kulikov published a patch for nonexecutable stack for glibc in Owl.
> >>
> >> http://openwall.com/lists/owl-dev/2012/08/05/1
> >> http://openwall.com/lists/owl-dev/2012/08/05/3
> >>
> >> Should we support this in the musl?
> >
> > Yes, but there should be a way to do it without putting ugly stuff
> > like this in every single asm file. Why isn't there a command-line
> > option to the assembler to do it? Or a way to do it globally with
> > objcopy?
> >
> > Better yet, why is executable stack even still supported by Linux at
> > all?
> >
> > Rich
> 
> GCC nested functions require executable stack

Yes, I'm aware...

> and consequently quite a
> few GNU / bad projects utilize this 'feature'.

I doubt they do anymore since, as far as I know, most
security-hardened kernels permanently disable executable stack even in
programs that "request" it (by failing to put a GNU-specific header
not requesting it). A while back I had to fix musl's thread stack
allocation to use PROT_READ|PROT_WRITE without PROT_EXEC because
hardened kernels were refusing to make the mapping altogether with
both PROT_WRITE and PROT_EXEC specified. So at present, executable
stack is not supported in musl anyway except in the main thread, and
I'd be plenty happy to just kill it off completely if there were a
way..

Rich


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: noexecstack
  2012-08-05 21:46 ` noexecstack Rich Felker
  2012-08-05 22:01   ` noexecstack Nathan McSween
@ 2012-08-06  6:43   ` Szabolcs Nagy
  2012-08-06  9:37     ` noexecstack Rich Felker
  1 sibling, 1 reply; 19+ messages in thread
From: Szabolcs Nagy @ 2012-08-06  6:43 UTC (permalink / raw)
  To: musl

* Rich Felker <dalias@aerifal.cx> [2012-08-05 17:46:25 -0400]:
> Yes, but there should be a way to do it without putting ugly stuff
> like this in every single asm file. Why isn't there a command-line
> option to the assembler to do it? Or a way to do it globally with
> objcopy?
> 

ld -z noexecstack


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: noexecstack
  2012-08-05 21:35 noexecstack Daniel Cegiełka
  2012-08-05 21:41 ` noexecstack Anthony G. Basile
  2012-08-05 21:46 ` noexecstack Rich Felker
@ 2012-08-06  6:45 ` orc
  2012-08-06  7:16   ` noexecstack Daniel Cegiełka
  2012-08-07 11:57   ` noexecstack Vasily Kulikov
  2 siblings, 2 replies; 19+ messages in thread
From: orc @ 2012-08-06  6:45 UTC (permalink / raw)
  To: musl

On Sun, 5 Aug 2012 23:35:36 +0200
Daniel Cegiełka <daniel.cegielka@gmail.com> wrote:

> Vasily Kulikov published a patch for nonexecutable stack for glibc in
> Owl.
> 
> http://openwall.com/lists/owl-dev/2012/08/05/1
> http://openwall.com/lists/owl-dev/2012/08/05/3
> 
> Should we support this in the musl?
> 
> The patch for musl asm files is attached...
> 
> best regards,
> Daniel

Correct me if I'm wrong, but this is ugly stuff.

- binutils ld has -z noexecstack command line option.
- this (GNU_STACK) is binutils-specific (tinycc, for example, does not
  generate ELFs with that section, and future direction should be on
  that plain ELFs without any gnuish extensions IMO)
- Kernel sets executable stack by default, kernel can be patched not to
  do that (that's one line patch per architecture)
- binutils can be patched to not produce ELFs with executable stack by
  default

While some of options I listed here may harm some GCC or binutils
internals (I don't know), I see an utility that comes with grsecurity
patches (paxctl) that operates that section (GNU_STACK), converting it
into it's own.
I tested a system with patched binutils and kernel (but binutils patch
here will be enough) without any problems.


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: noexecstack
  2012-08-06  6:45 ` noexecstack orc
@ 2012-08-06  7:16   ` Daniel Cegiełka
  2012-08-06  7:55     ` noexecstack Justin Cormack
  2012-08-06  8:05     ` noexecstack orc
  2012-08-07 11:57   ` noexecstack Vasily Kulikov
  1 sibling, 2 replies; 19+ messages in thread
From: Daniel Cegiełka @ 2012-08-06  7:16 UTC (permalink / raw)
  To: musl

2012/8/6 orc <orc@sibserver.ru>:
> On Sun, 5 Aug 2012 23:35:36 +0200

> Correct me if I'm wrong, but this is ugly stuff.
>
> - binutils ld has -z noexecstack command line option.
> - this (GNU_STACK) is binutils-specific (tinycc, for example, does not
>   generate ELFs with that section, and future direction should be on
>   that plain ELFs without any gnuish extensions IMO)
> - Kernel sets executable stack by default, kernel can be patched not to
>   do that (that's one line patch per architecture)

Can you give some example of how to do it? It might be worthwhile to
introduce it into the main repository of Linux. What do you think?

> - binutils can be patched to not produce ELFs with executable stack by
>   default
>
> While some of options I listed here may harm some GCC or binutils
> internals (I don't know), I see an utility that comes with grsecurity
> patches (paxctl) that operates that section (GNU_STACK), converting it
> into it's own.
> I tested a system with patched binutils and kernel (but binutils patch
> here will be enough) without any problems.

It would be very nice if we could solve this problem in this way. I'm
currently using this patch, but this is not the best solution in my
opinion. Ideally if the system (kernel, binutils, libc) enforce
noexecstack by default... definitely worth look closer at this issue.

Thanks,
Daniel


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: noexecstack
  2012-08-06  7:16   ` noexecstack Daniel Cegiełka
@ 2012-08-06  7:55     ` Justin Cormack
  2012-08-06  8:05     ` noexecstack orc
  1 sibling, 0 replies; 19+ messages in thread
From: Justin Cormack @ 2012-08-06  7:55 UTC (permalink / raw)
  To: musl

On Mon, Aug 6, 2012 at 8:16 AM, Daniel Cegiełka
<daniel.cegielka@gmail.com> wrote:
> 2012/8/6 orc <orc@sibserver.ru>:
>> On Sun, 5 Aug 2012 23:35:36 +0200
>
>> Correct me if I'm wrong, but this is ugly stuff.
>>
>> - binutils ld has -z noexecstack command line option.
>> - this (GNU_STACK) is binutils-specific (tinycc, for example, does not
>>   generate ELFs with that section, and future direction should be on
>>   that plain ELFs without any gnuish extensions IMO)
>> - Kernel sets executable stack by default, kernel can be patched not to
>>   do that (that's one line patch per architecture)
>
> Can you give some example of how to do it? It might be worthwhile to
> introduce it into the main repository of Linux. What do you think?

That seems very sane to me. CONFIG_EXEC_STACK=n or something. I
imagine the distros would pick it up pretty fast. (Unless it breaks
Oracle or something, but at least the option is there, and it doesnt
rule out any of the other options).

Justin


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: noexecstack
  2012-08-06  7:16   ` noexecstack Daniel Cegiełka
  2012-08-06  7:55     ` noexecstack Justin Cormack
@ 2012-08-06  8:05     ` orc
  2012-08-06  8:46       ` noexecstack Daniel Cegiełka
  1 sibling, 1 reply; 19+ messages in thread
From: orc @ 2012-08-06  8:05 UTC (permalink / raw)
  To: musl

On Mon, 6 Aug 2012 09:16:10 +0200
Daniel Cegiełka <daniel.cegielka@gmail.com> wrote:

> 2012/8/6 orc <orc@sibserver.ru>:
> > On Sun, 5 Aug 2012 23:35:36 +0200
> 
> > Correct me if I'm wrong, but this is ugly stuff.
> >
> > - binutils ld has -z noexecstack command line option.
> > - this (GNU_STACK) is binutils-specific (tinycc, for example, does
> > not generate ELFs with that section, and future direction should be
> > on that plain ELFs without any gnuish extensions IMO)
> > - Kernel sets executable stack by default, kernel can be patched
> > not to do that (that's one line patch per architecture)
> 
> Can you give some example of how to do it? It might be worthwhile to
> introduce it into the main repository of Linux. What do you think?

I used to set it globally for all archs directly in binfmt_elf.c (here
is a patch example):

diff -Naur linux-3.2.12.o/fs/binfmt_elf.c linux-3.2.12/fs/binfmt_elf.c
--- linux-3.2.12.o/fs/binfmt_elf.c	2012-03-20 00:03:17.000000000
+0800 +++ linux-3.2.12/fs/binfmt_elf.c	2012-08-06
15:41:51.774013640 +0800 @@ -571,7 +571,7 @@
 	unsigned long interp_load_addr = 0;
 	unsigned long start_code, end_code, start_data, end_data;
 	unsigned long reloc_func_desc __maybe_unused = 0;
-	int executable_stack = EXSTACK_DEFAULT;
+	int executable_stack = EXSTACK_DISABLE_X;
 	unsigned long def_flags = 0;
 	struct {
 		struct elfhdr elf_ex;

This is a hack, and maybe executable_stack maybe set elsewhere. I did
not tried to trace that code. But it works (of course ELFs marked to be
with execstack will crash).
I think this may have benefits, but it always was controlled in
userspace, kernel defaults to executable stack because there are some
other compilers can be that may rely on this default. I tested tinycc,
it has no any issues (i.e. generates code that does not need executable
stack, and does not generates GNU_STACK extended section)

> 
> > - binutils can be patched to not produce ELFs with executable stack
> > by default
> >
> > While some of options I listed here may harm some GCC or binutils
> > internals (I don't know), I see an utility that comes with
> > grsecurity patches (paxctl) that operates that section (GNU_STACK),
> > converting it into it's own.
> > I tested a system with patched binutils and kernel (but binutils
> > patch here will be enough) without any problems.
> 
> It would be very nice if we could solve this problem in this way. I'm
> currently using this patch, but this is not the best solution in my
> opinion. Ideally if the system (kernel, binutils, libc) enforce
> noexecstack by default... definitely worth look closer at this issue.

Consider this patch as enforcing binutils' noexecstack by default:

diff -Naur binutils-2.17.50.0.17.o/ld/ldmain.c
binutils-2.17.50.0.17/ld/ldmain.c ---
binutils-2.17.50.0.17.o/ld/ldmain.c	2007-06-19
01:31:40.000000000 +0800 +++ binutils-2.17.50.0.17/ld/ldmain.c
2012-08-03 19:59:26.658980680 +0800 @@ -281,6 +281,8 @@
link_info.pei386_auto_import = -1; link_info.spare_dynamic_tags = 5;
   link_info.sharable_sections = FALSE;
+  link_info.execstack = FALSE;
+  link_info.noexecstack = TRUE;
 
   ldfile_add_arch ("");
   emulation = get_emulation (argc, argv);

(this one for binutils 2.17.50.0.17, recent maybe patched with finding
where link_info is initialized and appending this two lines)

GCC generates same .note.GNU-stack section definition in it's asm
output, as seen in your patch, but I don't know when it needs
executable stack and generates another definition.

libc plays no role here at enforcing executable stacks last time I
checked. It does some initialization of memory permissions in dynamic
linker, but better to ask Rich about that code.

Applying kernel patch may render your existing systems unbootable if it
is not glibc system.


If you don't want to patch and rebuild binutils and kernel, then the
best way to enforce noexecstack notes into ELFs is passing this command
line opts:

gcc: gcc -Wl,-z -Wl,noexecstack [the rest here...]
ld: ld -z noexecstack [...]

> Thanks,
> Daniel



^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: noexecstack
  2012-08-06  8:05     ` noexecstack orc
@ 2012-08-06  8:46       ` Daniel Cegiełka
  2012-08-06  9:11         ` noexecstack orc
  0 siblings, 1 reply; 19+ messages in thread
From: Daniel Cegiełka @ 2012-08-06  8:46 UTC (permalink / raw)
  To: musl

2012/8/6 orc <orc@sibserver.ru>:
> On Mon, 6 Aug 2012 09:16:10 +0200
> Daniel Cegiełka <daniel.cegielka@gmail.com> wrote:
>

>> It would be very nice if we could solve this problem in this way. I'm
>> currently using this patch, but this is not the best solution in my
>> opinion. Ideally if the system (kernel, binutils, libc) enforce
>> noexecstack by default... definitely worth look closer at this issue.
>
> Consider this patch as enforcing binutils' noexecstack by default:
>
> diff -Naur binutils-2.17.50.0.17.o/ld/ldmain.c
> binutils-2.17.50.0.17/ld/ldmain.c ---
> binutils-2.17.50.0.17.o/ld/ldmain.c     2007-06-19
> 01:31:40.000000000 +0800 +++ binutils-2.17.50.0.17/ld/ldmain.c
> 2012-08-03 19:59:26.658980680 +0800 @@ -281,6 +281,8 @@
> link_info.pei386_auto_import = -1; link_info.spare_dynamic_tags = 5;
>    link_info.sharable_sections = FALSE;
> +  link_info.execstack = FALSE;
> +  link_info.noexecstack = TRUE;
>
>    ldfile_add_arch ("");
>    emulation = get_emulation (argc, argv);
>
> (this one for binutils 2.17.50.0.17, recent maybe patched with finding
> where link_info is initialized and appending this two lines)
>
> GCC generates same .note.GNU-stack section definition in it's asm
> output, as seen in your patch, but I don't know when it needs
> executable stack and generates another definition.

I'm afraid that this option will not work with .S files. Here is a
comment to this feature:

http://www.cygwin.com/ml/binutils/2003-06/msg00128.html

Here is another patch:

http://sourceware.org/ml/binutils/2003-05/msg00741.html

it's like in the Vasily's patch with stack flags (PF_R | PF_W | PF_X):

http://www.openwall.com/lists/owl-dev/2012/08/05/3

Daniel


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: noexecstack
  2012-08-06  8:46       ` noexecstack Daniel Cegiełka
@ 2012-08-06  9:11         ` orc
  2012-08-06  9:15           ` noexecstack orc
  0 siblings, 1 reply; 19+ messages in thread
From: orc @ 2012-08-06  9:11 UTC (permalink / raw)
  To: musl

On Mon, 6 Aug 2012 10:46:56 +0200
Daniel Cegiełka <daniel.cegielka@gmail.com> wrote:

> 2012/8/6 orc <orc@sibserver.ru>:
> > On Mon, 6 Aug 2012 09:16:10 +0200
> > Daniel Cegiełka <daniel.cegielka@gmail.com> wrote:
> >
> 
> >> It would be very nice if we could solve this problem in this way.
> >> I'm currently using this patch, but this is not the best solution
> >> in my opinion. Ideally if the system (kernel, binutils, libc)
> >> enforce noexecstack by default... definitely worth look closer at
> >> this issue.
> >
> > Consider this patch as enforcing binutils' noexecstack by default:
> >
> > diff -Naur binutils-2.17.50.0.17.o/ld/ldmain.c
> > binutils-2.17.50.0.17/ld/ldmain.c ---
> > binutils-2.17.50.0.17.o/ld/ldmain.c     2007-06-19
> > 01:31:40.000000000 +0800 +++ binutils-2.17.50.0.17/ld/ldmain.c
> > 2012-08-03 19:59:26.658980680 +0800 @@ -281,6 +281,8 @@
> > link_info.pei386_auto_import = -1; link_info.spare_dynamic_tags = 5;
> >    link_info.sharable_sections = FALSE;
> > +  link_info.execstack = FALSE;
> > +  link_info.noexecstack = TRUE;
> >
> >    ldfile_add_arch ("");
> >    emulation = get_emulation (argc, argv);
> >
> > (this one for binutils 2.17.50.0.17, recent maybe patched with
> > finding where link_info is initialized and appending this two lines)
> >
> > GCC generates same .note.GNU-stack section definition in it's asm
> > output, as seen in your patch, but I don't know when it needs
> > executable stack and generates another definition.
> 
> I'm afraid that this option will not work with .S files. Here is a
> comment to this feature:
> 
> http://www.cygwin.com/ml/binutils/2003-06/msg00128.html
> 
> Here is another patch:
> 
> http://sourceware.org/ml/binutils/2003-05/msg00741.html
> 
> it's like in the Vasily's patch with stack flags (PF_R | PF_W | PF_X):
> 
> http://www.openwall.com/lists/owl-dev/2012/08/05/3
> 
> Daniel

It seems that this is under GCC control (NEED_INDICATE_EXEC_STACK
macro, related subroutine in gcc/varasm.c). If .S has no .note.GNU-stack
section definition, than the produced .o file will be clean from it and
it will be task of binutils' ld to decide create executable stack
segment or not.
If you about .S files that are parts of musl, then this patch will be
enough. It is the same of -z noexecstack.

(Ideal situation here is that all the code can work with non-executable
stack and there are no such ugly extensions in ELF)


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: noexecstack
  2012-08-06  9:11         ` noexecstack orc
@ 2012-08-06  9:15           ` orc
  0 siblings, 0 replies; 19+ messages in thread
From: orc @ 2012-08-06  9:15 UTC (permalink / raw)
  To: musl

> it will be task of binutils' ld to decide create executable stack
> segment or not.

Arr, of course binutils will create one, correcting:
*set executable stack flag or not


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: noexecstack
  2012-08-06  6:43   ` noexecstack Szabolcs Nagy
@ 2012-08-06  9:37     ` Rich Felker
  2012-08-06 11:19       ` noexecstack Szabolcs Nagy
  0 siblings, 1 reply; 19+ messages in thread
From: Rich Felker @ 2012-08-06  9:37 UTC (permalink / raw)
  To: musl

On Mon, Aug 06, 2012 at 08:43:06AM +0200, Szabolcs Nagy wrote:
> * Rich Felker <dalias@aerifal.cx> [2012-08-05 17:46:25 -0400]:
> > Yes, but there should be a way to do it without putting ugly stuff
> > like this in every single asm file. Why isn't there a command-line
> > option to the assembler to do it? Or a way to do it globally with
> > objcopy?
> > 
> 
> ld -z noexecstack

This should work for libc.so. Is there a way to do it for all the .o
files in libc.a without having to add the option to every application,
though?

Rich


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: noexecstack
  2012-08-06  9:37     ` noexecstack Rich Felker
@ 2012-08-06 11:19       ` Szabolcs Nagy
  2012-08-06 11:32         ` noexecstack Rich Felker
  0 siblings, 1 reply; 19+ messages in thread
From: Szabolcs Nagy @ 2012-08-06 11:19 UTC (permalink / raw)
  To: musl

* Rich Felker <dalias@aerifal.cx> [2012-08-06 05:37:42 -0400]:
> > ld -z noexecstack
> 
> This should work for libc.so. Is there a way to do it for all the .o
> files in libc.a without having to add the option to every application,
> though?
> 

it seems gnu as has an undocumented --noexecstack flag for this

  gcc -Wa,--noexecstack -c foo.s

adds the .notes.GNU-stack section


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: noexecstack
  2012-08-06 11:19       ` noexecstack Szabolcs Nagy
@ 2012-08-06 11:32         ` Rich Felker
  2012-08-06 21:11           ` noexecstack Kant
  0 siblings, 1 reply; 19+ messages in thread
From: Rich Felker @ 2012-08-06 11:32 UTC (permalink / raw)
  To: musl

On Mon, Aug 06, 2012 at 01:19:19PM +0200, Szabolcs Nagy wrote:
> * Rich Felker <dalias@aerifal.cx> [2012-08-06 05:37:42 -0400]:
> > > ld -z noexecstack
> > This should work for libc.so. Is there a way to do it for all the .o
> > files in libc.a without having to add the option to every application,
> > though?
> 
> it seems gnu as has an undocumented --noexecstack flag for this
> 
>   gcc -Wa,--noexecstack -c foo.s
> 
> adds the .notes.GNU-stack section

So this seems to be the solution. I suspect it will need a configure
check for the option being supported. Any other caveats?

Rich


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: noexecstack
  2012-08-06 11:32         ` noexecstack Rich Felker
@ 2012-08-06 21:11           ` Kant
  2012-10-03 15:54             ` noexecstack Rich Felker
  0 siblings, 1 reply; 19+ messages in thread
From: Kant @ 2012-08-06 21:11 UTC (permalink / raw)
  To: musl

The glibc build is using this. clang also supports this.

Should be okay to use.

On 6 August 2012 13:32, Rich Felker <dalias@aerifal.cx> wrote:
> On Mon, Aug 06, 2012 at 01:19:19PM +0200, Szabolcs Nagy wrote:
>> * Rich Felker <dalias@aerifal.cx> [2012-08-06 05:37:42 -0400]:
>> > > ld -z noexecstack
>> > This should work for libc.so. Is there a way to do it for all the .o
>> > files in libc.a without having to add the option to every application,
>> > though?
>>
>> it seems gnu as has an undocumented --noexecstack flag for this
>>
>>   gcc -Wa,--noexecstack -c foo.s
>>
>> adds the .notes.GNU-stack section
>
> So this seems to be the solution. I suspect it will need a configure
> check for the option being supported. Any other caveats?
>
> Rich


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: noexecstack
  2012-08-06  6:45 ` noexecstack orc
  2012-08-06  7:16   ` noexecstack Daniel Cegiełka
@ 2012-08-07 11:57   ` Vasily Kulikov
  1 sibling, 0 replies; 19+ messages in thread
From: Vasily Kulikov @ 2012-08-07 11:57 UTC (permalink / raw)
  To: musl

Hi,

On Mon, Aug 06, 2012 at 14:45 +0800, orc wrote:
> - this (GNU_STACK) is binutils-specific (tinycc, for example, does not
>   generate ELFs with that section, and future direction should be on
>   that plain ELFs without any gnuish extensions IMO)

I haven't seen any specs for GNU_STACK, but it is used by Linux kernel,
so it is a de facto standard in Linux.

> - Kernel sets executable stack by default, kernel can be patched not to
>   do that (that's one line patch per architecture)

This "default" is a case of absent GNU_STACK in the executable.  This
case is fully handled in my patch.  It will not be present in the
upstream kernel, though.

> - binutils can be patched to not produce ELFs with executable stack by
>   default

As with kernel defaults, upstream binutils is WONTFIX.  Use hardened
kernel/toolchain or set -z,noexecstack (the latter is better unless you
use nested functions or something).

Thanks,

-- 
Vasily Kulikov
http://www.openwall.com - bringing security into open computing environments


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: noexecstack
  2012-08-06 21:11           ` noexecstack Kant
@ 2012-10-03 15:54             ` Rich Felker
  0 siblings, 0 replies; 19+ messages in thread
From: Rich Felker @ 2012-10-03 15:54 UTC (permalink / raw)
  To: musl

On Mon, Aug 06, 2012 at 11:11:33PM +0200, Kant wrote:
> >> it seems gnu as has an undocumented --noexecstack flag for this
> >>
> >>   gcc -Wa,--noexecstack -c foo.s
> >>
> >> adds the .notes.GNU-stack section
> >
> > So this seems to be the solution. I suspect it will need a configure
> > check for the option being supported. Any other caveats?
> >
> > Rich
> The glibc build is using this. clang also supports this.
> 
> Should be okay to use.

Sorry it took a long time to get this fixed -- I completely forgot it
hadn't been done. Just committed to git. Please let me know if there
are any problems, or if you know of other neglected issues like this
one.

Rich


^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2012-10-03 15:54 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-05 21:35 noexecstack Daniel Cegiełka
2012-08-05 21:41 ` noexecstack Anthony G. Basile
2012-08-05 21:46 ` noexecstack Rich Felker
2012-08-05 22:01   ` noexecstack Nathan McSween
2012-08-05 22:45     ` noexecstack Rich Felker
2012-08-06  6:43   ` noexecstack Szabolcs Nagy
2012-08-06  9:37     ` noexecstack Rich Felker
2012-08-06 11:19       ` noexecstack Szabolcs Nagy
2012-08-06 11:32         ` noexecstack Rich Felker
2012-08-06 21:11           ` noexecstack Kant
2012-10-03 15:54             ` noexecstack Rich Felker
2012-08-06  6:45 ` noexecstack orc
2012-08-06  7:16   ` noexecstack Daniel Cegiełka
2012-08-06  7:55     ` noexecstack Justin Cormack
2012-08-06  8:05     ` noexecstack orc
2012-08-06  8:46       ` noexecstack Daniel Cegiełka
2012-08-06  9:11         ` noexecstack orc
2012-08-06  9:15           ` noexecstack orc
2012-08-07 11:57   ` noexecstack Vasily Kulikov

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).