Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/regress/sys Remove tests for executable/non-executable stack.



details:   https://anonhg.NetBSD.org/src/rev/0434364552e5
branches:  trunk
changeset: 353602:0434364552e5
user:      kamil <kamil%NetBSD.org@localhost>
date:      Sun May 14 04:17:25 2017 +0000

description:
Remove tests for executable/non-executable stack.

These tests were not portable across compilers and recently NetBSD moved
to PaX MPROTECT.

diffstat:

 regress/sys/Makefile                     |   4 +-
 regress/sys/uvm/Makefile                 |  16 +-------
 regress/sys/uvm/stack_exec/Makefile      |  17 --------
 regress/sys/uvm/stack_exec/tramptest.c   |  44 -----------------------
 regress/sys/uvm/stack_noexec/Makefile    |  28 --------------
 regress/sys/uvm/stack_noexec/tramptest.c |  61 --------------------------------
 6 files changed, 3 insertions(+), 167 deletions(-)

diffs (204 lines):

diff -r d81d8bb30e29 -r 0434364552e5 regress/sys/Makefile
--- a/regress/sys/Makefile      Sun May 14 04:01:10 2017 +0000
+++ b/regress/sys/Makefile      Sun May 14 04:17:25 2017 +0000
@@ -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 -r d81d8bb30e29 -r 0434364552e5 regress/sys/uvm/Makefile
--- a/regress/sys/uvm/Makefile  Sun May 14 04:01:10 2017 +0000
+++ b/regress/sys/uvm/Makefile  Sun May 14 04:17:25 2017 +0000
@@ -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 -r d81d8bb30e29 -r 0434364552e5 regress/sys/uvm/stack_exec/Makefile
--- a/regress/sys/uvm/stack_exec/Makefile       Sun May 14 04:01:10 2017 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -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 -r d81d8bb30e29 -r 0434364552e5 regress/sys/uvm/stack_exec/tramptest.c
--- a/regress/sys/uvm/stack_exec/tramptest.c    Sun May 14 04:01:10 2017 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -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 -r d81d8bb30e29 -r 0434364552e5 regress/sys/uvm/stack_noexec/Makefile
--- a/regress/sys/uvm/stack_noexec/Makefile     Sun May 14 04:01:10 2017 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -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 -r d81d8bb30e29 -r 0434364552e5 regress/sys/uvm/stack_noexec/tramptest.c
--- a/regress/sys/uvm/stack_noexec/tramptest.c  Sun May 14 04:01:10 2017 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -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);
-}



Home | Main Index | Thread Index | Old Index