Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/tests/lib/libc/sys Skip the mprotect_exec test if PaX MPROTE...
details: https://anonhg.NetBSD.org/src/rev/2d8589f17bcd
branches: trunk
changeset: 345441:2d8589f17bcd
user: christos <christos%NetBSD.org@localhost>
date: Sat May 28 14:34:49 2016 +0000
description:
Skip the mprotect_exec test if PaX MPROTECT restrictions are enabled.
diffstat:
tests/lib/libc/sys/t_mprotect.c | 17 ++++++++++-------
1 files changed, 10 insertions(+), 7 deletions(-)
diffs (52 lines):
diff -r 368d49c2bae1 -r 2d8589f17bcd tests/lib/libc/sys/t_mprotect.c
--- a/tests/lib/libc/sys/t_mprotect.c Sat May 28 09:03:16 2016 +0000
+++ b/tests/lib/libc/sys/t_mprotect.c Sat May 28 14:34:49 2016 +0000
@@ -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>
@@ -76,10 +76,7 @@
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
@@ -191,6 +188,12 @@
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:
@@ -258,7 +261,7 @@
size_t i;
int rv;
- if (paxinit() != true)
+ if (!paxinit() || !paxset(1, 1))
return;
/*
Home |
Main Index |
Thread Index |
Old Index