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.cap...@linaro.org>
---
 tests/mprotect.c | 6 ++++++
 1 file changed, 6 insertions(+)

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();
 }
-- 
1.8.1.4


------------------------------------------------------------------------------
How ServiceNow helps IT people transform IT departments:
1. Consolidate legacy IT systems to a single system of record for IT
2. Standardize and globalize service processes across IT
3. Implement zero-touch automation to replace manual, redundant tasks
http://pubads.g.doubleclick.net/gampad/clk?id=51271111&iu=/4140/ostg.clktrk
_______________________________________________
Libhugetlbfs-devel mailing list
Libhugetlbfs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libhugetlbfs-devel

Reply via email to