Use PROT_MPROTECT() (which would have been better had it been called
PROT_MAXPROTECT or PROT_ALLOWPROTECT or something) on the mmap() call which specifies PROT_NONE, and which we later want to change to PROT_READ, otherwise when PAX is enabled, the mprotect() will fail.
This commit is contained in:
parent
2ca785ae43
commit
70238ca755
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: t_mincore.c,v 1.11 2017/05/23 16:01:46 christos Exp $ */
|
||||
/* $NetBSD: t_mincore.c,v 1.12 2017/09/01 16:27:02 kre Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2011 The NetBSD Foundation, Inc.
|
||||
@ -59,7 +59,7 @@
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#include <sys/cdefs.h>
|
||||
__RCSID("$NetBSD: t_mincore.c,v 1.11 2017/05/23 16:01:46 christos Exp $");
|
||||
__RCSID("$NetBSD: t_mincore.c,v 1.12 2017/09/01 16:27:02 kre Exp $");
|
||||
|
||||
#include <sys/mman.h>
|
||||
#include <sys/stat.h>
|
||||
@ -231,7 +231,8 @@ ATF_TC_BODY(mincore_resid, tc)
|
||||
resident, npgs);
|
||||
|
||||
addr2 = mmap(NULL, npgs * page, PROT_READ, MAP_ANON, -1, (off_t)0);
|
||||
addr3 = mmap(NULL, npgs * page, PROT_NONE, MAP_ANON, -1, (off_t)0);
|
||||
addr3 = mmap(NULL, npgs * page, PROT_MPROTECT(PROT_READ) | PROT_NONE,
|
||||
MAP_ANON, -1, (off_t)0);
|
||||
|
||||
if (addr2 == MAP_FAILED || addr3 == MAP_FAILED)
|
||||
atf_tc_skip("could not mmap more anonymous test pages with "
|
||||
|
Loading…
Reference in New Issue
Block a user