diff --git a/libc/seccomp/arm64_policy.c b/libc/seccomp/arm64_policy.c index 6a8bda0f3..b05a88c91 100644 --- a/libc/seccomp/arm64_policy.c +++ b/libc/seccomp/arm64_policy.c @@ -11,37 +11,36 @@ BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 101, 9, 0), BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 43, 5, 0), BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 32, 3, 0), BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 19, 1, 0), -BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 18, 29, 30), //setxattr|lsetxattr|fsetxattr|getxattr|lgetxattr|fgetxattr|listxattr|llistxattr|flistxattr|removexattr|lremovexattr|fremovexattr|getcwd -BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 30, 28, 29), //eventfd2|epoll_create1|epoll_ctl|epoll_pwait|dup|dup3|fcntl|inotify_init1|inotify_add_watch|inotify_rm_watch|ioctl -BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 41, 27, 28), //flock|mknodat|mkdirat|unlinkat|symlinkat|linkat|renameat|umount2|mount +BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 18, 30, 29), //setxattr|lsetxattr|fsetxattr|getxattr|lgetxattr|fgetxattr|listxattr|llistxattr|flistxattr|removexattr|lremovexattr|fremovexattr|getcwd +BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 30, 29, 28), //eventfd2|epoll_create1|epoll_ctl|epoll_pwait|dup|dup3|fcntl|inotify_init1|inotify_add_watch|inotify_rm_watch|ioctl +BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 41, 28, 27), //flock|mknodat|mkdirat|unlinkat|symlinkat|linkat|renameat|umount2|mount BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 59, 1, 0), -BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 58, 25, 26), //statfs|fstatfs|truncate|ftruncate|fallocate|faccessat|chdir|fchdir|chroot|fchmod|fchmodat|fchownat|fchown|openat|close -BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 98, 24, 25), //pipe2|quotactl|getdents64|lseek|read|write|readv|writev|pread64|pwrite64|preadv|pwritev|sendfile|pselect6|ppoll|signalfd4|vmsplice|splice|tee|readlinkat|newfstatat|fstat|sync|fsync|fdatasync|sync_file_range|timerfd_create|timerfd_settime|timerfd_gettime|utimensat|acct|capget|capset|personality|exit|exit_group|waitid|set_tid_address|unshare +BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 58, 26, 25), //statfs|fstatfs|truncate|ftruncate|fallocate|faccessat|chdir|fchdir|chroot|fchmod|fchmodat|fchownat|fchown|openat|close +BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 98, 25, 24), //pipe2|quotactl|getdents64|lseek|read|write|readv|writev|pread64|pwrite64|preadv|pwritev|sendfile|pselect6|ppoll|signalfd4|vmsplice|splice|tee|readlinkat|newfstatat|fstat|sync|fsync|fdatasync|sync_file_range|timerfd_create|timerfd_settime|timerfd_gettime|utimensat|acct|capget|capset|personality|exit|exit_group|waitid|set_tid_address|unshare BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 129, 3, 0), BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 105, 1, 0), -BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 104, 21, 22), //nanosleep|getitimer|setitimer -BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 128, 20, 21), //init_module|delete_module|timer_create|timer_gettime|timer_getoverrun|timer_settime|timer_delete|clock_settime|clock_gettime|clock_getres|clock_nanosleep|syslog|ptrace|sched_setparam|sched_setscheduler|sched_getscheduler|sched_getparam|sched_setaffinity|sched_getaffinity|sched_yield|sched_get_priority_max|sched_get_priority_min|sched_rr_get_interval +BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 104, 22, 21), //nanosleep|getitimer|setitimer +BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 128, 21, 20), //init_module|delete_module|timer_create|timer_gettime|timer_getoverrun|timer_settime|timer_delete|clock_settime|clock_gettime|clock_getres|clock_nanosleep|syslog|ptrace|sched_setparam|sched_setscheduler|sched_getscheduler|sched_getparam|sched_setaffinity|sched_getaffinity|sched_yield|sched_get_priority_max|sched_get_priority_min|sched_rr_get_interval BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 131, 1, 0), -BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 130, 18, 19), //kill -BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 139, 17, 18), //tgkill|sigaltstack|rt_sigsuspend|rt_sigaction|rt_sigprocmask|rt_sigpending|rt_sigtimedwait|rt_sigqueueinfo +BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 130, 19, 18), //kill +BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 139, 18, 17), //tgkill|sigaltstack|rt_sigsuspend|rt_sigaction|rt_sigprocmask|rt_sigpending|rt_sigtimedwait|rt_sigqueueinfo BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 242, 9, 0), BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 203, 5, 0), BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 198, 3, 0), BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 179, 1, 0), -BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 178, 12, 13), //setpriority|getpriority|reboot|setregid|setgid|setreuid|setuid|setresuid|getresuid|setresgid|getresgid|setfsuid|setfsgid|times|setpgid|getpgid|getsid|setsid|getgroups|setgroups|uname|sethostname|setdomainname|getrlimit|setrlimit|getrusage|umask|prctl|getcpu|gettimeofday|settimeofday|adjtimex|getpid|getppid|getuid|geteuid|getgid|getegid -BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 180, 11, 12), //sysinfo -BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 202, 10, 11), //socket|socketpair|bind|listen +BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 178, 13, 12), //setpriority|getpriority|reboot|setregid|setgid|setreuid|setuid|setresuid|getresuid|setresgid|getresgid|setfsuid|setfsgid|times|setpgid|getpgid|getsid|setsid|getgroups|setgroups|uname|sethostname|setdomainname|getrlimit|setrlimit|getrusage|umask|prctl|getcpu|gettimeofday|settimeofday|adjtimex|getpid|getppid|getuid|geteuid|getgid|getegid +BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 180, 12, 11), //sysinfo +BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 202, 11, 10), //socket|socketpair|bind|listen BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 221, 1, 0), -BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 217, 8, 9), //connect|getsockname|getpeername|sendto|recvfrom|setsockopt|getsockopt|shutdown|sendmsg|recvmsg|readahead|brk|munmap|mremap -BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 234, 7, 8), //execve|mmap|fadvise64|swapon|swapoff|mprotect|msync|mlock|munlock|mlockall|munlockall|mincore|madvise +BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 217, 9, 8), //connect|getsockname|getpeername|sendto|recvfrom|setsockopt|getsockopt|shutdown|sendmsg|recvmsg|readahead|brk|munmap|mremap +BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 234, 8, 7), //execve|mmap|fadvise64|swapon|swapoff|mprotect|msync|mlock|munlock|mlockall|munlockall|mincore|madvise BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 266, 3, 0), BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 260, 1, 0), -BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 244, 4, 5), //accept4|recvmmsg -BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 262, 3, 4), //wait4|prlimit64 +BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 244, 5, 4), //accept4|recvmmsg +BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 262, 4, 3), //wait4|prlimit64 BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 268, 1, 0), -BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 267, 1, 2), //clock_adjtime -BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 272, 0, 1), //setns|sendmmsg|process_vm_readv|process_vm_writev -BPF_STMT(BPF_RET|BPF_K, SECCOMP_RET_TRAP), +BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 267, 2, 1), //clock_adjtime +BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 272, 1, 0), //setns|sendmmsg|process_vm_readv|process_vm_writev BPF_STMT(BPF_RET|BPF_K, SECCOMP_RET_ALLOW), }; diff --git a/libc/seccomp/arm_policy.c b/libc/seccomp/arm_policy.c index de03f452d..1b9ba2f9e 100644 --- a/libc/seccomp/arm_policy.c +++ b/libc/seccomp/arm_policy.c @@ -13,133 +13,132 @@ BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 26, 9, 0), BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 11, 5, 0), BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 6, 3, 0), BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 3, 1, 0), -BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 2, 125, 126), //exit -BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 5, 124, 125), //read|write -BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 7, 123, 124), //close +BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 2, 126, 125), //exit +BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 5, 125, 124), //read|write +BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 7, 124, 123), //close BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 19, 1, 0), -BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 13, 121, 122), //execve|chdir -BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 22, 120, 121), //lseek|getpid|mount +BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 13, 122, 121), //execve|chdir +BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 22, 121, 120), //lseek|getpid|mount BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 41, 3, 0), BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 36, 1, 0), -BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 27, 117, 118), //ptrace -BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 38, 116, 117), //sync|kill +BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 27, 118, 117), //ptrace +BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 38, 117, 116), //sync|kill BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 43, 1, 0), -BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 42, 114, 115), //dup -BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 44, 113, 114), //times +BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 42, 115, 114), //dup +BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 44, 114, 113), //times BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 60, 7, 0), BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 54, 3, 0), BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 51, 1, 0), -BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 46, 109, 110), //brk -BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 53, 108, 109), //acct|umount2 +BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 46, 110, 109), //brk +BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 53, 109, 108), //acct|umount2 BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 57, 1, 0), -BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 55, 106, 107), //ioctl -BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 58, 105, 106), //setpgid +BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 55, 107, 106), //ioctl +BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 58, 106, 105), //setpgid BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 66, 3, 0), BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 64, 1, 0), -BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 62, 102, 103), //umask|chroot -BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 65, 101, 102), //getppid +BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 62, 103, 102), //umask|chroot +BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 65, 102, 101), //getppid BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 74, 1, 0), -BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 68, 99, 100), //setsid|sigaction -BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 76, 98, 99), //sethostname|setrlimit +BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 68, 100, 99), //setsid|sigaction +BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 76, 99, 98), //sethostname|setrlimit BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 124, 17, 0), BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 103, 9, 0), BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 94, 5, 0), BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 91, 3, 0), BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 87, 1, 0), -BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 80, 92, 93), //getrusage|gettimeofday|settimeofday -BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 89, 91, 92), //swapon|reboot -BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 93, 90, 91), //munmap|truncate +BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 80, 93, 92), //getrusage|gettimeofday|settimeofday +BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 89, 92, 91), //swapon|reboot +BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 93, 91, 90), //munmap|truncate BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 96, 1, 0), -BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 95, 88, 89), //fchmod -BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 98, 87, 88), //getpriority|setpriority +BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 95, 89, 88), //fchmod +BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 98, 88, 87), //getpriority|setpriority BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 118, 3, 0), BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 114, 1, 0), -BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 106, 84, 85), //syslog|setitimer|getitimer -BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 117, 83, 84), //wait4|swapoff|sysinfo +BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 106, 85, 84), //syslog|setitimer|getitimer +BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 117, 84, 83), //wait4|swapoff|sysinfo BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 121, 1, 0), -BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 119, 81, 82), //fsync -BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 123, 80, 81), //setdomainname|uname +BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 119, 82, 81), //fsync +BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 123, 81, 80), //setdomainname|uname BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 138, 7, 0), BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 131, 3, 0), BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 128, 1, 0), -BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 126, 76, 77), //adjtimex|mprotect -BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 130, 75, 76), //init_module|delete_module +BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 126, 77, 76), //adjtimex|mprotect +BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 130, 76, 75), //init_module|delete_module BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 136, 1, 0), -BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 134, 73, 74), //quotactl|getpgid|fchdir -BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 137, 72, 73), //personality +BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 134, 74, 73), //quotactl|getpgid|fchdir +BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 137, 73, 72), //personality BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 150, 3, 0), BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 143, 1, 0), -BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 141, 69, 70), //setfsuid|setfsgid|_llseek -BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 149, 68, 69), //flock|msync|readv|writev|getsid|fdatasync +BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 141, 70, 69), //setfsuid|setfsgid|_llseek +BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 149, 69, 68), //flock|msync|readv|writev|getsid|fdatasync BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 172, 1, 0), -BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 164, 66, 67), //mlock|munlock|mlockall|munlockall|sched_setparam|sched_getparam|sched_setscheduler|sched_getscheduler|sched_yield|sched_get_priority_max|sched_get_priority_min|sched_rr_get_interval|nanosleep|mremap -BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 173, 65, 66), //prctl +BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 164, 67, 66), //mlock|munlock|mlockall|munlockall|sched_setparam|sched_getparam|sched_setscheduler|sched_getscheduler|sched_yield|sched_get_priority_max|sched_get_priority_min|sched_rr_get_interval|nanosleep|mremap +BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 173, 66, 65), //prctl BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 290, 33, 0), BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 239, 17, 0), BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 213, 9, 0), BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 197, 5, 0), BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 191, 3, 0), BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 183, 1, 0), -BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 182, 58, 59), //rt_sigaction|rt_sigprocmask|rt_sigpending|rt_sigtimedwait|rt_sigqueueinfo|rt_sigsuspend|pread64|pwrite64 -BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 188, 57, 58), //getcwd|capget|capset|sigaltstack|sendfile -BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 195, 56, 57), //ugetrlimit|mmap2|truncate64|ftruncate64 +BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 182, 59, 58), //rt_sigaction|rt_sigprocmask|rt_sigpending|rt_sigtimedwait|rt_sigqueueinfo|rt_sigsuspend|pread64|pwrite64 +BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 188, 58, 57), //getcwd|capget|capset|sigaltstack|sendfile +BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 195, 57, 56), //ugetrlimit|mmap2|truncate64|ftruncate64 BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 199, 1, 0), -BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 198, 54, 55), //fstat64 -BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 212, 53, 54), //getuid32|getgid32|geteuid32|getegid32|setreuid32|setregid32|getgroups32|setgroups32|fchown32|setresuid32|getresuid32|setresgid32|getresgid32 +BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 198, 55, 54), //fstat64 +BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 212, 54, 53), //getuid32|getgid32|geteuid32|getegid32|setreuid32|setregid32|getgroups32|setgroups32|fchown32|setresuid32|getresuid32|setresgid32|getresgid32 BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 219, 3, 0), BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 217, 1, 0), -BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 215, 50, 51), //setuid32|setgid32 -BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 218, 49, 50), //getdents64 +BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 215, 51, 50), //setuid32|setgid32 +BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 218, 50, 49), //getdents64 BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 225, 1, 0), -BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 222, 47, 48), //mincore|madvise|fcntl64 -BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 238, 46, 47), //readahead|setxattr|lsetxattr|fsetxattr|getxattr|lgetxattr|fgetxattr|listxattr|llistxattr|flistxattr|removexattr|lremovexattr|fremovexattr +BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 222, 48, 47), //mincore|madvise|fcntl64 +BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 238, 47, 46), //readahead|setxattr|lsetxattr|fsetxattr|getxattr|lgetxattr|fgetxattr|listxattr|llistxattr|flistxattr|removexattr|lremovexattr|fremovexattr BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 256, 7, 0), BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 248, 3, 0), BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 241, 1, 0), -BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 240, 42, 43), //sendfile64 -BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 243, 41, 42), //sched_setaffinity|sched_getaffinity +BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 240, 43, 42), //sendfile64 +BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 243, 42, 41), //sched_setaffinity|sched_getaffinity BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 251, 1, 0), -BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 249, 39, 40), //exit_group -BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 252, 38, 39), //epoll_ctl +BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 249, 40, 39), //exit_group +BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 252, 39, 38), //epoll_ctl BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 280, 3, 0), BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 270, 1, 0), -BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 269, 35, 36), //set_tid_address|timer_create|timer_settime|timer_gettime|timer_getoverrun|timer_delete|clock_settime|clock_gettime|clock_getres|clock_nanosleep|statfs64|fstatfs64|tgkill -BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 271, 34, 35), //arm_fadvise64_64 +BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 269, 36, 35), //set_tid_address|timer_create|timer_settime|timer_gettime|timer_getoverrun|timer_delete|clock_settime|clock_gettime|clock_getres|clock_nanosleep|statfs64|fstatfs64|tgkill +BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 271, 35, 34), //arm_fadvise64_64 BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 286, 1, 0), -BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 285, 32, 33), //waitid|socket|bind|connect|listen -BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 289, 31, 32), //getsockname|getpeername|socketpair +BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 285, 33, 32), //waitid|socket|bind|connect|listen +BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 289, 32, 31), //getsockname|getpeername|socketpair BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 350, 15, 0), BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 327, 7, 0), BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 317, 3, 0), BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 292, 1, 0), -BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 291, 26, 27), //sendto -BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 298, 25, 26), //recvfrom|shutdown|setsockopt|getsockopt|sendmsg|recvmsg +BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 291, 27, 26), //sendto +BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 298, 26, 25), //recvfrom|shutdown|setsockopt|getsockopt|sendmsg|recvmsg BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 322, 1, 0), -BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 319, 23, 24), //inotify_add_watch|inotify_rm_watch -BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 326, 22, 23), //openat|mkdirat|mknodat|fchownat +BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 319, 24, 23), //inotify_add_watch|inotify_rm_watch +BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 326, 23, 22), //openat|mkdirat|mknodat|fchownat BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 345, 3, 0), BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 340, 1, 0), -BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 338, 19, 20), //fstatat64|unlinkat|renameat|linkat|symlinkat|readlinkat|fchmodat|faccessat|pselect6|ppoll|unshare -BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 344, 18, 19), //splice|sync_file_range2|tee|vmsplice +BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 338, 20, 19), //fstatat64|unlinkat|renameat|linkat|symlinkat|readlinkat|fchmodat|faccessat|pselect6|ppoll|unshare +BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 344, 19, 18), //splice|sync_file_range2|tee|vmsplice BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 348, 1, 0), -BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 347, 16, 17), //getcpu|epoll_pwait -BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 349, 15, 16), //utimensat +BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 347, 17, 16), //getcpu|epoll_pwait +BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 349, 16, 15), //utimensat BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 372, 7, 0), BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 365, 3, 0), BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 352, 1, 0), -BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 351, 11, 12), //timerfd_create -BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 363, 10, 11), //fallocate|timerfd_settime|timerfd_gettime|signalfd4|eventfd2|epoll_create1|dup3|pipe2|inotify_init1|preadv|pwritev +BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 351, 12, 11), //timerfd_create +BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 363, 11, 10), //fallocate|timerfd_settime|timerfd_gettime|signalfd4|eventfd2|epoll_create1|dup3|pipe2|inotify_init1|preadv|pwritev BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 369, 1, 0), -BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 367, 8, 9), //recvmmsg|accept4 -BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 370, 7, 8), //prlimit64 +BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 367, 9, 8), //recvmmsg|accept4 +BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 370, 8, 7), //prlimit64 BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 983042, 3, 0), BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 374, 1, 0), -BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 373, 4, 5), //clock_adjtime -BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 378, 3, 4), //sendmmsg|setns|process_vm_readv|process_vm_writev +BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 373, 5, 4), //clock_adjtime +BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 378, 4, 3), //sendmmsg|setns|process_vm_readv|process_vm_writev BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 983045, 1, 0), -BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 983043, 1, 2), //__ARM_NR_cacheflush -BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 983046, 0, 1), //__ARM_NR_set_tls -BPF_STMT(BPF_RET|BPF_K, SECCOMP_RET_TRAP), +BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 983043, 2, 1), //__ARM_NR_cacheflush +BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 983046, 1, 0), //__ARM_NR_set_tls BPF_STMT(BPF_RET|BPF_K, SECCOMP_RET_ALLOW), }; diff --git a/libc/tools/genseccomp.py b/libc/tools/genseccomp.py index bd003a302..fa6e7e394 100755 --- a/libc/tools/genseccomp.py +++ b/libc/tools/genseccomp.py @@ -117,16 +117,17 @@ def construct_bpf(architecture, header_dir, output_path): # len(bpf) - i - 1, which is where we will put the kill statement, and # then the statement after that is the allow statement if "{fail}" in statement and "{allow}" in statement: - bpf[i] = statement.format(fail=str(len(bpf) - i - 1), - allow=str(len(bpf) - i)) + bpf[i] = statement.format(fail=str(len(bpf) - i), + allow=str(len(bpf) - i - 1)) # Add check that we aren't off the bottom of the syscalls bpf.insert(0, "BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, " + str(ranges[0].begin) + ", 0, " + str(len(bpf)) + "),") - # Add the error and allow calls at the end - bpf.append("BPF_STMT(BPF_RET|BPF_K, SECCOMP_RET_TRAP),") + # Add the allow calls at the end. If the syscall is not matched, we will + # continue. This allows the user to choose to match further syscalls, and + # also to choose the action when we want to block bpf.append("BPF_STMT(BPF_RET|BPF_K, SECCOMP_RET_ALLOW),") # And output policy