00001 /* Verifies that mapping over the data segment is disallowed. */ 00002 00003 #include <stdint.h> 00004 #include <round.h> 00005 #include <syscall.h> 00006 #include "tests/lib.h" 00007 #include "tests/main.h" 00008 00009 static char x; 00010 00011 void 00012 test_main (void) 00013 { 00014 uintptr_t x_page = ROUND_DOWN ((uintptr_t) &x, 4096); 00015 int handle; 00016 00017 CHECK ((handle = open ("sample.txt")) > 1, "open \"sample.txt\""); 00018 CHECK (mmap (handle, (void *) x_page) == MAP_FAILED, 00019 "try to mmap over data segment"); 00020 } 00021