Last active
September 28, 2021 10:46
-
-
Save ryo/4d402b0dd2323fe5cd9357f49caf728d to your computer and use it in GitHub Desktop.
This file contains 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 <stdio.h> | |
#include <unistd.h> | |
#include <sys/mman.h> | |
#include <sys/syscall.h> | |
#include <sys/futex.h> | |
#include <sys/wait.h> | |
int | |
main(int argc, char *argv[]) | |
{ | |
u_long *p = mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_ANONYMOUS, -1, 0); | |
syscall(SYS___futex_set_robust_list, p, _FUTEX_ROBUST_HEAD_SIZE); | |
#if 1 | |
execl("/bin/ls", "ls", NULL); | |
#else | |
munmap(p, 4096); | |
#endif | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment