Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <sys/mman.h>
- #include <malloc.h>
- #include <unistd.h>
- void main()
- {
- int pagesize;
- pagesize = getpagesize();
- void *p;
- p = malloc(pagesize);
- getchar();
- int q = posix_memalign(&p, pagesize, pagesize);
- getchar();
- int a = mprotect(p, pagesize, PROT_READ | PROT_WRITE | PROT_EXEC);
- getchar();
- free(p);
- }
- 01776000-01798000 rw-p 00000000 00:00 0 [heap]
- 01776000-01778000 rw-p 00000000 00:00 0 [heap]
- 01778000-01779000 rwxp 00000000 00:00 0 [heap]
- 01779000-01798000 rw-p 00000000 00:00 0 [heap]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement