Created
January 16, 2017 11:59
-
-
Save tixxdz/4e6d21071463ad2c5a043984e3efb5a1 to your computer and use it in GitHub Desktop.
prctl: hidepid test
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 <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