| // KMSAN: kernel-infoleak in sctp_getsockopt |
| // https://syzkaller.appspot.com/bug?id=c7973e7b3530d01b1864e5b58377116c6bf1c7fa |
| // status:fixed |
| // autogenerated by syzkaller (https://github.com/google/syzkaller) |
| |
| #define _GNU_SOURCE |
| |
| #include <arpa/inet.h> |
| #include <dirent.h> |
| #include <endian.h> |
| #include <errno.h> |
| #include <fcntl.h> |
| #include <net/if_arp.h> |
| #include <netinet/in.h> |
| #include <pthread.h> |
| #include <sched.h> |
| #include <setjmp.h> |
| #include <signal.h> |
| #include <stdarg.h> |
| #include <stdbool.h> |
| #include <stdint.h> |
| #include <stdio.h> |
| #include <stdlib.h> |
| #include <string.h> |
| #include <sys/ioctl.h> |
| #include <sys/mman.h> |
| #include <sys/mount.h> |
| #include <sys/prctl.h> |
| #include <sys/resource.h> |
| #include <sys/socket.h> |
| #include <sys/stat.h> |
| #include <sys/syscall.h> |
| #include <sys/time.h> |
| #include <sys/types.h> |
| #include <sys/uio.h> |
| #include <sys/wait.h> |
| #include <time.h> |
| #include <unistd.h> |
| |
| #include <linux/capability.h> |
| #include <linux/futex.h> |
| #include <linux/if.h> |
| #include <linux/if_ether.h> |
| #include <linux/if_tun.h> |
| #include <linux/ip.h> |
| #include <linux/net.h> |
| #include <linux/tcp.h> |
| |
| unsigned long long procid; |
| |
| static __thread int skip_segv; |
| static __thread jmp_buf segv_env; |
| |
| static void segv_handler(int sig, siginfo_t* info, void* ctx) |
| { |
| uintptr_t addr = (uintptr_t)info->si_addr; |
| const uintptr_t prog_start = 1 << 20; |
| const uintptr_t prog_end = 100 << 20; |
| if (__atomic_load_n(&skip_segv, __ATOMIC_RELAXED) && |
| (addr < prog_start || addr > prog_end)) { |
| _longjmp(segv_env, 1); |
| } |
| exit(sig); |
| } |
| |
| static void install_segv_handler(void) |
| { |
| struct sigaction sa; |
| memset(&sa, 0, sizeof(sa)); |
| sa.sa_handler = SIG_IGN; |
| syscall(SYS_rt_sigaction, 0x20, &sa, NULL, 8); |
| syscall(SYS_rt_sigaction, 0x21, &sa, NULL, 8); |
| memset(&sa, 0, sizeof(sa)); |
| sa.sa_sigaction = segv_handler; |
| sa.sa_flags = SA_NODEFER | SA_SIGINFO; |
| sigaction(SIGSEGV, &sa, NULL); |
| sigaction(SIGBUS, &sa, NULL); |
| } |
| |
| #define NONFAILING(...) \ |
| { \ |
| __atomic_fetch_add(&skip_segv, 1, __ATOMIC_SEQ_CST); \ |
| if (_setjmp(segv_env) == 0) { \ |
| __VA_ARGS__; \ |
| } \ |
| __atomic_fetch_sub(&skip_segv, 1, __ATOMIC_SEQ_CST); \ |
| } |
| |
| static void sleep_ms(uint64_t ms) |
| { |
| usleep(ms * 1000); |
| } |
| |
| static uint64_t current_time_ms(void) |
| { |
| struct timespec ts; |
| if (clock_gettime(CLOCK_MONOTONIC, &ts)) |
| exit(1); |
| return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; |
| } |
| |
| static void use_temporary_dir(void) |
| { |
| char tmpdir_template[] = "./syzkaller.XXXXXX"; |
| char* tmpdir = mkdtemp(tmpdir_template); |
| if (!tmpdir) |
| exit(1); |
| if (chmod(tmpdir, 0777)) |
| exit(1); |
| if (chdir(tmpdir)) |
| exit(1); |
| } |
| |
| static void thread_start(void* (*fn)(void*), void* arg) |
| { |
| pthread_t th; |
| pthread_attr_t attr; |
| pthread_attr_init(&attr); |
| pthread_attr_setstacksize(&attr, 128 << 10); |
| if (pthread_create(&th, &attr, fn, arg)) |
| exit(1); |
| pthread_attr_destroy(&attr); |
| } |
| |
| typedef struct { |
| int state; |
| } event_t; |
| |
| static void event_init(event_t* ev) |
| { |
| ev->state = 0; |
| } |
| |
| static void event_reset(event_t* ev) |
| { |
| ev->state = 0; |
| } |
| |
| static void event_set(event_t* ev) |
| { |
| if (ev->state) |
| exit(1); |
| __atomic_store_n(&ev->state, 1, __ATOMIC_RELEASE); |
| syscall(SYS_futex, &ev->state, FUTEX_WAKE | FUTEX_PRIVATE_FLAG); |
| } |
| |
| static void event_wait(event_t* ev) |
| { |
| while (!__atomic_load_n(&ev->state, __ATOMIC_ACQUIRE)) |
| syscall(SYS_futex, &ev->state, FUTEX_WAIT | FUTEX_PRIVATE_FLAG, 0, 0); |
| } |
| |
| static int event_isset(event_t* ev) |
| { |
| return __atomic_load_n(&ev->state, __ATOMIC_ACQUIRE); |
| } |
| |
| static int event_timedwait(event_t* ev, uint64_t timeout) |
| { |
| uint64_t start = current_time_ms(); |
| uint64_t now = start; |
| for (;;) { |
| uint64_t remain = timeout - (now - start); |
| struct timespec ts; |
| ts.tv_sec = remain / 1000; |
| ts.tv_nsec = (remain % 1000) * 1000 * 1000; |
| syscall(SYS_futex, &ev->state, FUTEX_WAIT | FUTEX_PRIVATE_FLAG, 0, &ts); |
| if (__atomic_load_n(&ev->state, __ATOMIC_RELAXED)) |
| return 1; |
| now = current_time_ms(); |
| if (now - start > timeout) |
| return 0; |
| } |
| } |
| |
| static void vsnprintf_check(char* str, size_t size, const char* format, |
| va_list args) |
| { |
| int rv; |
| rv = vsnprintf(str, size, format, args); |
| if (rv < 0) |
| exit(1); |
| if ((size_t)rv >= size) |
| exit(1); |
| } |
| |
| #define COMMAND_MAX_LEN 128 |
| #define PATH_PREFIX \ |
| "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin " |
| #define PATH_PREFIX_LEN (sizeof(PATH_PREFIX) - 1) |
| |
| static void execute_command(bool panic, const char* format, ...) |
| { |
| va_list args; |
| char command[PATH_PREFIX_LEN + COMMAND_MAX_LEN]; |
| int rv; |
| va_start(args, format); |
| memcpy(command, PATH_PREFIX, PATH_PREFIX_LEN); |
| vsnprintf_check(command + PATH_PREFIX_LEN, COMMAND_MAX_LEN, format, args); |
| va_end(args); |
| rv = system(command); |
| if (rv) { |
| if (panic) |
| exit(1); |
| } |
| } |
| |
| static int tunfd = -1; |
| static int tun_frags_enabled; |
| #define SYZ_TUN_MAX_PACKET_SIZE 1000 |
| |
| #define TUN_IFACE "syz_tun" |
| |
| #define LOCAL_MAC "aa:aa:aa:aa:aa:aa" |
| #define REMOTE_MAC "aa:aa:aa:aa:aa:bb" |
| |
| #define LOCAL_IPV4 "172.20.20.170" |
| #define REMOTE_IPV4 "172.20.20.187" |
| |
| #define LOCAL_IPV6 "fe80::aa" |
| #define REMOTE_IPV6 "fe80::bb" |
| |
| #define IFF_NAPI 0x0010 |
| #define IFF_NAPI_FRAGS 0x0020 |
| |
| static void initialize_tun(void) |
| { |
| tunfd = open("/dev/net/tun", O_RDWR | O_NONBLOCK); |
| if (tunfd == -1) { |
| printf("tun: can't open /dev/net/tun: please enable CONFIG_TUN=y\n"); |
| printf("otherwise fuzzing or reproducing might not work as intended\n"); |
| return; |
| } |
| const int kTunFd = 240; |
| if (dup2(tunfd, kTunFd) < 0) |
| exit(1); |
| close(tunfd); |
| tunfd = kTunFd; |
| struct ifreq ifr; |
| memset(&ifr, 0, sizeof(ifr)); |
| strncpy(ifr.ifr_name, TUN_IFACE, IFNAMSIZ); |
| ifr.ifr_flags = IFF_TAP | IFF_NO_PI | IFF_NAPI | IFF_NAPI_FRAGS; |
| if (ioctl(tunfd, TUNSETIFF, (void*)&ifr) < 0) { |
| ifr.ifr_flags = IFF_TAP | IFF_NO_PI; |
| if (ioctl(tunfd, TUNSETIFF, (void*)&ifr) < 0) |
| exit(1); |
| } |
| if (ioctl(tunfd, TUNGETIFF, (void*)&ifr) < 0) |
| exit(1); |
| tun_frags_enabled = (ifr.ifr_flags & IFF_NAPI_FRAGS) != 0; |
| execute_command(0, "sysctl -w net.ipv6.conf.%s.accept_dad=0", TUN_IFACE); |
| execute_command(0, "sysctl -w net.ipv6.conf.%s.router_solicitations=0", |
| TUN_IFACE); |
| execute_command(1, "ip link set dev %s address %s", TUN_IFACE, LOCAL_MAC); |
| execute_command(1, "ip addr add %s/24 dev %s", LOCAL_IPV4, TUN_IFACE); |
| execute_command(1, "ip neigh add %s lladdr %s dev %s nud permanent", |
| REMOTE_IPV4, REMOTE_MAC, TUN_IFACE); |
| execute_command(0, "ip -6 addr add %s/120 dev %s", LOCAL_IPV6, TUN_IFACE); |
| execute_command(0, "ip -6 neigh add %s lladdr %s dev %s nud permanent", |
| REMOTE_IPV6, REMOTE_MAC, TUN_IFACE); |
| execute_command(1, "ip link set dev %s up", TUN_IFACE); |
| } |
| |
| #define DEV_IPV4 "172.20.20.%d" |
| #define DEV_IPV6 "fe80::%02hx" |
| #define DEV_MAC "aa:aa:aa:aa:aa:%02hx" |
| |
| static void snprintf_check(char* str, size_t size, const char* format, ...) |
| { |
| va_list args; |
| va_start(args, format); |
| vsnprintf_check(str, size, format, args); |
| va_end(args); |
| } |
| static void initialize_netdevices(void) |
| { |
| unsigned i; |
| const char* devtypes[] = {"ip6gretap", "bridge", "vcan", "bond", "team"}; |
| const char* devnames[] = {"lo", |
| "sit0", |
| "bridge0", |
| "vcan0", |
| "tunl0", |
| "gre0", |
| "gretap0", |
| "ip_vti0", |
| "ip6_vti0", |
| "ip6tnl0", |
| "ip6gre0", |
| "ip6gretap0", |
| "erspan0", |
| "bond0", |
| "veth0", |
| "veth1", |
| "team0", |
| "veth0_to_bridge", |
| "veth1_to_bridge", |
| "veth0_to_bond", |
| "veth1_to_bond", |
| "veth0_to_team", |
| "veth1_to_team"}; |
| const char* devmasters[] = {"bridge", "bond", "team"}; |
| for (i = 0; i < sizeof(devtypes) / (sizeof(devtypes[0])); i++) |
| execute_command(0, "ip link add dev %s0 type %s", devtypes[i], devtypes[i]); |
| execute_command(0, "ip link add type veth"); |
| for (i = 0; i < sizeof(devmasters) / (sizeof(devmasters[0])); i++) { |
| execute_command( |
| 0, "ip link add name %s_slave_0 type veth peer name veth0_to_%s", |
| devmasters[i], devmasters[i]); |
| execute_command( |
| 0, "ip link add name %s_slave_1 type veth peer name veth1_to_%s", |
| devmasters[i], devmasters[i]); |
| execute_command(0, "ip link set %s_slave_0 master %s0", devmasters[i], |
| devmasters[i]); |
| execute_command(0, "ip link set %s_slave_1 master %s0", devmasters[i], |
| devmasters[i]); |
| execute_command(0, "ip link set veth0_to_%s up", devmasters[i]); |
| execute_command(0, "ip link set veth1_to_%s up", devmasters[i]); |
| } |
| execute_command(0, "ip link set bridge_slave_0 up"); |
| execute_command(0, "ip link set bridge_slave_1 up"); |
| for (i = 0; i < sizeof(devnames) / (sizeof(devnames[0])); i++) { |
| char addr[32]; |
| snprintf_check(addr, sizeof(addr), DEV_IPV4, i + 10); |
| execute_command(0, "ip -4 addr add %s/24 dev %s", addr, devnames[i]); |
| snprintf_check(addr, sizeof(addr), DEV_IPV6, i + 10); |
| execute_command(0, "ip -6 addr add %s/120 dev %s", addr, devnames[i]); |
| snprintf_check(addr, sizeof(addr), DEV_MAC, i + 10); |
| execute_command(0, "ip link set dev %s address %s", devnames[i], addr); |
| execute_command(0, "ip link set dev %s up", devnames[i]); |
| } |
| } |
| |
| static int read_tun(char* data, int size) |
| { |
| if (tunfd < 0) |
| return -1; |
| int rv = read(tunfd, data, size); |
| if (rv < 0) { |
| if (errno == EAGAIN) |
| return -1; |
| if (errno == EBADFD) |
| return -1; |
| exit(1); |
| } |
| return rv; |
| } |
| |
| static void flush_tun() |
| { |
| char data[SYZ_TUN_MAX_PACKET_SIZE]; |
| while (read_tun(&data[0], sizeof(data)) != -1) { |
| } |
| } |
| |
| static bool write_file(const char* file, const char* what, ...) |
| { |
| char buf[1024]; |
| va_list args; |
| va_start(args, what); |
| vsnprintf(buf, sizeof(buf), what, args); |
| va_end(args); |
| buf[sizeof(buf) - 1] = 0; |
| int len = strlen(buf); |
| int fd = open(file, O_WRONLY | O_CLOEXEC); |
| if (fd == -1) |
| return false; |
| if (write(fd, buf, len) != len) { |
| int err = errno; |
| close(fd); |
| errno = err; |
| return false; |
| } |
| close(fd); |
| return true; |
| } |
| |
| #define XT_TABLE_SIZE 1536 |
| #define XT_MAX_ENTRIES 10 |
| |
| struct xt_counters { |
| uint64_t pcnt, bcnt; |
| }; |
| |
| struct ipt_getinfo { |
| char name[32]; |
| unsigned int valid_hooks; |
| unsigned int hook_entry[5]; |
| unsigned int underflow[5]; |
| unsigned int num_entries; |
| unsigned int size; |
| }; |
| |
| struct ipt_get_entries { |
| char name[32]; |
| unsigned int size; |
| void* entrytable[XT_TABLE_SIZE / sizeof(void*)]; |
| }; |
| |
| struct ipt_replace { |
| char name[32]; |
| unsigned int valid_hooks; |
| unsigned int num_entries; |
| unsigned int size; |
| unsigned int hook_entry[5]; |
| unsigned int underflow[5]; |
| unsigned int num_counters; |
| struct xt_counters* counters; |
| char entrytable[XT_TABLE_SIZE]; |
| }; |
| |
| struct ipt_table_desc { |
| const char* name; |
| struct ipt_getinfo info; |
| struct ipt_replace replace; |
| }; |
| |
| static struct ipt_table_desc ipv4_tables[] = { |
| {.name = "filter"}, {.name = "nat"}, {.name = "mangle"}, |
| {.name = "raw"}, {.name = "security"}, |
| }; |
| |
| static struct ipt_table_desc ipv6_tables[] = { |
| {.name = "filter"}, {.name = "nat"}, {.name = "mangle"}, |
| {.name = "raw"}, {.name = "security"}, |
| }; |
| |
| #define IPT_BASE_CTL 64 |
| #define IPT_SO_SET_REPLACE (IPT_BASE_CTL) |
| #define IPT_SO_GET_INFO (IPT_BASE_CTL) |
| #define IPT_SO_GET_ENTRIES (IPT_BASE_CTL + 1) |
| |
| struct arpt_getinfo { |
| char name[32]; |
| unsigned int valid_hooks; |
| unsigned int hook_entry[3]; |
| unsigned int underflow[3]; |
| unsigned int num_entries; |
| unsigned int size; |
| }; |
| |
| struct arpt_get_entries { |
| char name[32]; |
| unsigned int size; |
| void* entrytable[XT_TABLE_SIZE / sizeof(void*)]; |
| }; |
| |
| struct arpt_replace { |
| char name[32]; |
| unsigned int valid_hooks; |
| unsigned int num_entries; |
| unsigned int size; |
| unsigned int hook_entry[3]; |
| unsigned int underflow[3]; |
| unsigned int num_counters; |
| struct xt_counters* counters; |
| char entrytable[XT_TABLE_SIZE]; |
| }; |
| |
| struct arpt_table_desc { |
| const char* name; |
| struct arpt_getinfo info; |
| struct arpt_replace replace; |
| }; |
| |
| static struct arpt_table_desc arpt_tables[] = { |
| {.name = "filter"}, |
| }; |
| |
| #define ARPT_BASE_CTL 96 |
| #define ARPT_SO_SET_REPLACE (ARPT_BASE_CTL) |
| #define ARPT_SO_GET_INFO (ARPT_BASE_CTL) |
| #define ARPT_SO_GET_ENTRIES (ARPT_BASE_CTL + 1) |
| |
| static void checkpoint_iptables(struct ipt_table_desc* tables, int num_tables, |
| int family, int level) |
| { |
| struct ipt_get_entries entries; |
| socklen_t optlen; |
| int fd, i; |
| fd = socket(family, SOCK_STREAM, IPPROTO_TCP); |
| if (fd == -1) { |
| switch (errno) { |
| case EAFNOSUPPORT: |
| case ENOPROTOOPT: |
| return; |
| } |
| exit(1); |
| } |
| for (i = 0; i < num_tables; i++) { |
| struct ipt_table_desc* table = &tables[i]; |
| strcpy(table->info.name, table->name); |
| strcpy(table->replace.name, table->name); |
| optlen = sizeof(table->info); |
| if (getsockopt(fd, level, IPT_SO_GET_INFO, &table->info, &optlen)) { |
| switch (errno) { |
| case EPERM: |
| case ENOENT: |
| case ENOPROTOOPT: |
| continue; |
| } |
| exit(1); |
| } |
| if (table->info.size > sizeof(table->replace.entrytable)) |
| exit(1); |
| if (table->info.num_entries > XT_MAX_ENTRIES) |
| exit(1); |
| memset(&entries, 0, sizeof(entries)); |
| strcpy(entries.name, table->name); |
| entries.size = table->info.size; |
| optlen = sizeof(entries) - sizeof(entries.entrytable) + table->info.size; |
| if (getsockopt(fd, level, IPT_SO_GET_ENTRIES, &entries, &optlen)) |
| exit(1); |
| table->replace.valid_hooks = table->info.valid_hooks; |
| table->replace.num_entries = table->info.num_entries; |
| table->replace.size = table->info.size; |
| memcpy(table->replace.hook_entry, table->info.hook_entry, |
| sizeof(table->replace.hook_entry)); |
| memcpy(table->replace.underflow, table->info.underflow, |
| sizeof(table->replace.underflow)); |
| memcpy(table->replace.entrytable, entries.entrytable, table->info.size); |
| } |
| close(fd); |
| } |
| |
| static void reset_iptables(struct ipt_table_desc* tables, int num_tables, |
| int family, int level) |
| { |
| struct xt_counters counters[XT_MAX_ENTRIES]; |
| struct ipt_get_entries entries; |
| struct ipt_getinfo info; |
| socklen_t optlen; |
| int fd, i; |
| fd = socket(family, SOCK_STREAM, IPPROTO_TCP); |
| if (fd == -1) { |
| switch (errno) { |
| case EAFNOSUPPORT: |
| case ENOPROTOOPT: |
| return; |
| } |
| exit(1); |
| } |
| for (i = 0; i < num_tables; i++) { |
| struct ipt_table_desc* table = &tables[i]; |
| if (table->info.valid_hooks == 0) |
| continue; |
| memset(&info, 0, sizeof(info)); |
| strcpy(info.name, table->name); |
| optlen = sizeof(info); |
| if (getsockopt(fd, level, IPT_SO_GET_INFO, &info, &optlen)) |
| exit(1); |
| if (memcmp(&table->info, &info, sizeof(table->info)) == 0) { |
| memset(&entries, 0, sizeof(entries)); |
| strcpy(entries.name, table->name); |
| entries.size = table->info.size; |
| optlen = sizeof(entries) - sizeof(entries.entrytable) + entries.size; |
| if (getsockopt(fd, level, IPT_SO_GET_ENTRIES, &entries, &optlen)) |
| exit(1); |
| if (memcmp(table->replace.entrytable, entries.entrytable, |
| table->info.size) == 0) |
| continue; |
| } |
| table->replace.num_counters = info.num_entries; |
| table->replace.counters = counters; |
| optlen = sizeof(table->replace) - sizeof(table->replace.entrytable) + |
| table->replace.size; |
| if (setsockopt(fd, level, IPT_SO_SET_REPLACE, &table->replace, optlen)) |
| exit(1); |
| } |
| close(fd); |
| } |
| |
| static void checkpoint_arptables(void) |
| { |
| struct arpt_get_entries entries; |
| socklen_t optlen; |
| unsigned i; |
| int fd; |
| fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); |
| if (fd == -1) { |
| switch (errno) { |
| case EAFNOSUPPORT: |
| case ENOPROTOOPT: |
| return; |
| } |
| exit(1); |
| } |
| for (i = 0; i < sizeof(arpt_tables) / sizeof(arpt_tables[0]); i++) { |
| struct arpt_table_desc* table = &arpt_tables[i]; |
| strcpy(table->info.name, table->name); |
| strcpy(table->replace.name, table->name); |
| optlen = sizeof(table->info); |
| if (getsockopt(fd, SOL_IP, ARPT_SO_GET_INFO, &table->info, &optlen)) { |
| switch (errno) { |
| case EPERM: |
| case ENOENT: |
| case ENOPROTOOPT: |
| continue; |
| } |
| exit(1); |
| } |
| if (table->info.size > sizeof(table->replace.entrytable)) |
| exit(1); |
| if (table->info.num_entries > XT_MAX_ENTRIES) |
| exit(1); |
| memset(&entries, 0, sizeof(entries)); |
| strcpy(entries.name, table->name); |
| entries.size = table->info.size; |
| optlen = sizeof(entries) - sizeof(entries.entrytable) + table->info.size; |
| if (getsockopt(fd, SOL_IP, ARPT_SO_GET_ENTRIES, &entries, &optlen)) |
| exit(1); |
| table->replace.valid_hooks = table->info.valid_hooks; |
| table->replace.num_entries = table->info.num_entries; |
| table->replace.size = table->info.size; |
| memcpy(table->replace.hook_entry, table->info.hook_entry, |
| sizeof(table->replace.hook_entry)); |
| memcpy(table->replace.underflow, table->info.underflow, |
| sizeof(table->replace.underflow)); |
| memcpy(table->replace.entrytable, entries.entrytable, table->info.size); |
| } |
| close(fd); |
| } |
| |
| static void reset_arptables() |
| { |
| struct xt_counters counters[XT_MAX_ENTRIES]; |
| struct arpt_get_entries entries; |
| struct arpt_getinfo info; |
| socklen_t optlen; |
| unsigned i; |
| int fd; |
| fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); |
| if (fd == -1) { |
| switch (errno) { |
| case EAFNOSUPPORT: |
| case ENOPROTOOPT: |
| return; |
| } |
| exit(1); |
| } |
| for (i = 0; i < sizeof(arpt_tables) / sizeof(arpt_tables[0]); i++) { |
| struct arpt_table_desc* table = &arpt_tables[i]; |
| if (table->info.valid_hooks == 0) |
| continue; |
| memset(&info, 0, sizeof(info)); |
| strcpy(info.name, table->name); |
| optlen = sizeof(info); |
| if (getsockopt(fd, SOL_IP, ARPT_SO_GET_INFO, &info, &optlen)) |
| exit(1); |
| if (memcmp(&table->info, &info, sizeof(table->info)) == 0) { |
| memset(&entries, 0, sizeof(entries)); |
| strcpy(entries.name, table->name); |
| entries.size = table->info.size; |
| optlen = sizeof(entries) - sizeof(entries.entrytable) + entries.size; |
| if (getsockopt(fd, SOL_IP, ARPT_SO_GET_ENTRIES, &entries, &optlen)) |
| exit(1); |
| if (memcmp(table->replace.entrytable, entries.entrytable, |
| table->info.size) == 0) |
| continue; |
| } else { |
| } |
| table->replace.num_counters = info.num_entries; |
| table->replace.counters = counters; |
| optlen = sizeof(table->replace) - sizeof(table->replace.entrytable) + |
| table->replace.size; |
| if (setsockopt(fd, SOL_IP, ARPT_SO_SET_REPLACE, &table->replace, optlen)) |
| exit(1); |
| } |
| close(fd); |
| } |
| |
| #define NF_BR_NUMHOOKS 6 |
| #define EBT_TABLE_MAXNAMELEN 32 |
| #define EBT_CHAIN_MAXNAMELEN 32 |
| #define EBT_BASE_CTL 128 |
| #define EBT_SO_SET_ENTRIES (EBT_BASE_CTL) |
| #define EBT_SO_GET_INFO (EBT_BASE_CTL) |
| #define EBT_SO_GET_ENTRIES (EBT_SO_GET_INFO + 1) |
| #define EBT_SO_GET_INIT_INFO (EBT_SO_GET_ENTRIES + 1) |
| #define EBT_SO_GET_INIT_ENTRIES (EBT_SO_GET_INIT_INFO + 1) |
| |
| struct ebt_replace { |
| char name[EBT_TABLE_MAXNAMELEN]; |
| unsigned int valid_hooks; |
| unsigned int nentries; |
| unsigned int entries_size; |
| struct ebt_entries* hook_entry[NF_BR_NUMHOOKS]; |
| unsigned int num_counters; |
| struct ebt_counter* counters; |
| char* entries; |
| }; |
| |
| struct ebt_entries { |
| unsigned int distinguisher; |
| char name[EBT_CHAIN_MAXNAMELEN]; |
| unsigned int counter_offset; |
| int policy; |
| unsigned int nentries; |
| char data[0] __attribute__((aligned(__alignof__(struct ebt_replace)))); |
| }; |
| |
| struct ebt_table_desc { |
| const char* name; |
| struct ebt_replace replace; |
| char entrytable[XT_TABLE_SIZE]; |
| }; |
| |
| static struct ebt_table_desc ebt_tables[] = { |
| {.name = "filter"}, |
| {.name = "nat"}, |
| {.name = "broute"}, |
| }; |
| |
| static void checkpoint_ebtables(void) |
| { |
| socklen_t optlen; |
| unsigned i; |
| int fd; |
| fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); |
| if (fd == -1) { |
| switch (errno) { |
| case EAFNOSUPPORT: |
| case ENOPROTOOPT: |
| return; |
| } |
| exit(1); |
| } |
| for (i = 0; i < sizeof(ebt_tables) / sizeof(ebt_tables[0]); i++) { |
| struct ebt_table_desc* table = &ebt_tables[i]; |
| strcpy(table->replace.name, table->name); |
| optlen = sizeof(table->replace); |
| if (getsockopt(fd, SOL_IP, EBT_SO_GET_INIT_INFO, &table->replace, |
| &optlen)) { |
| switch (errno) { |
| case EPERM: |
| case ENOENT: |
| case ENOPROTOOPT: |
| continue; |
| } |
| exit(1); |
| } |
| if (table->replace.entries_size > sizeof(table->entrytable)) |
| exit(1); |
| table->replace.num_counters = 0; |
| table->replace.entries = table->entrytable; |
| optlen = sizeof(table->replace) + table->replace.entries_size; |
| if (getsockopt(fd, SOL_IP, EBT_SO_GET_INIT_ENTRIES, &table->replace, |
| &optlen)) |
| exit(1); |
| } |
| close(fd); |
| } |
| |
| static void reset_ebtables() |
| { |
| struct ebt_replace replace; |
| char entrytable[XT_TABLE_SIZE]; |
| socklen_t optlen; |
| unsigned i, j, h; |
| int fd; |
| fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); |
| if (fd == -1) { |
| switch (errno) { |
| case EAFNOSUPPORT: |
| case ENOPROTOOPT: |
| return; |
| } |
| exit(1); |
| } |
| for (i = 0; i < sizeof(ebt_tables) / sizeof(ebt_tables[0]); i++) { |
| struct ebt_table_desc* table = &ebt_tables[i]; |
| if (table->replace.valid_hooks == 0) |
| continue; |
| memset(&replace, 0, sizeof(replace)); |
| strcpy(replace.name, table->name); |
| optlen = sizeof(replace); |
| if (getsockopt(fd, SOL_IP, EBT_SO_GET_INFO, &replace, &optlen)) |
| exit(1); |
| replace.num_counters = 0; |
| table->replace.entries = 0; |
| for (h = 0; h < NF_BR_NUMHOOKS; h++) |
| table->replace.hook_entry[h] = 0; |
| if (memcmp(&table->replace, &replace, sizeof(table->replace)) == 0) { |
| memset(&entrytable, 0, sizeof(entrytable)); |
| replace.entries = entrytable; |
| optlen = sizeof(replace) + replace.entries_size; |
| if (getsockopt(fd, SOL_IP, EBT_SO_GET_ENTRIES, &replace, &optlen)) |
| exit(1); |
| if (memcmp(table->entrytable, entrytable, replace.entries_size) == 0) |
| continue; |
| } |
| for (j = 0, h = 0; h < NF_BR_NUMHOOKS; h++) { |
| if (table->replace.valid_hooks & (1 << h)) { |
| table->replace.hook_entry[h] = |
| (struct ebt_entries*)table->entrytable + j; |
| j++; |
| } |
| } |
| table->replace.entries = table->entrytable; |
| optlen = sizeof(table->replace) + table->replace.entries_size; |
| if (setsockopt(fd, SOL_IP, EBT_SO_SET_ENTRIES, &table->replace, optlen)) |
| exit(1); |
| } |
| close(fd); |
| } |
| |
| static void checkpoint_net_namespace(void) |
| { |
| checkpoint_ebtables(); |
| checkpoint_arptables(); |
| checkpoint_iptables(ipv4_tables, sizeof(ipv4_tables) / sizeof(ipv4_tables[0]), |
| AF_INET, SOL_IP); |
| checkpoint_iptables(ipv6_tables, sizeof(ipv6_tables) / sizeof(ipv6_tables[0]), |
| AF_INET6, SOL_IPV6); |
| } |
| |
| static void reset_net_namespace(void) |
| { |
| reset_ebtables(); |
| reset_arptables(); |
| reset_iptables(ipv4_tables, sizeof(ipv4_tables) / sizeof(ipv4_tables[0]), |
| AF_INET, SOL_IP); |
| reset_iptables(ipv6_tables, sizeof(ipv6_tables) / sizeof(ipv6_tables[0]), |
| AF_INET6, SOL_IPV6); |
| } |
| |
| static void setup_cgroups() |
| { |
| if (mkdir("/syzcgroup", 0777)) { |
| } |
| if (mkdir("/syzcgroup/unified", 0777)) { |
| } |
| if (mount("none", "/syzcgroup/unified", "cgroup2", 0, NULL)) { |
| } |
| if (chmod("/syzcgroup/unified", 0777)) { |
| } |
| if (!write_file("/syzcgroup/unified/cgroup.subtree_control", |
| "+cpu +memory +io +pids +rdma")) { |
| } |
| if (mkdir("/syzcgroup/cpu", 0777)) { |
| } |
| if (mount("none", "/syzcgroup/cpu", "cgroup", 0, |
| "cpuset,cpuacct,perf_event,hugetlb")) { |
| } |
| if (!write_file("/syzcgroup/cpu/cgroup.clone_children", "1")) { |
| } |
| if (chmod("/syzcgroup/cpu", 0777)) { |
| } |
| if (mkdir("/syzcgroup/net", 0777)) { |
| } |
| if (mount("none", "/syzcgroup/net", "cgroup", 0, |
| "net_cls,net_prio,devices,freezer")) { |
| } |
| if (chmod("/syzcgroup/net", 0777)) { |
| } |
| } |
| static void setup_binfmt_misc() |
| { |
| if (mount(0, "/proc/sys/fs/binfmt_misc", "binfmt_misc", 0, 0)) { |
| } |
| if (!write_file("/proc/sys/fs/binfmt_misc/register", |
| ":syz0:M:0:\x01::./file0:")) { |
| } |
| if (!write_file("/proc/sys/fs/binfmt_misc/register", |
| ":syz1:M:1:\x02::./file0:POC")) { |
| } |
| } |
| |
| static void setup_common() |
| { |
| if (mount(0, "/sys/fs/fuse/connections", "fusectl", 0, 0)) { |
| } |
| setup_cgroups(); |
| setup_binfmt_misc(); |
| } |
| |
| static void loop(); |
| |
| static void sandbox_common() |
| { |
| prctl(PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0); |
| setpgrp(); |
| setsid(); |
| struct rlimit rlim; |
| rlim.rlim_cur = rlim.rlim_max = 200 << 20; |
| setrlimit(RLIMIT_AS, &rlim); |
| rlim.rlim_cur = rlim.rlim_max = 32 << 20; |
| setrlimit(RLIMIT_MEMLOCK, &rlim); |
| rlim.rlim_cur = rlim.rlim_max = 136 << 20; |
| setrlimit(RLIMIT_FSIZE, &rlim); |
| rlim.rlim_cur = rlim.rlim_max = 1 << 20; |
| setrlimit(RLIMIT_STACK, &rlim); |
| rlim.rlim_cur = rlim.rlim_max = 0; |
| setrlimit(RLIMIT_CORE, &rlim); |
| rlim.rlim_cur = rlim.rlim_max = 256; |
| setrlimit(RLIMIT_NOFILE, &rlim); |
| if (unshare(CLONE_NEWNS)) { |
| } |
| if (unshare(CLONE_NEWIPC)) { |
| } |
| if (unshare(0x02000000)) { |
| } |
| if (unshare(CLONE_NEWUTS)) { |
| } |
| if (unshare(CLONE_SYSVSEM)) { |
| } |
| } |
| |
| int wait_for_loop(int pid) |
| { |
| if (pid < 0) |
| exit(1); |
| int status = 0; |
| while (waitpid(-1, &status, __WALL) != pid) { |
| } |
| return WEXITSTATUS(status); |
| } |
| |
| static int real_uid; |
| static int real_gid; |
| __attribute__((aligned(64 << 10))) static char sandbox_stack[1 << 20]; |
| |
| static int namespace_sandbox_proc(void* arg) |
| { |
| sandbox_common(); |
| write_file("/proc/self/setgroups", "deny"); |
| if (!write_file("/proc/self/uid_map", "0 %d 1\n", real_uid)) |
| exit(1); |
| if (!write_file("/proc/self/gid_map", "0 %d 1\n", real_gid)) |
| exit(1); |
| if (unshare(CLONE_NEWNET)) |
| exit(1); |
| initialize_tun(); |
| initialize_netdevices(); |
| if (mkdir("./syz-tmp", 0777)) |
| exit(1); |
| if (mount("", "./syz-tmp", "tmpfs", 0, NULL)) |
| exit(1); |
| if (mkdir("./syz-tmp/newroot", 0777)) |
| exit(1); |
| if (mkdir("./syz-tmp/newroot/dev", 0700)) |
| exit(1); |
| unsigned bind_mount_flags = MS_BIND | MS_REC | MS_PRIVATE; |
| if (mount("/dev", "./syz-tmp/newroot/dev", NULL, bind_mount_flags, NULL)) |
| exit(1); |
| if (mkdir("./syz-tmp/newroot/proc", 0700)) |
| exit(1); |
| if (mount(NULL, "./syz-tmp/newroot/proc", "proc", 0, NULL)) |
| exit(1); |
| if (mkdir("./syz-tmp/newroot/selinux", 0700)) |
| exit(1); |
| const char* selinux_path = "./syz-tmp/newroot/selinux"; |
| if (mount("/selinux", selinux_path, NULL, bind_mount_flags, NULL)) { |
| if (errno != ENOENT) |
| exit(1); |
| if (mount("/sys/fs/selinux", selinux_path, NULL, bind_mount_flags, NULL) && |
| errno != ENOENT) |
| exit(1); |
| } |
| if (mkdir("./syz-tmp/newroot/sys", 0700)) |
| exit(1); |
| if (mount("/sys", "./syz-tmp/newroot/sys", 0, bind_mount_flags, NULL)) |
| exit(1); |
| if (mkdir("./syz-tmp/newroot/syzcgroup", 0700)) |
| exit(1); |
| if (mkdir("./syz-tmp/newroot/syzcgroup/unified", 0700)) |
| exit(1); |
| if (mkdir("./syz-tmp/newroot/syzcgroup/cpu", 0700)) |
| exit(1); |
| if (mkdir("./syz-tmp/newroot/syzcgroup/net", 0700)) |
| exit(1); |
| if (mount("/syzcgroup/unified", "./syz-tmp/newroot/syzcgroup/unified", NULL, |
| bind_mount_flags, NULL)) { |
| } |
| if (mount("/syzcgroup/cpu", "./syz-tmp/newroot/syzcgroup/cpu", NULL, |
| bind_mount_flags, NULL)) { |
| } |
| if (mount("/syzcgroup/net", "./syz-tmp/newroot/syzcgroup/net", NULL, |
| bind_mount_flags, NULL)) { |
| } |
| if (mkdir("./syz-tmp/pivot", 0777)) |
| exit(1); |
| if (syscall(SYS_pivot_root, "./syz-tmp", "./syz-tmp/pivot")) { |
| if (chdir("./syz-tmp")) |
| exit(1); |
| } else { |
| if (chdir("/")) |
| exit(1); |
| if (umount2("./pivot", MNT_DETACH)) |
| exit(1); |
| } |
| if (chroot("./newroot")) |
| exit(1); |
| if (chdir("/")) |
| exit(1); |
| struct __user_cap_header_struct cap_hdr = {}; |
| struct __user_cap_data_struct cap_data[2] = {}; |
| cap_hdr.version = _LINUX_CAPABILITY_VERSION_3; |
| cap_hdr.pid = getpid(); |
| if (syscall(SYS_capget, &cap_hdr, &cap_data)) |
| exit(1); |
| cap_data[0].effective &= ~(1 << CAP_SYS_PTRACE); |
| cap_data[0].permitted &= ~(1 << CAP_SYS_PTRACE); |
| cap_data[0].inheritable &= ~(1 << CAP_SYS_PTRACE); |
| if (syscall(SYS_capset, &cap_hdr, &cap_data)) |
| exit(1); |
| loop(); |
| exit(1); |
| } |
| |
| #define SYZ_HAVE_SANDBOX_NAMESPACE 1 |
| static int do_sandbox_namespace(void) |
| { |
| int pid; |
| setup_common(); |
| real_uid = getuid(); |
| real_gid = getgid(); |
| mprotect(sandbox_stack, 4096, PROT_NONE); |
| pid = |
| clone(namespace_sandbox_proc, &sandbox_stack[sizeof(sandbox_stack) - 64], |
| CLONE_NEWUSER | CLONE_NEWPID, 0); |
| return wait_for_loop(pid); |
| } |
| |
| #define FS_IOC_SETFLAGS _IOW('f', 2, long) |
| static void remove_dir(const char* dir) |
| { |
| DIR* dp; |
| struct dirent* ep; |
| int iter = 0; |
| retry: |
| while (umount2(dir, MNT_DETACH) == 0) { |
| } |
| dp = opendir(dir); |
| if (dp == NULL) { |
| if (errno == EMFILE) { |
| exit(1); |
| } |
| exit(1); |
| } |
| while ((ep = readdir(dp))) { |
| if (strcmp(ep->d_name, ".") == 0 || strcmp(ep->d_name, "..") == 0) |
| continue; |
| char filename[FILENAME_MAX]; |
| snprintf(filename, sizeof(filename), "%s/%s", dir, ep->d_name); |
| while (umount2(filename, MNT_DETACH) == 0) { |
| } |
| struct stat st; |
| if (lstat(filename, &st)) |
| exit(1); |
| if (S_ISDIR(st.st_mode)) { |
| remove_dir(filename); |
| continue; |
| } |
| int i; |
| for (i = 0;; i++) { |
| if (unlink(filename) == 0) |
| break; |
| if (errno == EPERM) { |
| int fd = open(filename, O_RDONLY); |
| if (fd != -1) { |
| long flags = 0; |
| if (ioctl(fd, FS_IOC_SETFLAGS, &flags) == 0) |
| close(fd); |
| continue; |
| } |
| } |
| if (errno == EROFS) { |
| break; |
| } |
| if (errno != EBUSY || i > 100) |
| exit(1); |
| if (umount2(filename, MNT_DETACH)) |
| exit(1); |
| } |
| } |
| closedir(dp); |
| int i; |
| for (i = 0;; i++) { |
| if (rmdir(dir) == 0) |
| break; |
| if (i < 100) { |
| if (errno == EPERM) { |
| int fd = open(dir, O_RDONLY); |
| if (fd != -1) { |
| long flags = 0; |
| if (ioctl(fd, FS_IOC_SETFLAGS, &flags) == 0) |
| close(fd); |
| continue; |
| } |
| } |
| if (errno == EROFS) { |
| break; |
| } |
| if (errno == EBUSY) { |
| if (umount2(dir, MNT_DETACH)) |
| exit(1); |
| continue; |
| } |
| if (errno == ENOTEMPTY) { |
| if (iter < 100) { |
| iter++; |
| goto retry; |
| } |
| } |
| } |
| exit(1); |
| } |
| } |
| |
| static void kill_and_wait(int pid, int* status) |
| { |
| kill(-pid, SIGKILL); |
| kill(pid, SIGKILL); |
| int i; |
| for (i = 0; i < 100; i++) { |
| if (waitpid(-1, status, WNOHANG | __WALL) == pid) |
| return; |
| usleep(1000); |
| } |
| DIR* dir = opendir("/sys/fs/fuse/connections"); |
| if (dir) { |
| for (;;) { |
| struct dirent* ent = readdir(dir); |
| if (!ent) |
| break; |
| if (strcmp(ent->d_name, ".") == 0 || strcmp(ent->d_name, "..") == 0) |
| continue; |
| char abort[300]; |
| snprintf(abort, sizeof(abort), "/sys/fs/fuse/connections/%s/abort", |
| ent->d_name); |
| int fd = open(abort, O_WRONLY); |
| if (fd == -1) { |
| continue; |
| } |
| if (write(fd, abort, 1) < 0) { |
| } |
| close(fd); |
| } |
| closedir(dir); |
| } else { |
| } |
| while (waitpid(-1, status, __WALL) != pid) { |
| } |
| } |
| |
| #define SYZ_HAVE_SETUP_LOOP 1 |
| static void setup_loop() |
| { |
| int pid = getpid(); |
| char cgroupdir[64]; |
| char file[128]; |
| snprintf(cgroupdir, sizeof(cgroupdir), "/syzcgroup/unified/syz%llu", procid); |
| if (mkdir(cgroupdir, 0777)) { |
| } |
| snprintf(file, sizeof(file), "%s/pids.max", cgroupdir); |
| if (!write_file(file, "32")) { |
| } |
| snprintf(file, sizeof(file), "%s/memory.low", cgroupdir); |
| if (!write_file(file, "%d", 298 << 20)) { |
| } |
| snprintf(file, sizeof(file), "%s/memory.high", cgroupdir); |
| if (!write_file(file, "%d", 299 << 20)) { |
| } |
| snprintf(file, sizeof(file), "%s/memory.max", cgroupdir); |
| if (!write_file(file, "%d", 300 << 20)) { |
| } |
| snprintf(file, sizeof(file), "%s/cgroup.procs", cgroupdir); |
| if (!write_file(file, "%d", pid)) { |
| } |
| snprintf(cgroupdir, sizeof(cgroupdir), "/syzcgroup/cpu/syz%llu", procid); |
| if (mkdir(cgroupdir, 0777)) { |
| } |
| snprintf(file, sizeof(file), "%s/cgroup.procs", cgroupdir); |
| if (!write_file(file, "%d", pid)) { |
| } |
| snprintf(cgroupdir, sizeof(cgroupdir), "/syzcgroup/net/syz%llu", procid); |
| if (mkdir(cgroupdir, 0777)) { |
| } |
| snprintf(file, sizeof(file), "%s/cgroup.procs", cgroupdir); |
| if (!write_file(file, "%d", pid)) { |
| } |
| checkpoint_net_namespace(); |
| } |
| |
| #define SYZ_HAVE_RESET_LOOP 1 |
| static void reset_loop() |
| { |
| reset_net_namespace(); |
| } |
| |
| #define SYZ_HAVE_SETUP_TEST 1 |
| static void setup_test() |
| { |
| prctl(PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0); |
| setpgrp(); |
| char cgroupdir[64]; |
| snprintf(cgroupdir, sizeof(cgroupdir), "/syzcgroup/unified/syz%llu", procid); |
| if (symlink(cgroupdir, "./cgroup")) { |
| } |
| snprintf(cgroupdir, sizeof(cgroupdir), "/syzcgroup/cpu/syz%llu", procid); |
| if (symlink(cgroupdir, "./cgroup.cpu")) { |
| } |
| snprintf(cgroupdir, sizeof(cgroupdir), "/syzcgroup/net/syz%llu", procid); |
| if (symlink(cgroupdir, "./cgroup.net")) { |
| } |
| if (!write_file("/proc/self/oom_score_adj", "1000")) { |
| } |
| flush_tun(); |
| } |
| |
| #define SYZ_HAVE_RESET_TEST 1 |
| static void reset_test() |
| { |
| int fd; |
| for (fd = 3; fd < 30; fd++) |
| close(fd); |
| } |
| |
| struct thread_t { |
| int created, call; |
| event_t ready, done; |
| }; |
| |
| static struct thread_t threads[16]; |
| static void execute_call(int call); |
| static int running; |
| |
| static void* thr(void* arg) |
| { |
| struct thread_t* th = (struct thread_t*)arg; |
| for (;;) { |
| event_wait(&th->ready); |
| event_reset(&th->ready); |
| execute_call(th->call); |
| __atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED); |
| event_set(&th->done); |
| } |
| return 0; |
| } |
| |
| static void execute_one(void) |
| { |
| int i, call, thread; |
| int collide = 0; |
| again: |
| for (call = 0; call < 8; call++) { |
| for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0])); |
| thread++) { |
| struct thread_t* th = &threads[thread]; |
| if (!th->created) { |
| th->created = 1; |
| event_init(&th->ready); |
| event_init(&th->done); |
| event_set(&th->done); |
| thread_start(thr, th); |
| } |
| if (!event_isset(&th->done)) |
| continue; |
| event_reset(&th->done); |
| th->call = call; |
| __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED); |
| event_set(&th->ready); |
| if (collide && (call % 2) == 0) |
| break; |
| event_timedwait(&th->done, 45); |
| break; |
| } |
| } |
| for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++) |
| sleep_ms(1); |
| if (!collide) { |
| collide = 1; |
| goto again; |
| } |
| } |
| |
| static void execute_one(void); |
| |
| #define WAIT_FLAGS __WALL |
| |
| static void loop(void) |
| { |
| setup_loop(); |
| int iter; |
| for (iter = 0;; iter++) { |
| char cwdbuf[32]; |
| sprintf(cwdbuf, "./%d", iter); |
| if (mkdir(cwdbuf, 0777)) |
| exit(1); |
| reset_loop(); |
| int pid = fork(); |
| if (pid < 0) |
| exit(1); |
| if (pid == 0) { |
| if (chdir(cwdbuf)) |
| exit(1); |
| setup_test(); |
| execute_one(); |
| reset_test(); |
| exit(0); |
| } |
| int status = 0; |
| uint64_t start = current_time_ms(); |
| for (;;) { |
| if (waitpid(-1, &status, WNOHANG | WAIT_FLAGS) == pid) |
| break; |
| sleep_ms(1); |
| if (current_time_ms() - start < 5 * 1000) |
| continue; |
| kill_and_wait(pid, &status); |
| break; |
| } |
| remove_dir(cwdbuf); |
| } |
| } |
| #ifndef __NR_bpf |
| #define __NR_bpf 321 |
| #endif |
| |
| uint64_t r[1] = {0xffffffffffffffff}; |
| |
| void execute_call(int call) |
| { |
| long res; |
| switch (call) { |
| case 0: |
| res = syscall(__NR_socket, 0xa, 5, 0); |
| if (res != -1) |
| r[0] = res; |
| break; |
| case 1: |
| NONFAILING(*(uint16_t*)0x200010c0 = 0xa); |
| NONFAILING(*(uint16_t*)0x200010c2 = htobe16(0)); |
| NONFAILING(*(uint32_t*)0x200010c4 = 0); |
| NONFAILING(*(uint8_t*)0x200010c8 = 0); |
| NONFAILING(*(uint8_t*)0x200010c9 = 0); |
| NONFAILING(*(uint8_t*)0x200010ca = 0); |
| NONFAILING(*(uint8_t*)0x200010cb = 0); |
| NONFAILING(*(uint8_t*)0x200010cc = 0); |
| NONFAILING(*(uint8_t*)0x200010cd = 0); |
| NONFAILING(*(uint8_t*)0x200010ce = 0); |
| NONFAILING(*(uint8_t*)0x200010cf = 0); |
| NONFAILING(*(uint8_t*)0x200010d0 = 0); |
| NONFAILING(*(uint8_t*)0x200010d1 = 0); |
| NONFAILING(*(uint8_t*)0x200010d2 = 0); |
| NONFAILING(*(uint8_t*)0x200010d3 = 0); |
| NONFAILING(*(uint8_t*)0x200010d4 = 0); |
| NONFAILING(*(uint8_t*)0x200010d5 = 0); |
| NONFAILING(*(uint8_t*)0x200010d6 = 0); |
| NONFAILING(*(uint8_t*)0x200010d7 = 0); |
| NONFAILING(*(uint32_t*)0x200010d8 = 0); |
| syscall(__NR_setsockopt, r[0], 0x84, 0x64, 0x200010c0, 0x1c); |
| break; |
| case 2: |
| NONFAILING(*(uint32_t*)0x20001100 = 0); |
| NONFAILING(*(uint32_t*)0x20001104 = 0x1000); |
| NONFAILING(memcpy( |
| (void*)0x20001108, |
| "\x09\x16\x5f\x14\x04\xe9\x87\xcd\xdd\x0f\x56\x36\x17\xdb\xb2\x91\x7d" |
| "\x39\xa7\x34\x3a\xea\x07\x5d\x23\xfb\xfc\x9c\xf3\x29\xc7\xaf\xa7\x82" |
| "\x45\xfe\xd9\x81\xb4\xf6\x72\x80\x23\x16\x24\x9b\xdb\x3a\x0c\xe0\xc8" |
| "\x3b\x7d\x91\xe0\x42\xa3\x4b\xed\x7e\x71\x0f\x12\x24\x68\x8d\xa2\x9a" |
| "\x35\xb0\x9f\x8c\x35\xfc\x7c\xab\x3b\xb3\x29\x53\xf1\xc6\x32\x7c\xe9" |
| "\xa5\x2b\x5f\xbe\x3d\x70\x2e\x7a\x03\xbe\xde\x92\x3b\x5f\xe3\x7b\xcd" |
| "\xc2\xcc\xfa\x86\x4f\x04\xab\x76\xd4\x82\xc5\x95\x47\x1c\x91\xca\x00" |
| "\x25\xc7\x48\x3e\x20\x12\xf2\x60\x85\x76\x5e\x88\xcf\x53\x78\xdd\xc1" |
| "\xf0\xf3\xd1\x63\xe8\xfa\x47\x58\x01\x80\x8a\xc5\x3c\x61\x98\x53\x7d" |
| "\x16\x11\xab\xed\x91\x77\x0e\x4e\x75\x03\xc1\xc7\x77\xdf\x5e\x64\x28" |
| "\xdf\x80\x9d\x45\x15\x31\x09\x7e\x23\xf6\x2e\x19\xba\x36\xb1\x1a\x87" |
| "\x82\x4c\x42\x40\x26\xa4\x98\x97\xba\x02\x6b\x8e\xd1\x45\x66\xf4\x5e" |
| "\x06\x8a\x3c\xf5\xdc\x5e\x90\x32\x16\x60\x6e\xd1\x5b\xcf\x93\x46\xd2" |
| "\xea\xc4\x26\x34\xda\xb6\x48\x51\xed\x42\x46\xdf\xff\x45\x71\xc6\x6c" |
| "\x0d\x02\xe4\x91\xf9\xd8\x87\xad\x90\xb6\xb3\x5c\xf8\x82\xa3\xc2\x30" |
| "\xf7\x3c\x30\x9a\xea\xc0\xdf\x82\x19\x51\xfb\xba\x06\x96\xd8\x0d\xc3" |
| "\x7e\xea\x7c\xed\x7b\x00\xa9\xa5\x46\xd3\xb8\xde\xc8\x94\xcb\x94\x87" |
| "\xdc\xa4\x45\xf0\x75\x07\x9b\x61\x89\x55\xab\x04\x07\x6d\xb1\x20\x31" |
| "\x3a\xb0\x14\xff\xdc\x76\x33\xbd\x35\xf3\x63\x5b\x62\x71\x9f\x68\xdb" |
| "\xf0\x20\x07\x88\x63\xf3\xc1\x36\xa9\x9d\x5f\x1b\x85\x51\xfc\x9e\xe5" |
| "\x6c\xf0\x19\x5d\xe6\x8d\x18\x1f\x4c\x98\xc7\xce\x00\x85\x2a\x47\xea" |
| "\xf5\xf5\x78\x25\x2d\x2e\xd9\x65\xb9\x70\xbf\x68\x72\xb6\x6b\xe1\x4e" |
| "\xc2\x36\x2b\x2b\xc5\xd2\x52\x5f\xae\x4e\x16\x24\xac\xc5\x28\xad\xbf" |
| "\x8b\xa5\xee\xb8\xe3\xab\xec\xbb\x4b\x1a\xf5\x1b\xe1\x82\xa9\x9a\x9d" |
| "\x2e\x98\xd7\x10\x32\xc7\x4e\xca\xce\xd2\x95\x4b\x97\xcb\x12\x9f\x43" |
| "\x25\xa4\xa1\xc5\xd6\xde\x49\xf1\x1e\x31\x0c\xfa\x70\xde\x3d\x74\x6f" |
| "\x29\xb6\x19\x33\xa9\xb0\xaa\xc7\xcf\x56\xe2\xb8\x2e\x8f\x7f\x5e\x75" |
| "\xfe\xc4\xd5\x7f\xd5\x54\xdc\x8f\x88\xe8\xc8\x45\xbf\x6c\x60\x61\x28" |
| "\xed\xc8\xa2\xae\x52\xda\xae\xfd\xaf\xd9\xbc\x91\x56\x66\xa8\x02\xe8" |
| "\xe0\x3b\xdc\x8e\x5e\x76\x27\x00\x8f\x7b\x2f\x16\xa2\xc6\x4c\x89\x8d" |
| "\x59\x7e\xa0\xc7\x05\xe4\x5f\x45\xac\x73\x20\x19\x98\xff\xda\x5a\x5c" |
| "\x11\xe1\x46\x03\xee\x30\xd2\x08\x9a\x47\x18\x6e\xa8\x18\x4d\xbc\xcd" |
| "\x1d\xee\x57\x5a\x92\x54\xf2\xca\x7b\x15\x6c\x79\x8d\x78\xb5\x9c\x57" |
| "\x88\x16\x0e\xe8\xed\x34\x9a\xc5\x65\x88\x25\x32\xff\x2e\xfc\xf9\xde" |
| "\xc6\x23\xc2\xb3\x2e\x02\xab\x1e\x83\x9a\x10\x53\xd8\x12\xec\x8a\x5f" |
| "\x41\x10\xf0\xd1\x12\xfa\x73\x52\xfe\x27\xc5\x3a\x24\x9c\xb0\x10\xa2" |
| "\xcf\xf4\xbe\xf7\x6d\x3d\xc3\x2f\xfa\xfe\x2a\x44\x07\xa8\xb9\x65\x31" |
| "\xf2\x53\x18\x73\x21\xc9\x22\x02\x2c\x68\x18\x41\xae\x71\x8f\xed\x96" |
| "\x44\x35\xb6\x4f\x42\xea\x6e\x2e\x9a\xba\x2e\xde\x5f\x2a\x56\x09\xf0" |
| "\x62\xd7\x93\x6c\x2a\xf3\xbe\x11\x23\xd9\xbc\x90\x50\x91\x21\x35\xd0" |
| "\x99\xab\x43\x12\xc4\x5b\x1a\x3f\x91\x01\x4e\x7f\xf0\xc3\x2a\xd1\xdd" |
| "\xb4\x53\x1f\xa4\x83\xb4\x70\x84\x50\x01\xad\xda\xbc\x3c\xd8\xc4\xc4" |
| "\x74\xd4\x2d\xed\xb5\x6f\x45\xf2\xe4\x61\x20\xe3\xde\xf5\xd8\xbd\x7e" |
| "\x87\xf0\x24\x5b\xf5\x33\xdd\xab\xe3\x00\xc5\x89\x36\xb2\x3e\xc4\x49" |
| "\x22\x34\x20\xa4\x2e\xdc\x9f\xea\x5e\x47\x2d\x3a\xa8\x67\x11\x96\x94" |
| "\x60\xef\x89\x51\x91\x1f\x3d\x9e\xe0\xee\xe0\x58\xf6\x22\x64\x91\x9f" |
| "\xbe\x63\xfd\xc3\xbd\x33\xfe\x1a\x7c\x5d\x8d\xa8\x9c\xe5\x42\x1b\x80" |
| "\x00\xaa\x78\x01\x06\x5a\xbe\xa3\x4d\x01\x3b\x77\x74\x33\x54\x43\x98" |
| "\x2b\xad\x21\x6d\xbb\x00\x25\x4e\x99\x0f\x5c\x3e\x64\x51\x9f\xe9\x77" |
| "\x0e\xd1\x67\xfc\x2b\x34\x14\x99\x0a\xd6\x4f\x91\x3f\x01\x12\x8e\xf2" |
| "\xb6\x4e\xd1\x53\x6a\xe1\x5e\xa4\xa1\x27\x5d\x41\x4b\x14\x43\x86\x75" |
| "\x20\x21\x93\x09\x23\x0d\xb5\x79\xe9\xd7\x34\x88\xb8\x0f\x18\x9e\x8b" |
| "\xa2\x78\x99\x04\xca\x25\x1b\x8c\xc3\xc6\x92\xb1\x21\xac\xed\xaa\xda" |
| "\x38\x8e\xb5\xa2\xc9\xcc\xcd\x29\x6f\xdd\x89\x49\x7b\x5e\x86\x8f\xc9" |
| "\x0d\x77\xf2\xec\x42\xa6\x45\xd0\x9f\x39\x22\x09\xcf\x7f\x31\xdf\x6c" |
| "\xe3\x23\x0d\x3c\x0a\x89\x0f\x43\x62\x1f\x77\xa2\xfd\x41\xab\x7f\x1c" |
| "\x5d\xb2\xca\x8f\xab\x8c\x29\x1b\xc5\xbc\x48\x39\x74\xe5\x3c\x4f\xfe" |
| "\x0b\x8d\xb9\xd8\x15\x43\x1d\xe3\x3b\xbc\xe2\xfb\x9c\xf3\x67\x04\x8a" |
| "\x96\xc7\x34\xdb\x3b\xcc\x93\xf2\xb7\x0c\x0e\xdf\x6e\x83\xe4\x90\xa0" |
| "\x29\x74\xac\x70\x75\xeb\x4f\xbf\x2d\x8c\x9b\x63\xb8\xce\x8a\x4f\xf6" |
| "\x10\x71\xff\xef\x76\xc4\x28\x36\xb6\x71\xe7\x71\x5f\x4c\x08\xd7\x6c" |
| "\x72\xa9\xe0\xa7\x83\x9d\x1a\xad\x7c\x1e\x62\x4f\x82\xad\x3b\x97\x3b" |
| "\x50\x69\x2a\xcc\x1a\xa0\xec\x2c\xaa\xfb\xbb\x02\xa6\x61\xba\xc1\xf1" |
| "\xd5\xdc\x39\x00\xea\xce\xa0\x7d\x10\xae\x62\x64\x65\x3d\xd6\x03\x95" |
| "\x73\xda\xab\xd0\x47\x77\x92\x7b\xb5\x42\x11\x44\x1f\xa0\x2e\x2d\x47" |
| "\xed\x35\xd1\xf7\x77\x5b\x4b\xb6\x60\x57\x60\xdc\xeb\xbd\xa1\xd9\x93" |
| "\xd7\x16\x93\x7d\xc6\x8a\xfb\xf7\xa3\x7c\x81\xb9\x52\x2c\x5b\x47\x75" |
| "\xa6\xf2\x29\x2e\x51\x3b\x7c\x5d\x92\x36\x93\x01\xa5\xa7\x67\x73\x30" |
| "\xe0\x95\x42\x15\x1a\x37\x9f\xa9\x04\x79\x62\xe9\x3a\x38\xba\xd6\x98" |
| "\x0f\xd3\x53\x1a\x2a\xee\xfe\xcc\x58\x6c\xd6\x67\x10\x9f\x20\x3a\xbd" |
| "\xcc\xb8\x96\x76\x86\x52\xfa\x1e\xe3\x8b\xc4\x82\x4b\xe0\x6f\x03\xf1" |
| "\x67\x56\x76\x0c\x64\xd0\xc4\x34\xdf\x13\x30\x1a\x71\xf1\xff\xa2\xec" |
| "\x59\x21\xe2\xc5\x8d\xd5\xd1\x31\xc3\x7e\x21\x7a\x2c\xc7\xfe\xaf\x71" |
| "\xc7\x2d\x90\xe6\x41\x2d\x84\xcb\x55\xca\xa9\x79\x40\xd1\xa9\xb6\x46" |
| "\x75\x04\xf5\xce\x96\x6a\xab\xf2\x1d\x0e\x15\xfe\x41\x45\x16\x51\xbb" |
| "\x94\xe8\x85\xd0\x49\x32\x7b\x9f\x51\x4f\xc1\x6b\xfd\x63\x11\x9c\x13" |
| "\x51\x2b\xb1\x91\xf1\xc5\x43\x18\xfa\xe0\x43\xc4\x26\xb3\x6b\xad\x5b" |
| "\x21\xe2\x2e\x31\xa9\x31\x78\xd6\xe9\x54\xe3\x27\xc4\x56\xda\x28\x4d" |
| "\xaa\x96\x5b\x0e\x2e\x3a\x83\xca\x22\x82\xb9\x3a\x89\x97\x86\x15\xb6" |
| "\x25\xb3\x87\x1c\x01\xb0\x57\xd6\x30\x4e\x72\xac\x87\x99\x5d\x7a\x31" |
| "\x72\x12\xc5\x09\x18\x75\xb1\x3a\xe3\xc7\xd8\xa5\xa5\x0f\x2a\x7f\xbe" |
| "\x67\x2b\xd3\xb2\xe6\x57\xb3\x41\xd9\xc4\xe9\xff\x9b\x4f\xba\x65\x97" |
| "\xc7\xd5\x30\x10\xdb\x53\x33\x98\xdc\xe5\x97\x02\xb9\xfc\xa5\x5d\x4d" |
| "\xd0\x64\x96\x77\x2f\x8c\xb3\xf1\x91\xe7\x79\x2c\x2d\x53\xc8\xd4\x2e" |
| "\x31\x05\xe4\xdc\x24\x76\x75\x04\xfb\xa4\x62\xd9\xf8\x0b\xa0\xb6\x02" |
| "\xcc\x24\x6c\x5e\xf0\x79\x80\x3e\xce\x6a\xfa\xc9\x1e\x5f\x70\x74\xa4" |
| "\x9f\x2a\x5c\x37\x9e\xe4\x93\x45\x33\x26\x12\x3a\xa2\x6c\x73\x79\x26" |
| "\xff\x1c\xd0\x5f\xe3\x98\x59\x7d\x44\xf8\xb1\xbc\xbd\xe9\x8b\x03\x6d" |
| "\x12\x75\xad\xa6\x8c\x20\x86\xf2\xdd\xb1\x28\xfb\xb2\xba\x7c\xa0\x78" |
| "\x3e\x95\x57\x00\xc4\xca\x77\x00\x2a\xdb\x5a\x72\x86\xb8\xc4\x95\xf9" |
| "\xec\xbb\xd5\x94\x08\xb8\x74\x7a\x72\x4f\xed\x82\xe2\x65\x53\x53\x5b" |
| "\x45\xa3\x2b\xe7\xf0\xc1\xd4\x78\xe0\xfc\xce\xde\xc9\xaf\x2e\xa1\x47" |
| "\xa0\x7b\x46\x76\x4d\x3a\xff\xb8\xfe\x36\x30\x41\xcf\xb3\x6c\x44\xc2" |
| "\x9e\x3e\xc6\x69\xed\x8c\x2d\x15\xc9\x51\x58\x6d\xbd\x8b\x8b\xb5\x64" |
| "\x19\x3d\x88\x12\x1b\x3c\x1a\xf2\x4e\x06\x13\x59\x64\xfe\x43\xf6\x8a" |
| "\xa1\x74\x72\xb5\xa9\x9c\x13\x10\xa4\xba\x9d\x69\xbd\xf8\x99\x4d\xf1" |
| "\xf6\x9a\x49\x7b\x7b\xff\xe6\x11\x87\xeb\x9e\x44\x18\x4f\xef\xd2\x03" |
| "\x5c\x82\xd8\x4f\xd1\x49\xa7\x35\xee\x14\x5c\x24\x50\x04\x7a\x87\x7f" |
| "\x37\xb3\x02\xdb\x0c\x96\x56\xd9\xf9\x96\xa6\x88\xd7\x96\x36\xa6\x47" |
| "\x1b\x70\xe2\xa6\x25\x92\xf0\x18\x2e\x67\xea\x0f\x9f\x08\xfe\x99\x1c" |
| "\xa6\xc3\x81\x99\x1e\x36\xbb\x95\xa4\x29\xd1\xaa\xc7\x2d\xdd\x98\x2e" |
| "\x5d\x17\xda\xcd\xb5\x50\x56\x6c\xfb\x6f\x44\x8e\xa0\x34\xf3\xed\x3a" |
| "\x2f\x9a\x21\x00\xb4\x1f\x9d\xe5\x71\x8e\x6d\x88\xe0\x95\x96\xa1\xca" |
| "\x62\x7b\x7a\x63\x95\x77\x9a\xfe\x24\xab\x6b\xe1\x9c\x53\x2c\xa0\x1e" |
| "\xa4\xb1\x1e\xb1\x1f\xee\x0a\xc0\x2a\x98\x87\xc1\x0b\x86\x0e\x96\xcb" |
| "\x67\x3c\x62\xaf\x6d\x9a\x32\x88\x9f\x4b\x15\x18\x3e\x3f\x4f\x3b\x1c" |
| "\x4b\xe6\xd9\xb8\x20\xcc\x3b\xbf\x5a\xe2\x52\xdf\xe9\x39\xdb\x5f\xb7" |
| "\x2c\x09\xd7\x0a\xfa\x20\xdb\x46\x6a\xdf\x9f\xbb\x37\xea\x91\xf4\x2e" |
| "\x1d\x71\xac\x0a\xf4\x6e\xb4\x2c\x7f\xfc\xe5\xa1\x09\xfd\x43\x52\x85" |
| "\xf0\x22\x0a\x1b\x34\x96\x05\x6d\xe7\x73\x08\x9f\xe2\xc2\x80\x5a\x4c" |
| "\xcf\xc4\x30\xa5\x21\x31\x3a\x5c\x37\x65\x57\xce\xee\x4c\x83\x14\x3f" |
| "\xbd\x1d\x13\xc3\x04\x6b\x08\x10\x73\xb6\x57\xb1\xba\xe9\xa9\x2a\x3e" |
| "\xb7\x39\xb3\x43\x5c\xbf\xc4\x0c\xc4\xf3\x98\xf9\x65\xfa\x7d\x21\x7b" |
| "\x34\xd4\x58\xc2\xa4\xb4\x70\x6b\x8c\xc8\x3d\xa9\xcf\xe6\x5f\x88\xb5" |
| "\xb9\xbb\x7e\x25\x5d\xc5\xd1\xe0\x70\x80\xac\x5d\xad\x8a\x1d\x52\xa8" |
| "\xf7\x73\x46\x13\xf5\x97\x3f\x77\xb2\x8c\xe1\x1b\x81\xb2\xcd\x08\xb2" |
| "\x91\x58\xfe\x64\x60\xf6\xdb\x60\xa4\xce\xa9\x90\x12\xf2\x01\x8f\x7e" |
| "\x85\x10\x58\xb4\x92\x9e\x50\xf1\xbb\xb6\xd5\xdb\x55\x76\x65\x03\xc8" |
| "\x8d\x62\x32\xfe\xe5\x4b\x22\x57\xe2\x17\xeb\xbb\x58\x44\x2b\x0d\xd1" |
| "\x57\x16\x6c\x0b\x4a\x0f\xa4\xc8\x52\xed\x80\x9a\x12\xa1\x37\x09\xc5" |
| "\x94\x1a\xb5\x19\x56\x82\xc8\x02\xcc\xcb\x4f\x8a\x8d\x2f\xf2\x6c\x87" |
| "\x45\xe8\x7b\x30\x1a\x67\x64\x50\xe7\x10\xbf\xba\xb7\x69\x9c\x87\xda" |
| "\x00\xde\x2c\x0c\xdf\x33\x06\xde\x2c\xce\x5b\x79\xdf\x06\x09\x3a\x43" |
| "\x50\x85\x86\x1c\x02\xab\xdc\x98\x30\xf5\xe3\x0c\xcd\xad\x97\x38\x80" |
| "\x4f\xa4\x63\x8a\xbb\x1d\x6a\x67\xe7\xfc\x9d\x5e\xdf\x9f\x55\x43\x16" |
| "\x4f\x68\x23\x34\xf6\x8f\x09\x8c\x26\xac\x08\x01\x8c\x9e\x98\x15\x62" |
| "\x05\x43\x3f\xa3\xf5\x0f\xb3\x1c\xc1\x8a\xb8\xb3\x13\x91\x77\x6a\x04" |
| "\x00\x91\x96\xf4\xc0\xd3\x49\xd1\xc0\xa2\x57\x9f\x51\x35\x30\x20\x78" |
| "\x79\xb7\xf1\xb1\x79\x8c\x01\x93\xc0\x31\x37\x5b\x97\xa3\xc1\xe7\x0f" |
| "\x07\x61\xea\x22\x14\xfd\x22\x2d\xf6\x17\x7e\xa2\xc3\x0c\x6e\x72\xa4" |
| "\xf2\xd4\xad\xcd\x2c\x70\x1f\x35\xde\xb4\x76\x37\xfe\x21\xfd\xd3\xfc" |
| "\x44\x0a\x83\xeb\xcd\x93\x00\xfd\x70\x4c\xd9\xd3\x11\x1c\xfb\x49\x84" |
| "\xb2\x78\x69\x85\x50\xff\x3b\xf3\xaf\x94\xa0\xac\xed\x94\xcb\x50\x61" |
| "\xc7\x2c\x45\x47\xc8\xee\xc3\xa0\xf5\x35\x3e\x54\x13\x09\x79\x40\x10" |
| "\x5f\xe4\x3c\x2c\x94\x8c\xd4\xfa\xed\x18\xbd\x33\xd6\xc8\x26\xd2\x32" |
| "\x63\x48\x2e\x9b\x73\x34\x1f\x43\xd0\x50\x87\x9c\x41\xd6\x23\xd0\x27" |
| "\xfb\x4f\xaf\x5a\x42\x28\x2d\x8f\x2f\xa9\x63\x7d\xe7\xa5\x0a\xc0\x22" |
| "\xd8\x9b\x54\x76\xa0\x5e\xf6\x05\x84\xda\xfd\xfa\xea\x52\x8b\x9c\x3b" |
| "\xfa\x9e\xc4\x9e\x9b\x4d\xbb\xe7\x74\xc2\x6f\x25\xdc\x5b\x81\x6c\xd0" |
| "\xbb\xea\x83\xab\xc7\x6e\x8d\x78\xeb\x5c\x96\x01\xb0\x7e\xcb\x49\x57" |
| "\x6e\x59\x64\x8e\x23\x43\xde\x76\xed\xf5\x92\x69\xc6\x1c\x02\x05\xb0" |
| "\xb1\x82\xf1\xc3\x80\x0c\xa7\x48\xcb\x75\xe7\x25\x4d\x73\x77\x50\x36" |
| "\x2f\x40\x02\x99\x85\x47\xee\x9c\x55\x9d\xea\x70\xdf\x1d\x69\x82\x65" |
| "\x25\xdc\xd8\x00\xd4\x5f\x8e\x81\xbb\x52\x96\x85\xbc\xc2\xe2\x3a\x15" |
| "\xe6\x2d\xe3\x71\xae\x5f\x2e\x0b\x91\x04\x84\xbd\x4c\xba\xad\xdc\x1c" |
| "\xa5\x0c\xcf\xd1\x95\x1d\x9d\x05\xf0\x77\x71\xca\x71\x87\x3d\x14\x93" |
| "\xd5\x2c\x30\xe4\x32\x83\x3f\x0d\x81\x61\xc9\xb6\xf4\x1c\x35\xc0\xd7" |
| "\x67\x4d\x1b\xf7\xa1\x25\x44\xbb\xe6\x1a\x77\x18\x8b\x4b\xcf\x3e\xa5" |
| "\x43\x76\x85\x2e\x79\xe9\xf8\xa1\xee\x2d\xb5\x1b\xe1\xc2\xed\x8e\xf5" |
| "\x15\x37\x98\xd2\x10\x06\x98\x92\x87\x55\xbe\xf3\x0e\xce\x87\x9e\x9e" |
| "\xd5\x30\xc4\xac\xac\x41\xe9\x81\x85\x0b\x6b\x65\x2a\x4a\x0f\x39\xc8" |
| "\xca\xa2\xc0\xe1\x27\x54\x4f\xa1\xf5\x9e\x58\x39\x2e\x99\xd4\x87\x31" |
| "\x1e\xd7\xaf\x53\x28\xec\xb8\x3f\x82\x30\x39\xe1\x03\xf7\xfe\xbe\x52" |
| "\xc1\x28\x8d\x10\x2d\x75\x3a\x4b\x7c\xea\xde\xc6\x88\x4c\x85\x89\x82" |
| "\x86\x1c\xf5\xa6\xb5\x87\x08\x14\x2b\xa0\xcf\x41\x7c\xf2\xc8\x8d\xb6" |
| "\xe0\x5f\xb2\xd6\x99\x47\x08\xa0\x1a\x23\x66\x5c\x96\xcb\x34\xe5\x9f" |
| "\xd9\x37\x5b\x31\x5a\x72\xcd\x6c\xa5\xe0\x62\x1a\xae\xae\x98\x32\x1f" |
| "\x18\x16\xd2\xd9\xd3\x3f\xc7\x5f\xb1\x68\xfc\xc1\x26\x2b\x9f\x83\x30" |
| "\x69\x36\x1f\x2e\x68\xe0\xc1\xce\xa3\x5f\xd8\x2e\xc0\x64\xa3\x85\x85" |
| "\x11\x01\x74\x08\xf6\xb8\x6c\x5b\x2e\x53\x8a\x16\xd4\x60\x26\x6c\xf5" |
| "\x33\x51\x94\xca\x6d\x4b\xbe\x0e\xaa\xe6\x47\x9a\x0c\xb5\xde\xe2\xd3" |
| "\xab\xaf\x99\xf5\x7d\x9e\x1f\x29\xa3\x88\x8d\xd4\xcf\xb4\xc6\xe1\x09" |
| "\xa2\x88\x49\xf2\x6f\xea\x37\x52\x9f\xf9\xcc\xcd\xb7\x86\xb2\x2a\x81" |
| "\xaa\xb0\x1e\xdc\x99\xf8\xc4\x96\xf1\x16\x3a\xef\x91\x42\x3d\x81\xb8" |
| "\x31\x44\x0a\x45\x5f\xb0\x45\x90\x45\xaf\x15\xc4\x23\x43\xac\x0f\xa2" |
| "\xf3\x37\x65\x8f\xe9\x8e\xa8\x5b\x9f\xf6\xc7\x62\xe5\xe2\x7c\x54\xca" |
| "\x0f\xf4\x66\xa2\x61\x23\x78\xe8\xa3\x82\xde\x67\xaa\x34\xce\xfa\x07" |
| "\x5b\xcb\xa0\x30\x2d\x01\x28\x61\xbd\xf1\xe7\xdc\xec\xa6\x02\x5a\xd7" |
| "\x30\x5a\xcb\x5f\xe8\xc9\x98\xa6\xd4\x4d\x81\x9a\xa9\x30\x3d\x45\x87" |
| "\x41\x84\xc9\x82\x45\x6b\xc9\x4e\x55\xf5\x2a\xee\x26\x6c\x88\xb2\x1e" |
| "\x0e\x5a\x16\xe3\xbe\x72\xba\xdf\xdc\x52\x73\x01\xa4\xc5\x21\x63\x00" |
| "\xeb\xff\xa2\x83\x26\x20\xe4\x4a\x76\x3d\xf4\x8e\x57\xe5\x7a\x8e\x27" |
| "\xc7\x06\xc6\x8a\xda\xbd\xf0\xb4\x11\xb0\xa0\x84\xf2\x4a\x03\x0e\xd3" |
| "\x7e\x0f\x1b\x56\xb4\xd1\x39\xb1\xb2\x3d\x05\x37\xbb\xc4\xf0\x3d\x1f" |
| "\x7e\x25\x1d\x93\xf1\xd8\x06\x9d\x29\x24\xcc\xa9\xe9\xaa\xe8\x4f\x4c" |
| "\xf3\x9e\x7a\x60\x65\x8c\xba\x1d\xda\xfa\x9c\xe2\x84\x2e\xc5\xb5\x8f" |
| "\x39\x12\xc7\x82\xc0\x00\xb5\x84\x2b\xac\xeb\xf8\x4c\x8e\xa6\xa1\x62" |
| "\xe0\x53\xf7\x64\x6a\x65\xc3\x6c\x9d\x1a\xd9\xc3\x04\x10\xb7\x60\x66" |
| "\x51\x91\x25\x9f\x8f\x5a\x5a\x17\x70\x08\x7b\x31\xf3\x93\x5e\xb2\xff" |
| "\xe0\x38\x32\xda\x2f\x30\x7e\x81\x59\xd3\x51\x4f\xd6\xbf\x26\xaf\x2f" |
| "\x18\x60\x4f\x9b\x49\xe3\x6d\x91\x4a\xf3\x8c\x31\x6a\x30\x12\x7d\xa5" |
| "\xc0\x90\x3d\x56\x06\x5b\x59\x1a\xe2\xdd\x0a\x5b\x37\x12\x13\x61\x87" |
| "\x4e\x4e\x02\xe7\x04\x2a\xd9\x6c\x04\xd9\x43\xb6\xce\xf7\x50\xc6\x9b" |
| "\x2d\xa0\x86\x86\x4a\xa4\x1a\xb3\xad\x8d\x30\x8c\x20\x62\x2c\x31\xd3" |
| "\xc1\x29\xfb\xba\x8c\x9e\xe5\x7a\x69\xc2\xdc\x77\xaf\xe1\xc8\x0f\x55" |
| "\x8d\xd9\x17\x51\xd8\x04\x5f\xd8\x1d\xdc\x93\xc9\xc4\x57\x30\x35\x5e" |
| "\x5f\xf8\xdc\x9c\xef\x29\xd8\xe4\x2a\xec\x8c\x3b\xcb\x47\x85\x02\x8b" |
| "\x54\x3a\xa0\x98\x21\x7f\x5a\x12\xe3\x4a\xc5\x26\xac\x2f\x95\xce\xb7" |
| "\x14\x80\x46\x49\xbb\x13\x9f\xf3\xac\x0f\x6e\xf3\x46\x1a\xd7\x13\x3c" |
| "\x48\xb8\x5b\x97\x41\x92\x97\xc1\xfe\x37\xc6\x87\xbe\xd8\xb9\x96\xf3" |
| "\xa6\x87\x39\x49\x33\xc0\x19\x83\x8f\xf1\xb1\x83\x89\x48\x5d\xbf\xe9" |
| "\x94\xfc\x3e\x95\x84\xcb\xe8\x50\xe8\x0f\xdf\x3c\xbc\xbb\x89\xf6\x0f" |
| "\x02\x06\x7e\x6d\x62\x22\x1a\x63\x33\xc3\xdf\x0b\x11\x62\x61\x80\x75" |
| "\xa2\xa7\xb2\xa9\xcd\x67\x27\xe9\x98\x3c\x9e\x0a\x2d\x3a\x30\xe6\xc8" |
| "\x47\x13\x5f\xc8\xfe\x67\x88\x1b\x7c\x14\x8e\x01\x43\xf5\x08\x66\xa8" |
| "\xb7\x4d\x94\x60\x2e\xba\x46\x53\xe2\x7f\x40\x47\x82\x27\x54\xf0\x1c" |
| "\x7b\xd6\x6e\xfa\x82\x91\x7e\x7a\x47\x29\xd5\x5f\xdd\x19\xc9\x08\xfb" |
| "\x43\xdf\xb9\xe0\xdf\x94\x30\x29\xcf\xa9\xbe\x14\xfe\xc0\x5c\x05\xd1" |
| "\x71\x85\xa1\xa1\xe1\xd0\xf8\x91\xf2\xb6\x04\xc4\x60\x7f\x16\x2d\x60" |
| "\x93\xf1\x36\x77\x9d\x85\x94\xac\xf5\xeb\x0f\xe8\xbe\x64\x6c\x72\x90" |
| "\x83\x06\xb9\x40\x6a\xa1\x63\x08\xbd\x15\xd1\x7e\x6a\xe7\x47\x57\xf9" |
| "\xe4\x36\x34\xb7\x47\xa0\x67\x44\xba\x99\x31\x5e\xd8\xb9\xbd\xd3\x97" |
| "\x81\xd7\xe0\x80\x1e\xce\x91\x82\x19\xf8\xe6\x93\x97\x96\xe7\xb5\x30" |
| "\x8d\x7d\x9c\x5e\x8a\x08\x5b\x46\xb9\xe6\xa4\x9d\x56\x07\xfb\xf4\xb6" |
| "\x80\xac\x27\x1b\x97\x3d\xad\x48\x23\xea\x55\xf5\x34\xca\xe4\x5a\x59" |
| "\xa7\x12\x06\xb0\x8c\x6c\x81\xbe\x2e\x87\xe9\xe4\x96\x19\xef\x9d\x55" |
| "\x66\x60\x66\x16\x9b\xa6\xc1\xbd\x48\xb1\x55\xb1\x6e\x89\xeb\xe0\xe5" |
| "\x0a\x78\x46\xb5\xd3\x78\x59\x40\x36\x62\x9e\x07\x04\xc3\x82\x14\xd1" |
| "\xcc\xf2\xbb\x90\x1d\x02\xa6\x0c\xae\x36\xd2\xb2\x89\x20\x7e\xb8\x34" |
| "\x46\xdc\x59\x65\xe6\xd2\x9e\xe2\xae\x88\x7a\xbd\x88\x53\x58\xc3\xd7" |
| "\xa1\x4d\xb1\x89\xec\xcb\x10\x72\xc5\x65\x63\xdb\xf4\xe1\x6f\x69\xcb" |
| "\x35\x72\x6a\x6f\x5a\xca\x9c\xcb\x81\xa7\x34\xd0\x80\x94\xef\xd6\xb0" |
| "\x1d\x30\x5b\x99\xa7\x6d\x8a\xca\x09\xee\xca\x38\x3f\x31\x11\x2e\x72" |
| "\x60\x07\x4c\x57\xfb\xb8\x58\x34\x3a\x86\x09\x24\x66\x90\xe5\xfb\x94" |
| "\x2b\xcc\x9d\x11\xaa\x5c\x02\xec\x25\x50\x69\x03\xa5\x99\xb1\xf1\x5c" |
| "\x90\x12\x73\x8f\x4b\xee\xd5\x6a\x6c\x1c\x9a\x3e\x01\x1e\xb4\x08\xbb" |
| "\x74\xf1\x98\x04\x33\xf6\xd3\xcd\x38\xd0\x93\x77\x3f\xfa\x25\x9d\x5e" |
| "\x55\x3e\x50\x17\x94\x51\xfc\x9f\x57\xce\xfa\xb9\xac\x26\xbb\xa5\xd7" |
| "\xc2\x5b\x43\xe4\x59\x61\x84\x60\x7a\x6a\xbe\x81\xc1\x37\x1d\x6d\x00" |
| "\xd5\xa8\x30\x4a\xeb\xba\x95\x7c\xa9\xe5\x17\x77\x5e\x80\x02\xb5\x80" |
| "\x54\x66\x27\x90\xdd\x73\xb4\x5d\x29\xeb\xfa\xab\x83\x0d\xe2\x35\x33" |
| "\x5d\x06\xea\x23\x8d\x20\x35\x46\x15\x5e\xbc\x48\x44\x8e\xf5\x8b\x8c" |
| "\x7f\x3e\x44\x91\x02\x27\xe2\x8d\x05\xcd\xb3\xe0\x06\xa9\x29\x84\x02" |
| "\x64\x64\x8b\x2a\xff\x98\x9e\x06\x6f\xcb\x31\x55\x1b\x85\x0a\xcc\xd0" |
| "\xe4\x6b\xe5\x68\xa0\x8c\xf5\xec\x27\x85\x4a\x0e\xfb\x42\x7b\x15\xf9" |
| "\xc7\xde\x9e\x57\x9c\xad\x59\x5c\xbb\x68\x1f\x6e\x64\x0f\x8c\xa1\xf7" |
| "\x97\xba\xd1\x40\x7a\x9e\x4e\x9a\xba\x23\x24\x4d\x6f\xf1\x20\x05\xed" |
| "\x97\x1d\xc2\x52\x7f\x3a\x07\x58\x87\x0a\x9e\x43\xd2\x87\x13\x5c\x38" |
| "\xd3\x37\x94\x8e\x5d\x86\x78\x9b\x2d\x6a\x6e\x3f\xda\xe7\xe4\xba\xfb" |
| "\xda\x87\xf1\xe4\x93\x9a\xc2\x85\x6e\x6a\x6d\xd2\x6c\x7a\xf0\xad\xfa" |
| "\xfc\xb4\xe7\x19\x25\x38\x5e\x45\xe1\x2e\xb7\x11\xbb\xf2\x2e\x12\x1f" |
| "\x16\xd6\x65\x55\x0f\x8b\x35\x58\x92\xc0\x0c\xb6\xba\xd7\x8c\xaf\x8a" |
| "\x4d\xf2\x6c\xdf\x2d\x09\x55\xb1\xe7\x02\xd8\x8e\xba\x1f\xb4\x05\x7c" |
| "\xf2\x85\x67\x1f\xc1\x52\x66\xfa\x5f\xb3\xd3\xcb\x2a\x32\xc8\x5d\x86" |
| "\xa8\xbb\xed\x36\x9b\x5e\x26\xe5\xdf\x91\x97\x1e\x15\xb3\x6e\x95\x0b" |
| "\x86\x69\x55\x26\x35\xfb\xa2\x53\xe1\x16\x57\xa8\xfb\x65\x3a\x43\x1f" |
| "\x22\xb7\x6f\xe5\xa6\xaf\xf2\x1e\x45\x70\x43\xf3\x8f\xba\x42\x99\x7c" |
| "\xd3\xc5\x4b\xa5\xbd\xbe\x7f\x0d\xff\xd2\x31\x54\xca\x1b\x6f\x76\xa9" |
| "\x5b\x10\xc0\x5e\x89\xe9\xbb\x79\x24\xec\x83\xe3\x6e\x83\x46\x87\x0e" |
| "\x0b\xc0\xab\x44\x10\xa4\x36\xf5\x0d\x6a\xbf\xe7\xd6\xc8\xac\x25\x63" |
| "\x0d\x92\xb4\x08\x52\xf5\x81\x2a\xb7\x0c\xe0\xa3\xb6\x0e\x49\x2b", |
| 4096)); |
| syscall(__NR_getsockopt, r[0], 0x84, 0x6d, 0x20001100, 0); |
| break; |
| case 3: |
| syscall(__NR_socket, 0xa, 5, 0); |
| break; |
| case 4: |
| NONFAILING(memcpy((void*)0x20000040, "./file0", 8)); |
| syscall(__NR_mknodat, -1, 0x20000040, 0xf80c, -1); |
| break; |
| case 5: |
| syscall(__NR_socket, 0xa, 0xa, 1); |
| break; |
| case 6: |
| syscall(__NR_socket, 0x10, 3, 0); |
| break; |
| case 7: |
| NONFAILING(*(uint32_t*)0x20000080 = -1); |
| NONFAILING(*(uint32_t*)0x20000084 = 7); |
| NONFAILING(*(uint32_t*)0x20000088 = 0x10); |
| syscall(__NR_bpf, 0xe, 0x20000080, 0xc); |
| break; |
| } |
| } |
| int main(void) |
| { |
| syscall(__NR_mmap, 0x20000000, 0x1000000, 3, 0x32, -1, 0); |
| install_segv_handler(); |
| for (procid = 0; procid < 6; procid++) { |
| if (fork() == 0) { |
| use_temporary_dir(); |
| do_sandbox_namespace(); |
| } |
| } |
| sleep(1000000); |
| return 0; |
| } |