#include #include #include #include #include #include #include int main(int argc, char *argv[]) { void *map; map = mmap(NULL, 4096, PROT_WRITE|PROT_READ, MAP_SHARED|MAP_ANON, -1, 0); if (map == (void *)MAP_FAILED && errno) { perror("mmap"); exit(1); } if (mprotect(map, 4096, PROT_EXEC)) { perror("mprotect"); exit(1); } return (0); }