Remove tests for executable/non-executable stack.
These tests were not portable across compilers and recently NetBSD moved to PaX MPROTECT.
This commit is contained in:
parent
523f038f8a
commit
4dd06720f4
|
@ -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
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
|
@ -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);
|
||||
}
|
|
@ -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>
|
|
@ -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);
|
||||
}
|
Loading…
Reference in New Issue