Skip to content

Instantly share code, notes, and snippets.

@tixxdz
Created January 16, 2017 11:59
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 tixxdz/4e6d21071463ad2c5a043984e3efb5a1 to your computer and use it in GitHub Desktop.
Save tixxdz/4e6d21071463ad2c5a043984e3efb5a1 to your computer and use it in GitHub Desktop.
prctl: hidepid test
#include <stdio.h>
#include <unistd.h>
#include <linux/prctl.h>
#include <sys/prctl.h>
int main(int argc, const char **argv)
{
int ret;
char *args[2];
args[0] = "/bin/bash";
args[1] = NULL;
ret = prctl(PR_SET_HIDEPID, 2, 0, 0, 0);
if (ret < 0) {
printf("error on prctl(): %d (%m)\n", ret);
return ret;
}
ret = execve(args[0], args, NULL);
printf("error on execve(): %d (%m)\n", ret);
return ret;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment