diff options
| author | kamil <kamil@NetBSD.org> | 2017-05-14 04:17:25 +0000 |
|---|---|---|
| committer | kamil <kamil@NetBSD.org> | 2017-05-14 04:17:25 +0000 |
| commit | a5068a178b573bbb635196225528ab8551cfe77a (patch) | |
| tree | 6f2c68c91b24208ddc9b017a9cd5c9d3c8b7ea66 /regress | |
| parent | 7dea4c6d75d1a57c29f1538acc9b2f4de3302c7e (diff) | |
Remove tests for executable/non-executable stack.
These tests were not portable across compilers and recently NetBSD moved
to PaX MPROTECT.
Diffstat (limited to 'regress')
| -rw-r--r-- | regress/sys/Makefile | 4 | ||||
| -rw-r--r-- | regress/sys/uvm/Makefile | 16 | ||||
| -rw-r--r-- | regress/sys/uvm/stack_exec/Makefile | 17 | ||||
| -rw-r--r-- | regress/sys/uvm/stack_exec/tramptest.c | 44 | ||||
| -rw-r--r-- | regress/sys/uvm/stack_noexec/Makefile | 28 | ||||
| -rw-r--r-- | regress/sys/uvm/stack_noexec/tramptest.c | 61 |
6 files changed, 3 insertions, 167 deletions
diff --git a/regress/sys/Makefile b/regress/sys/Makefile index f231db59d93..d7954db9abc 100644 --- a/regress/sys/Makefile +++ b/regress/sys/Makefile @@ -1,8 +1,8 @@ -# $NetBSD: Makefile,v 1.14 2017/05/14 03:50:42 kamil Exp $ +# $NetBSD: Makefile,v 1.15 2017/05/14 04:17:25 kamil Exp $ .include <bsd.own.mk> -SUBDIR= kern fs uvm +SUBDIR= kern fs .if exists(arch/${MACHINE}/Makefile) SUBDIR+= arch/${MACHINE} .endif diff --git a/regress/sys/uvm/Makefile b/regress/sys/uvm/Makefile index fbab3a29303..6fcc7dfdb74 100644 --- a/regress/sys/uvm/Makefile +++ b/regress/sys/uvm/Makefile @@ -1,19 +1,5 @@ -# $NetBSD: Makefile,v 1.10 2011/07/14 11:08:44 jruoho Exp $ +# $NetBSD: Makefile,v 1.11 2017/05/14 04:17:25 kamil Exp $ .include <bsd.own.mk> -.if !empty(SUPPORTED_CC:Mgcc) -SUBDIR+= stack_exec -.endif - -# -# Test for no-executable stack; applies only to architectures -# where CPU and kernel support it. -# -STACKNOX_ARCHS= alpha i386 powerpc sparc sparc64 x86_64 - -.if !empty(SUPPORTED_CC:Mgcc) && !empty(STACKNOX_ARCHS:M${MACHINE_ARCH}) -SUBDIR+= stack_noexec -.endif - .include <bsd.subdir.mk> diff --git a/regress/sys/uvm/stack_exec/Makefile b/regress/sys/uvm/stack_exec/Makefile deleted file mode 100644 index 3c9eed2cc8b..00000000000 --- a/regress/sys/uvm/stack_exec/Makefile +++ /dev/null @@ -1,17 +0,0 @@ -# $NetBSD: Makefile,v 1.3 2011/05/20 13:36:12 joerg Exp $ - -NOMAN= # -PROG= tramptest -LDADD= -lpthread - -UNSUPPORTED_COMPILER.clang= -UNSUPPORTED_COMPILER.pcc= - -regress: ${PROG} - @if ./tramptest; then \ - echo "PASSED"; \ - else \ - echo "FAILED"; \ - fi - -.include <bsd.prog.mk> diff --git a/regress/sys/uvm/stack_exec/tramptest.c b/regress/sys/uvm/stack_exec/tramptest.c deleted file mode 100644 index 2ccfb8d187e..00000000000 --- a/regress/sys/uvm/stack_exec/tramptest.c +++ /dev/null @@ -1,44 +0,0 @@ -/* $NetBSD: tramptest.c,v 1.1 2003/12/10 13:24:59 drochner Exp $ */ - -#include <stdlib.h> -#include <pthread.h> -#include <signal.h> - -/* - * This test checks whether processes/threads get execute permission - * on the stack if needed, in particular for multiple threads. - * It depends on the fact that gcc puts trampoline code for - * nested functions on the stack and requests execution permission - * for that address internally, at least on some architectures. - * (On the other architectures, the test is just insignificant.) - * Actually, it would be better if gcc wouldn't use stack trampolines, - * at all, but for now it allows for an easy portable check whether the - * kernel handles permissions correctly. - */ - -void -buserr(int s) -{ - - exit(1); -} - -int -main() -{ - pthread_t t1, t2; - - void *mist(void *p) - { - - return (0); - } - - signal(SIGBUS, buserr); - - pthread_create(&t1, 0, mist, 0); - pthread_create(&t2, 0, mist, 0); - pthread_join(t1, 0); - pthread_join(t2, 0); - exit(0); -} diff --git a/regress/sys/uvm/stack_noexec/Makefile b/regress/sys/uvm/stack_noexec/Makefile deleted file mode 100644 index cf19a6a827b..00000000000 --- a/regress/sys/uvm/stack_noexec/Makefile +++ /dev/null @@ -1,28 +0,0 @@ -# $NetBSD: Makefile,v 1.4 2011/05/20 13:36:12 joerg Exp $ - -NOMAN= # - -UNSUPPORTED_COMPILER.clang= -UNSUPPORTED_COMPILER.pcc= - -.include <bsd.own.mk> -# -# tramptest.c relies on a trampoline generated by gcc, -# which happens for the following architectures: -# -GCCTRAMP_ARCHS= alpha arm i386 m68k mips sparc sparc64 vax x86_64 - -.if !empty(GCCTRAMP_ARCHS:M${MACHINE_GNU_ARCH}) -PROG= tramptest -regress: ${PROG} - @if ./tramptest; then \ - echo "PASSED"; \ - else \ - echo "FAILED"; \ - fi -.else -# XXX need another test program -regress: -.endif - -.include <bsd.prog.mk> diff --git a/regress/sys/uvm/stack_noexec/tramptest.c b/regress/sys/uvm/stack_noexec/tramptest.c deleted file mode 100644 index 8abb624909a..00000000000 --- a/regress/sys/uvm/stack_noexec/tramptest.c +++ /dev/null @@ -1,61 +0,0 @@ -/* $NetBSD: tramptest.c,v 1.2 2004/02/19 16:49:43 drochner Exp $ */ - -#include <stdlib.h> -#include <signal.h> - -/* - * This test checks that the stack has no execute permission. - * It depends on the fact that gcc puts trampoline code for - * nested functions on the stack, at least on some architectures. - * (On the other architectures, the test will fail, as on platforms - * where execution permissions cannot be controlled.) - * Actually, it would be better if gcc wouldn't use stack trampolines, - * at all, but for now it allows for an easy portable check whether the - * stack is executable. - */ - -void -__enable_execute_stack() -{ - /* replace gcc's internal function by a noop */ -} - -void -buserr(int s, siginfo_t *si, void *ctx) -{ - - if (s != SIGSEGV || si->si_code != SEGV_ACCERR) - exit(2); - - exit(0); -} - -void (*f)(void); - -void do_f() -{ - - (*f)(); -} - -int -main() -{ - struct sigaction sa; - - void mist() - { - - return; - } - - sa.sa_sigaction = buserr; - sigemptyset(&sa.sa_mask); - sa.sa_flags = SA_SIGINFO; - sigaction(SIGSEGV, &sa, 0); - - f = mist; - do_f(); - - exit(1); -} |
