diff options
author | ngie <ngie@FreeBSD.org> | 2016-12-03 02:47:16 +0000 |
---|---|---|
committer | ngie <ngie@FreeBSD.org> | 2016-12-03 02:47:16 +0000 |
commit | 29db3b90328498474388e9cfb2c8ef6d816c05c2 (patch) | |
tree | 91ac81530a80d5ea64a24212d143cb2012f49a0a /contrib/netbsd-tests/lib/libc/sys/t_mprotect.c | |
parent | 8408238ce58163c0d88dea333c155b6806aae830 (diff) | |
download | FreeBSD-src-29db3b90328498474388e9cfb2c8ef6d816c05c2.zip FreeBSD-src-29db3b90328498474388e9cfb2c8ef6d816c05c2.tar.gz |
MFC r305358:
Update contrib/netbsd-tests with new content from NetBSD
This updates the snapshot from 09/30/2014 to 08/11/2016
This brings in a number of new testcases from upstream, most
notably:
- bin/cat
- lib/libc
- lib/msun
- lib/libthr
- usr.bin/sort
lib/libc/tests/stdio/open_memstream_test.c was moved to
lib/libc/tests/stdio/open_memstream2_test.c to accomodate
the new open_memstream test from NetBSD.
Tested on: amd64 (VMware fusion VM; various bare metal platforms); i386 (VMware fusion VM); make tinderbox
Diffstat (limited to 'contrib/netbsd-tests/lib/libc/sys/t_mprotect.c')
-rw-r--r-- | contrib/netbsd-tests/lib/libc/sys/t_mprotect.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/contrib/netbsd-tests/lib/libc/sys/t_mprotect.c b/contrib/netbsd-tests/lib/libc/sys/t_mprotect.c index ee345aa..5dc3eae 100644 --- a/contrib/netbsd-tests/lib/libc/sys/t_mprotect.c +++ b/contrib/netbsd-tests/lib/libc/sys/t_mprotect.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_mprotect.c,v 1.3 2011/07/20 22:53:44 jym Exp $ */ +/* $NetBSD: t_mprotect.c,v 1.4 2016/05/28 14:34:49 christos Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -29,7 +29,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include <sys/cdefs.h> -__RCSID("$NetBSD: t_mprotect.c,v 1.3 2011/07/20 22:53:44 jym Exp $"); +__RCSID("$NetBSD: t_mprotect.c,v 1.4 2016/05/28 14:34:49 christos Exp $"); #include <sys/param.h> #include <sys/mman.h> @@ -78,10 +78,7 @@ paxinit(void) rv = sysctlbyname("security.pax.mprotect.enabled", &pax_enabled, &len, NULL, 0); - if (rv != 0) - return false; - - return paxset(1, 1); + return rv == 0; } static bool @@ -194,6 +191,12 @@ ATF_TC_BODY(mprotect_exec, tc) break; } + if (!paxinit()) + return; + if (pax_enabled == 1 && pax_global == 1) + atf_tc_skip("PaX MPROTECT restrictions enabled"); + + /* * Map a page read/write and copy a trivial assembly function inside. * We will then change the mapping rights: @@ -262,7 +265,7 @@ ATF_TC_BODY(mprotect_pax, tc) size_t i; int rv; - if (paxinit() != true) + if (!paxinit() || !paxset(1, 1)) return; /* |