Created
October 29, 2013 15:01
-
-
Save ajungren/7216336 to your computer and use it in GitHub Desktop.
Toggle the PR_GET_DUMPABLE flag
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 <sys/prctl.h> | |
int main(int argc, char **argv) { | |
int dumpable; | |
while(1) { | |
dumpable = prctl(PR_GET_DUMPABLE); | |
printf("The process currently %s dumpable. Press any key to %s dumping.", dumpable ? "is" : "isn't", dumpable ? "disable" : "enable"); | |
getchar(); | |
prctl(PR_SET_DUMPABLE, dumpable ? 0 : 1); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment