1
0
Fork 0
mirror of https://github.com/tobast/libunwind-eh_elf.git synced 2024-05-05 14:25:16 +02:00

Mark Wielaard <mwielaard@redhat.com> writes:

On some systems executable stacks are denied. Since libunwind and the
tests don't actually need executable stacks this patch marks all
assembly files as not needing it.

The original patch comes from frysk:

2007-04-05  Jan Kratochvil  <jan.kratochvil@redhat.com>

    * src/hppa/getcontext.S, src/hppa/setcontext.S, src/hppa/siglongjmp.S,
    src/ia64/Ginstall_cursor.S, src/ia64/Linstall_cursor.S,
    src/ia64/dyn_info_list.S, src/ia64/getcontext.S, src/ia64/longjmp.S,
    src/ia64/setjmp.S, src/ia64/siglongjmp.S, src/ia64/sigsetjmp.S,
    src/ppc64/longjmp.S, src/ppc64/siglongjmp.S, src/x86/longjmp.S,
    src/x86/siglongjmp.S, src/x86_64/longjmp.S, src/x86_64/setcontext.S,
    src/x86_64/siglongjmp.S: Stack should be non-executable, for SELinux.

I added a couple more markers for new files in current libunwind.

Before this patch you would get the following on selinux enabled
systems without allow_exec_stack: error while loading shared
libraries:

libunwind.so.7: cannot enable executable stack as shared object
	requires: Permission denied

After the patch that error disappears and all test results are similar
to the results on systems without executable stack protection.
This commit is contained in:
Jan Kratochvil 2007-10-01 08:35:01 -06:00 committed by David Mosberger-Tang
parent c340d04279
commit 57e5696463
26 changed files with 114 additions and 0 deletions

View file

@ -68,3 +68,7 @@ _Uhppa_getcontext:
bv,n %r0(%rp)
.procend
#ifdef __linux__
/* We do not need executable stack. */
.section .note.GNU-stack,"",@progbits
#endif

View file

@ -71,3 +71,7 @@ _Uhppa_setcontext:
bv,n %r0(%rp)
.procend
#ifdef __linux__
/* We do not need executable stack. */
.section .note.GNU-stack,"",@progbits
#endif

View file

@ -10,3 +10,7 @@ _UI_longjmp_cont:
#warning fix me
bv %r0(%rp)
.procend
#ifdef __linux__
/* We do not need executable stack. */
.section .note.GNU-stack,"",@progbits
#endif

View file

@ -342,3 +342,7 @@ ia64_install_cursor:
.endp ia64_install_cursor
#endif /* !UNW_REMOTE_ONLY */
#ifdef __linux__
/* We do not need executable stack. */
.section .note.GNU-stack,"",@progbits
#endif

View file

@ -1,2 +1,6 @@
#define UNW_LOCAL_ONLY
#include "Ginstall_cursor.S"
#ifdef __linux__
/* We do not need executable stack. */
.section .note.GNU-stack,"",@progbits
#endif

View file

@ -20,3 +20,7 @@
data8 0, 0, @segrel(.info)
#endif
#ifdef __linux__
/* We do not need executable stack. */
.section .note.GNU-stack,"",@progbits
#endif

View file

@ -171,3 +171,7 @@ _Uia64_getcontext:
mov r8 = 0
br.ret.sptk.many rp
.endp _Uia64_getcontext
#ifdef __linux__
/* We do not need executable stack. */
.section .note.GNU-stack,"",@progbits
#endif

View file

@ -36,3 +36,7 @@ _UI_longjmp_cont: // non-function label for {sig,}longjmp.c
mov r8 = r16
br.sptk.many rp
.endp longjmp_continuation
#ifdef __linux__
/* We do not need executable stack. */
.section .note.GNU-stack,"",@progbits
#endif

View file

@ -45,3 +45,7 @@ _setjmp:
br.ret.sptk.many rp
.endp _setjmp
#ifdef __linux__
/* We do not need executable stack. */
.section .note.GNU-stack,"",@progbits
#endif

View file

@ -63,3 +63,7 @@ _UI_siglongjmp_cont: // non-function label for siglongjmp.c
mov r8 = loc2
br.ret.sptk.many rp
.endp siglongjmp_continuation
#ifdef __linux__
/* We do not need executable stack. */
.section .note.GNU-stack,"",@progbits
#endif

View file

@ -63,3 +63,7 @@ __sigsetjmp:
br.ret.sptk.many rp
.endp __sigsetjmp
#ifdef __linux__
/* We do not need executable stack. */
.section .note.GNU-stack,"",@progbits
#endif

View file

@ -29,3 +29,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
.type _UI_longjmp_cont, @function
_UI_longjmp_cont:
.size _UI_longjmp_cont, .-_UI_longjmp_cont
#ifdef __linux__
/* We do not need executable stack. */
.section .note.GNU-stack,"",@progbits
#endif

View file

@ -24,3 +24,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
.globl _UI_siglongjmp_cont
_UI_siglongjmp_cont:
#ifdef __linux__
/* We do not need executable stack. */
.section .note.GNU-stack,"",@progbits
#endif

View file

@ -2,3 +2,8 @@
_UI_setcontext:
retq
#ifdef __linux__
/* We do not need executable stack. */
.section .note.GNU-stack,"",@progbits
#endif

View file

@ -2,3 +2,8 @@
_UI_setcontext:
retq
#ifdef __linux__
/* We do not need executable stack. */
.section .note.GNU-stack,"",@progbits
#endif

View file

@ -35,3 +35,7 @@ _UI_longjmp_cont:
ret
.cfi_endproc
.size _UI_siglongjmp_cont, .-_UI_longjmp_cont
#ifdef __linux__
/* We do not need executable stack. */
.section .note.GNU-stack,"",@progbits
#endif

View file

@ -66,3 +66,7 @@ _UI_siglongjmp_cont:
jmp *%edx
.cfi_endproc
.size _UI_siglongjmp_cont, .-_UI_siglongjmp_cont
#ifdef __linux__
/* We do not need executable stack. */
.section .note.GNU-stack,"",@progbits
#endif

View file

@ -31,3 +31,7 @@ _UI_longjmp_cont:
mov %rdx, %rax /* set up return-value */
retq
.size _UI_longjmp_cont, .-_UI_longjmp_cont
#ifdef __linux__
/* We do not need executable stack. */
.section .note.GNU-stack,"",@progbits
#endif

View file

@ -57,3 +57,7 @@ _x86_64_setcontext:
mov REG_OFFSET_RDI(%rdi),%rdi
retq
#ifdef __linux__
/* We do not need executable stack. */
.section .note.GNU-stack,"",@progbits
#endif

View file

@ -27,3 +27,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
_UI_siglongjmp_cont:
retq
#ifdef __linux__
/* We do not need executable stack. */
.section .note.GNU-stack,"",@progbits
#endif

View file

@ -69,3 +69,8 @@ flush_cache:
#else
# error Need flush_cache code for this architecture.
#endif
#ifdef __linux__
/* We do not need executable stack. */
.section .note.GNU-stack,"",@progbits
#endif

View file

@ -95,3 +95,8 @@ func_vframe:
}
func_vframe_end:
.endp func_vframe
#ifdef __linux__
/* We do not need executable stack. */
.section .note.GNU-stack,"",@progbits
#endif

View file

@ -501,3 +501,8 @@ save_pr:
br.ret.sptk.many rp
.endp save_pr
#ifdef __linux__
/* We do not need executable stack. */
.section .note.GNU-stack,"",@progbits
#endif

View file

@ -268,3 +268,8 @@ resumption_point_label:
;;
br.cond.sptk.many b6
.endp resumption_point
#ifdef __linux__
/* We do not need executable stack. */
.section .note.GNU-stack,"",@progbits
#endif

View file

@ -48,3 +48,8 @@ test_func:
br.ret.sptk.many rp
.endp test_func
#ifdef __linux__
/* We do not need executable stack. */
.section .note.GNU-stack,"",@progbits
#endif

View file

@ -176,3 +176,8 @@ touch_all:
mov ar.pfs = loc1
br.ret.sptk.many rp
.endp touch_all
#ifdef __linux__
/* We do not need executable stack. */
.section .note.GNU-stack,"",@progbits
#endif