diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2002-07-26 01:20:45 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2002-07-26 01:20:45 +0000 |
commit | c10720d606fc90e3b7f21bb3b9fb10d7333dbef1 (patch) | |
tree | 86c7203b9343ac3078a161aa84f9cab6b51fa8c5 | |
parent | 93455da36d8b432833b472fadf588d8d3cdfd49a (diff) |
check for non-exec of bss
-rw-r--r-- | regress/sys/kern/nxbss/Makefile | 6 | ||||
-rw-r--r-- | regress/sys/kern/nxbss/nxbss.c | 55 |
2 files changed, 61 insertions, 0 deletions
diff --git a/regress/sys/kern/nxbss/Makefile b/regress/sys/kern/nxbss/Makefile new file mode 100644 index 00000000000..cc16d82fde2 --- /dev/null +++ b/regress/sys/kern/nxbss/Makefile @@ -0,0 +1,6 @@ +# $OpenBSD: Makefile,v 1.1 2002/07/26 01:20:44 deraadt Exp $ + +PROG= nxbss +LDSTATIC= ${STATIC} + +.include <bsd.regress.mk> diff --git a/regress/sys/kern/nxbss/nxbss.c b/regress/sys/kern/nxbss/nxbss.c new file mode 100644 index 00000000000..5e6d5ef7c50 --- /dev/null +++ b/regress/sys/kern/nxbss/nxbss.c @@ -0,0 +1,55 @@ +/* $OpenBSD: nxbss.c,v 1.1 2002/07/26 01:20:44 deraadt Exp $ */ + +/* + * Copyright (c) 2002 Michael Shalayeff + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR OR HIS RELATIVES BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF MIND, USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include <stdio.h> +#include <signal.h> +#include <string.h> + +u_int64_t buf[256]; /* assuming the testfly() will fit */ + +void +testfly() +{ +} + +void +sigsegv(int sig) +{ + _exit(0); +} + +int +main(void) +{ + signal(SIGSEGV, sigsegv); + memcpy(buf, &testfly, sizeof(buf)); + ((void (*)(void))&buf)(); + exit(1); +} |