4 #include <linux/filter.h>
5 #include <linux/seccomp.h>
10 /* install fake seccomp program to enable seccomp code path inside the kernel,
11 * so that our kprobe attached to seccomp_phase1() can be triggered
13 static void install_accept_all_seccomp(void)
15 struct sock_filter filter[] = {
16 BPF_STMT(BPF_RET+BPF_K, SECCOMP_RET_ALLOW),
18 struct sock_fprog prog = {
19 .len = (unsigned short)(sizeof(filter)/sizeof(filter[0])),
22 if (prctl(PR_SET_SECCOMP, 2, &prog))
26 int main(int ac, char **argv)
31 snprintf(filename, sizeof(filename), "%s_kern.o", argv[0]);
33 if (load_bpf_file(filename)) {
34 printf("%s", bpf_log_buf);
38 install_accept_all_seccomp();
40 f = popen("dd if=/dev/zero of=/dev/null count=5", "r");