Created
August 15, 2013 17:03
-
-
Save azet/6242543 to your computer and use it in GitHub Desktop.
just testing SECCOMP kernel feature. apparently this really works :)
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 <errno.h> | |
#include <unistd.h> | |
#include <sys/prctl.h> | |
void main(int argc) { | |
printf("-- SECCOMP Test --\n\n"); | |
if(prctl(PR_SET_SECCOMP, 1, 0, 0) == 0) | |
printf("[+]\tSECCOMP (via prctl(2)): ON\n"); | |
int loop = argc - 1; | |
do { | |
if(access("/proc/self/numa_maps", R_OK) == 0) | |
printf("[-]\tcould use access(2) on /proc!\n"); | |
if(fopen("/etc/passwd", "r") != 0) | |
printf("[-]\tcould fopen(3) /etc/passwd!\n"); | |
} while(loop); | |
} |
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
write(1, "-- SECCOMP Test --\n", 22-- SECCOMP Test -- | |
) = 22 | |
write(1, "\n", 1 | |
) = 1 | |
prctl(PR_SET_SECCOMP, 0x1, 0, 0, 0xffffffff) = 0 | |
write(1, "[+]\tSECCOMP (via prctl(2)): ON\n", 31[+] SECCOMP (via prctl(2)): ON | |
) = 31 | |
+++ killed by SIGKILL +++ | |
zsh: killed strace ./a.out |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment