Skip to content

Instantly share code, notes, and snippets.

@ajungren
Created October 29, 2013 15:01
Show Gist options
  • Save ajungren/7216336 to your computer and use it in GitHub Desktop.
Save ajungren/7216336 to your computer and use it in GitHub Desktop.
Toggle the PR_GET_DUMPABLE flag
#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