Advertisement
Guest User

Untitled

a guest
Feb 6th, 2016
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <sys/mman.h>
  3. #include <malloc.h>
  4. #include <unistd.h>
  5.  
  6. void main()
  7. {
  8. int pagesize;
  9. pagesize = getpagesize();
  10. void *p;
  11. p = malloc(pagesize);
  12. getchar();
  13. int q = posix_memalign(&p, pagesize, pagesize);
  14. getchar();
  15. int a = mprotect(p, pagesize, PROT_READ | PROT_WRITE | PROT_EXEC);
  16. getchar();
  17. free(p);
  18. }
  19.  
  20. 01776000-01798000 rw-p 00000000 00:00 0 [heap]
  21.  
  22. 01776000-01778000 rw-p 00000000 00:00 0 [heap]
  23. 01778000-01779000 rwxp 00000000 00:00 0 [heap]
  24. 01779000-01798000 rw-p 00000000 00:00 0 [heap]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement