Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
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