Created
August 11, 2022 00:50
-
-
Save iximeow/a663add82dd5305879499419156ff5be to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <assert.h> | |
#include <stdio.h> | |
#include <sys/mman.h> | |
#include <sys/types.h> | |
#include <fcntl.h> | |
int main() { | |
int fd = open("doesnotexist", O_CREAT); | |
assert(fd > 0); | |
void* map = mmap(NULL, 65536, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0); | |
assert((long long)map != -1); | |
((char*)map)[4095] = 1; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment