#include <stdio.h> #include <linux/bpf.h> #include <unistd.h> #include <linux/filter.h> #include <linux/seccomp.h> #include <sys/prctl.h> #include "libbpf.h" #include "bpf_load.h" #include <sys/resource.h> /* install fake seccomp program to enable seccomp code path inside the kernel, * so that our kprobe attached to seccomp_phase1() can be triggered */ static void install_accept_all_seccomp(void) { struct sock_filter filter[] = { BPF_STMT(BPF_RET+BPF_K, SECCOMP_RET_ALLOW), }; struct sock_fprog prog = { .len = (unsigned short)(sizeof(filter)/sizeof(filter[0])), .filter = filter, }; if (prctl(PR_SET_SECCOMP, 2, &prog)) perror("prctl"); } int main(int ac, char **argv) { FILE *f; char filename[256]; struct rlimit r = {RLIM_INFINITY, RLIM_INFINITY}; snprintf(filename, sizeof(filename), "%s_kern.o", argv[0]); setrlimit(RLIMIT_MEMLOCK, &r); if (load_bpf_file(filename)) { printf("%s", bpf_log_buf); return 1; } install_accept_all_seccomp(); f = popen("dd if=/dev/zero of=/dev/null count=5", "r"); (void) f; read_trace_pipe(); return 0; } '>master</option> <option value='nds-private-remove'>nds-private-remove</option> <option value='packet-loop-back'>packet-loop-back</option> <option value='packet-rx-pump-back'>packet-rx-pump-back</option> </select> <input type='submit' value='switch'/></form></td></tr> <tr><td class='sub'>net-next plumbings</td><td class='sub right'>Tobias Klauser</td></tr></table> <table class='tabs'><tr><td> <a href='/cgit.cgi/linux/net-next.git/'>summary</a><a href='/cgit.cgi/linux/net-next.git/refs/?id=508aac6dee025f93eab1e806d20762ea6327b43d'>refs</a><a class='active' href='/cgit.cgi/linux/net-next.git/log/include/crypto/drbg.h'>log</a><a href='/cgit.cgi/linux/net-next.git/tree/include/crypto/drbg.h?id=508aac6dee025f93eab1e806d20762ea6327b43d'>tree</a><a href='/cgit.cgi/linux/net-next.git/commit/include/crypto/drbg.h?id=508aac6dee025f93eab1e806d20762ea6327b43d'>commit</a><a href='/cgit.cgi/linux/net-next.git/diff/include/crypto/drbg.h?id=508aac6dee025f93eab1e806d20762ea6327b43d'>diff</a></td><td class='form'><form class='right' method='get' action='/cgit.cgi/linux/net-next.git/log/include/crypto/drbg.h'> <input type='hidden' name='id' value='508aac6dee025f93eab1e806d20762ea6327b43d'/><select name='qt'> <option value='grep'>log msg</option> <option value='author'>author</option> <option value='committer'>committer</option> <option value='range'>range</option> </select> <input class='txt' type='search' size='10' name='q' value=''/> <input type='submit' value='search'/> </form> </td></tr></table> <div class='path'>path: <a href='/cgit.cgi/linux/net-next.git/log/?id=508aac6dee025f93eab1e806d20762ea6327b43d'>root</a>/<a href='/cgit.cgi/linux/net-next.git/log/include?id=508aac6dee025f93eab1e806d20762ea6327b43d'>include</a>/<a href='/cgit.cgi/linux/net-next.git/log/include/crypto?id=508aac6dee025f93eab1e806d20762ea6327b43d'>crypto</a>/<a href='/cgit.cgi/linux/net-next.git/log/include/crypto/drbg.h?id=508aac6dee025f93eab1e806d20762ea6327b43d'>drbg.h</a></div><div class='content'><table class='list nowrap'><tr class='nohover'><th class='left'>Age</th><th class='left'>Commit message (<a href='/cgit.cgi/linux/net-next.git/log/include/crypto/drbg.h?id=508aac6dee025f93eab1e806d20762ea6327b43d&showmsg=1'>Expand</a>)</th><th class='left'>Author</th><th class='left'>Files</th><th class='left'>Lines</th></tr>