Created
February 13, 2017 15:14
-
-
Save tixxdz/eaf4e43d0a2ed6a12b59c2fc54522a77 to your computer and use it in GitHub Desktop.
Test PR_SET_PIDFS_PTRACE_FSCREDS
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_PIDFS_PTRACE_FSCREDS, 1, 0, 0, 0); | |
if (ret < 0) { | |
printf("error on prctl(): %d (%m)\n", ret); | |
return ret; | |
} | |
printf(" ret : %d\n" ); | |
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