00001 /* Verifies that mapping over the code 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 void 00010 test_main (void) 00011 { 00012 uintptr_t test_main_page = ROUND_DOWN ((uintptr_t) test_main, 4096); 00013 int handle; 00014 00015 CHECK ((handle = open ("sample.txt")) > 1, "open \"sample.txt\""); 00016 CHECK (mmap (handle, (void *) test_main_page) == MAP_FAILED, 00017 "try to mmap over code segment"); 00018 } 00019