Skip to content

Instantly share code, notes, and snippets.

@Leandros
Created April 30, 2018 19:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Leandros/9bcda9358b0d3b8ae9d36277bb411115 to your computer and use it in GitHub Desktop.
Save Leandros/9bcda9358b0d3b8ae9d36277bb411115 to your computer and use it in GitHub Desktop.
#include <sys/mman.h>
#include <stdio.h>
int main(void)
{
int *map = mmap(
0,
4096,
PROT_READ|PROT_WRITE|PROT_EXEC,
MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS,
-1,
0);
*map = 42;
printf("%p %d %d\n", map, *map, *(int *)0);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment