aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Capper <steve.capper@linaro.org>2013-06-03 17:00:45 +0100
committerSteve Capper <steve.capper@linaro.org>2013-09-10 11:57:45 +0100
commitf7417cf83fc22ba512fb88a10e31ca8365bbc9f0 (patch)
tree7c937395c031c655a989bd56e4b9da4b8c1c3ce7
parent7d4a0fcbf668e2a6926626eeef3797990605ddba (diff)
downloadlibhugetlbfs-f7417cf83fc22ba512fb88a10e31ca8365bbc9f0.tar.gz
Add PROT_NONE to the mprotect test.
The mprotect unit test checks PROT_READ and PROT_READ | PROT_WRITE protections. We recently found that PROT_NONE wasn't properly supported in an early version of our huge page kernel code. This patch adds PROT_NONE tests to mprotect. The expected behaviour is that neither reads nor writes should succeed. Signed-off-by: Steve Capper <steve.capper@linaro.org>
-rw-r--r--tests/mprotect.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/mprotect.c b/tests/mprotect.c
index aa4673e..db6a662 100644
--- a/tests/mprotect.c
+++ b/tests/mprotect.c
@@ -213,5 +213,11 @@ int main(int argc, char *argv[])
test_mprotect(fd, "RW->R 1/2", 2*hpage_size, PROT_READ|PROT_WRITE,
hpage_size, PROT_READ);
+ /* PROT_NONE tests */
+ test_mprotect(fd, "NONE->R", hpage_size, PROT_NONE,
+ hpage_size, PROT_READ);
+ test_mprotect(fd, "NONE->RW", hpage_size, PROT_NONE,
+ hpage_size, PROT_READ|PROT_WRITE);
+
PASS();
}