// https://syzkaller.appspot.com/bug?id=7b571739e71a77303e665c793d1f773ce3823226 // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include unsigned long long procid; 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; } #define BITMASK(bf_off, bf_len) (((1ull << (bf_len)) - 1) << (bf_off)) #define STORE_BY_BITMASK(type, htobe, addr, val, bf_off, bf_len) \ *(type*)(addr) = \ htobe((htobe(*(type*)(addr)) & ~BITMASK((bf_off), (bf_len))) | \ (((type)(val) << (bf_off)) & BITMASK((bf_off), (bf_len)))) struct csum_inet { uint32_t acc; }; static void csum_inet_init(struct csum_inet* csum) { csum->acc = 0; } static void csum_inet_update(struct csum_inet* csum, const uint8_t* data, size_t length) { if (length == 0) return; size_t i; for (i = 0; i < length - 1; i += 2) csum->acc += *(uint16_t*)&data[i]; if (length & 1) csum->acc += (uint16_t)data[length - 1]; while (csum->acc > 0xffff) csum->acc = (csum->acc & 0xffff) + (csum->acc >> 16); } static uint16_t csum_inet_digest(struct csum_inet* csum) { return ~csum->acc; } 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; } static struct { char* pos; int nesting; struct nlattr* nested[8]; char buf[1024]; } nlmsg; static void netlink_init(int typ, int flags, const void* data, int size) { memset(&nlmsg, 0, sizeof(nlmsg)); struct nlmsghdr* hdr = (struct nlmsghdr*)nlmsg.buf; hdr->nlmsg_type = typ; hdr->nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK | flags; memcpy(hdr + 1, data, size); nlmsg.pos = (char*)(hdr + 1) + NLMSG_ALIGN(size); } static void netlink_attr(int typ, const void* data, int size) { struct nlattr* attr = (struct nlattr*)nlmsg.pos; attr->nla_len = sizeof(*attr) + size; attr->nla_type = typ; memcpy(attr + 1, data, size); nlmsg.pos += NLMSG_ALIGN(attr->nla_len); } static void netlink_nest(int typ) { struct nlattr* attr = (struct nlattr*)nlmsg.pos; attr->nla_type = typ; nlmsg.pos += sizeof(*attr); nlmsg.nested[nlmsg.nesting++] = attr; } static void netlink_done(void) { struct nlattr* attr = nlmsg.nested[--nlmsg.nesting]; attr->nla_len = nlmsg.pos - (char*)attr; } static int netlink_send(int sock) { if (nlmsg.pos > nlmsg.buf + sizeof(nlmsg.buf) || nlmsg.nesting) exit(1); struct nlmsghdr* hdr = (struct nlmsghdr*)nlmsg.buf; hdr->nlmsg_len = nlmsg.pos - nlmsg.buf; struct sockaddr_nl addr; memset(&addr, 0, sizeof(addr)); addr.nl_family = AF_NETLINK; unsigned n = sendto(sock, nlmsg.buf, hdr->nlmsg_len, 0, (struct sockaddr*)&addr, sizeof(addr)); if (n != hdr->nlmsg_len) exit(1); n = recv(sock, nlmsg.buf, sizeof(nlmsg.buf), 0); if (n < sizeof(struct nlmsghdr) + sizeof(struct nlmsgerr)) exit(1); if (hdr->nlmsg_type != NLMSG_ERROR) exit(1); return -((struct nlmsgerr*)(hdr + 1))->error; } static void netlink_add_device_impl(const char* type, const char* name) { struct ifinfomsg hdr; memset(&hdr, 0, sizeof(hdr)); netlink_init(RTM_NEWLINK, NLM_F_EXCL | NLM_F_CREATE, &hdr, sizeof(hdr)); if (name) netlink_attr(IFLA_IFNAME, name, strlen(name)); netlink_nest(IFLA_LINKINFO); netlink_attr(IFLA_INFO_KIND, type, strlen(type)); } static void netlink_add_device(int sock, const char* type, const char* name) { netlink_add_device_impl(type, name); netlink_done(); int err = netlink_send(sock); (void)err; } static void netlink_add_veth(int sock, const char* name, const char* peer) { netlink_add_device_impl("veth", name); netlink_nest(IFLA_INFO_DATA); netlink_nest(VETH_INFO_PEER); nlmsg.pos += sizeof(struct ifinfomsg); netlink_attr(IFLA_IFNAME, peer, strlen(peer)); netlink_done(); netlink_done(); netlink_done(); int err = netlink_send(sock); (void)err; } static void netlink_add_hsr(int sock, const char* name, const char* slave1, const char* slave2) { netlink_add_device_impl("hsr", name); netlink_nest(IFLA_INFO_DATA); int ifindex1 = if_nametoindex(slave1); netlink_attr(IFLA_HSR_SLAVE1, &ifindex1, sizeof(ifindex1)); int ifindex2 = if_nametoindex(slave2); netlink_attr(IFLA_HSR_SLAVE2, &ifindex2, sizeof(ifindex2)); netlink_done(); netlink_done(); int err = netlink_send(sock); (void)err; } static void netlink_device_change(int sock, const char* name, bool up, const char* master, const void* mac, int macsize) { struct ifinfomsg hdr; memset(&hdr, 0, sizeof(hdr)); if (up) hdr.ifi_flags = hdr.ifi_change = IFF_UP; netlink_init(RTM_NEWLINK, 0, &hdr, sizeof(hdr)); netlink_attr(IFLA_IFNAME, name, strlen(name)); if (master) { int ifindex = if_nametoindex(master); netlink_attr(IFLA_MASTER, &ifindex, sizeof(ifindex)); } if (macsize) netlink_attr(IFLA_ADDRESS, mac, macsize); int err = netlink_send(sock); (void)err; } static int netlink_add_addr(int sock, const char* dev, const void* addr, int addrsize) { struct ifaddrmsg hdr; memset(&hdr, 0, sizeof(hdr)); hdr.ifa_family = addrsize == 4 ? AF_INET : AF_INET6; hdr.ifa_prefixlen = addrsize == 4 ? 24 : 120; hdr.ifa_scope = RT_SCOPE_UNIVERSE; hdr.ifa_index = if_nametoindex(dev); netlink_init(RTM_NEWADDR, NLM_F_CREATE | NLM_F_REPLACE, &hdr, sizeof(hdr)); netlink_attr(IFA_LOCAL, addr, addrsize); netlink_attr(IFA_ADDRESS, addr, addrsize); return netlink_send(sock); } static void netlink_add_addr4(int sock, const char* dev, const char* addr) { struct in_addr in_addr; inet_pton(AF_INET, addr, &in_addr); int err = netlink_add_addr(sock, dev, &in_addr, sizeof(in_addr)); (void)err; } static void netlink_add_addr6(int sock, const char* dev, const char* addr) { struct in6_addr in6_addr; inet_pton(AF_INET6, addr, &in6_addr); int err = netlink_add_addr(sock, dev, &in6_addr, sizeof(in6_addr)); (void)err; } static void netlink_add_neigh(int sock, const char* name, const void* addr, int addrsize, const void* mac, int macsize) { struct ndmsg hdr; memset(&hdr, 0, sizeof(hdr)); hdr.ndm_family = addrsize == 4 ? AF_INET : AF_INET6; hdr.ndm_ifindex = if_nametoindex(name); hdr.ndm_state = NUD_PERMANENT; netlink_init(RTM_NEWNEIGH, NLM_F_EXCL | NLM_F_CREATE, &hdr, sizeof(hdr)); netlink_attr(NDA_DST, addr, addrsize); netlink_attr(NDA_LLADDR, mac, macsize); int err = netlink_send(sock); (void)err; } static int tunfd = -1; static int tun_frags_enabled; #define SYZ_TUN_MAX_PACKET_SIZE 1000 #define TUN_IFACE "syz_tun" #define LOCAL_MAC 0xaaaaaaaaaaaa #define REMOTE_MAC 0xaaaaaaaaaabb #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; char sysctl[64]; sprintf(sysctl, "/proc/sys/net/ipv6/conf/%s/accept_dad", TUN_IFACE); write_file(sysctl, "0"); sprintf(sysctl, "/proc/sys/net/ipv6/conf/%s/router_solicitations", TUN_IFACE); write_file(sysctl, "0"); int sock = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE); if (sock == -1) exit(1); netlink_add_addr4(sock, TUN_IFACE, LOCAL_IPV4); netlink_add_addr6(sock, TUN_IFACE, LOCAL_IPV6); uint64_t macaddr = REMOTE_MAC; struct in_addr in_addr; inet_pton(AF_INET, REMOTE_IPV4, &in_addr); netlink_add_neigh(sock, TUN_IFACE, &in_addr, sizeof(in_addr), &macaddr, ETH_ALEN); struct in6_addr in6_addr; inet_pton(AF_INET6, REMOTE_IPV6, &in6_addr); netlink_add_neigh(sock, TUN_IFACE, &in6_addr, sizeof(in6_addr), &macaddr, ETH_ALEN); macaddr = LOCAL_MAC; netlink_device_change(sock, TUN_IFACE, true, 0, &macaddr, ETH_ALEN); close(sock); } #define DEV_IPV4 "172.20.20.%d" #define DEV_IPV6 "fe80::%02x" #define DEV_MAC 0x00aaaaaaaaaa static void initialize_netdevices(void) { char netdevsim[16]; sprintf(netdevsim, "netdevsim%d", (int)procid); struct { const char* type; const char* dev; } devtypes[] = { {"ip6gretap", "ip6gretap0"}, {"bridge", "bridge0"}, {"vcan", "vcan0"}, {"bond", "bond0"}, {"team", "team0"}, {"dummy", "dummy0"}, {"nlmon", "nlmon0"}, {"caif", "caif0"}, {"batadv", "batadv0"}, {"vxcan", "vxcan1"}, {"netdevsim", netdevsim}, {"veth", 0}, }; const char* devmasters[] = {"bridge", "bond", "team"}; struct { const char* name; int macsize; bool noipv6; } devices[] = { {"lo", ETH_ALEN}, {"sit0", 0}, {"bridge0", ETH_ALEN}, {"vcan0", 0, true}, {"tunl0", 0}, {"gre0", 0}, {"gretap0", ETH_ALEN}, {"ip_vti0", 0}, {"ip6_vti0", 0}, {"ip6tnl0", 0}, {"ip6gre0", 0}, {"ip6gretap0", ETH_ALEN}, {"erspan0", ETH_ALEN}, {"bond0", ETH_ALEN}, {"veth0", ETH_ALEN}, {"veth1", ETH_ALEN}, {"team0", ETH_ALEN}, {"veth0_to_bridge", ETH_ALEN}, {"veth1_to_bridge", ETH_ALEN}, {"veth0_to_bond", ETH_ALEN}, {"veth1_to_bond", ETH_ALEN}, {"veth0_to_team", ETH_ALEN}, {"veth1_to_team", ETH_ALEN}, {"veth0_to_hsr", ETH_ALEN}, {"veth1_to_hsr", ETH_ALEN}, {"hsr0", 0}, {"dummy0", ETH_ALEN}, {"nlmon0", 0}, {"vxcan1", 0, true}, {"caif0", ETH_ALEN}, {"batadv0", ETH_ALEN}, {netdevsim, ETH_ALEN}, }; int sock = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE); if (sock == -1) exit(1); unsigned i; for (i = 0; i < sizeof(devtypes) / sizeof(devtypes[0]); i++) netlink_add_device(sock, devtypes[i].type, devtypes[i].dev); for (i = 0; i < sizeof(devmasters) / (sizeof(devmasters[0])); i++) { char master[32], slave0[32], veth0[32], slave1[32], veth1[32]; sprintf(slave0, "%s_slave_0", devmasters[i]); sprintf(veth0, "veth0_to_%s", devmasters[i]); netlink_add_veth(sock, slave0, veth0); sprintf(slave1, "%s_slave_1", devmasters[i]); sprintf(veth1, "veth1_to_%s", devmasters[i]); netlink_add_veth(sock, slave1, veth1); sprintf(master, "%s0", devmasters[i]); netlink_device_change(sock, slave0, false, master, 0, 0); netlink_device_change(sock, slave1, false, master, 0, 0); } netlink_device_change(sock, "bridge_slave_0", true, 0, 0, 0); netlink_device_change(sock, "bridge_slave_1", true, 0, 0, 0); netlink_add_veth(sock, "hsr_slave_0", "veth0_to_hsr"); netlink_add_veth(sock, "hsr_slave_1", "veth1_to_hsr"); netlink_add_hsr(sock, "hsr0", "hsr_slave_0", "hsr_slave_1"); netlink_device_change(sock, "hsr_slave_0", true, 0, 0, 0); netlink_device_change(sock, "hsr_slave_1", true, 0, 0, 0); for (i = 0; i < sizeof(devices) / (sizeof(devices[0])); i++) { char addr[32]; sprintf(addr, DEV_IPV4, i + 10); netlink_add_addr4(sock, devices[i].name, addr); if (!devices[i].noipv6) { sprintf(addr, DEV_IPV6, i + 10); netlink_add_addr6(sock, devices[i].name, addr); } uint64_t macaddr = DEV_MAC + ((i + 10ull) << 40); netlink_device_change(sock, devices[i].name, true, 0, &macaddr, devices[i].macsize); } close(sock); } static void initialize_netdevices_init(void) { int sock = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE); if (sock == -1) exit(1); struct { const char* type; int macsize; bool noipv6; bool noup; } devtypes[] = { {"nr", 7, true}, {"rose", 5, true, true}, }; unsigned i; for (i = 0; i < sizeof(devtypes) / sizeof(devtypes[0]); i++) { char dev[32], addr[32]; sprintf(dev, "%s%d", devtypes[i].type, (int)procid); sprintf(addr, "172.30.%d.%d", i, (int)procid + 1); netlink_add_addr4(sock, dev, addr); if (!devtypes[i].noipv6) { sprintf(addr, "fe88::%02x:%02x", i, (int)procid + 1); netlink_add_addr6(sock, dev, addr); } int macsize = devtypes[i].macsize; uint64_t macaddr = 0xbbbbbb + ((unsigned long long)i << (8 * (macsize - 2))) + (procid << (8 * (macsize - 1))); netlink_device_change(sock, dev, !devtypes[i].noup, 0, &macaddr, macsize); } close(sock); } 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; } #define MAX_FRAGS 4 struct vnet_fragmentation { uint32_t full; uint32_t count; uint32_t frags[MAX_FRAGS]; }; static long syz_emit_ethernet(volatile long a0, volatile long a1, volatile long a2) { if (tunfd < 0) return (uintptr_t)-1; uint32_t length = a0; char* data = (char*)a1; struct vnet_fragmentation* frags = (struct vnet_fragmentation*)a2; struct iovec vecs[MAX_FRAGS + 1]; uint32_t nfrags = 0; if (!tun_frags_enabled || frags == NULL) { vecs[nfrags].iov_base = data; vecs[nfrags].iov_len = length; nfrags++; } else { bool full = true; uint32_t i, count = 0; full = frags->full; count = frags->count; if (count > MAX_FRAGS) count = MAX_FRAGS; for (i = 0; i < count && length != 0; i++) { uint32_t size = 0; size = frags->frags[i]; if (size > length) size = length; vecs[nfrags].iov_base = data; vecs[nfrags].iov_len = size; nfrags++; data += size; length -= size; } if (length != 0 && (full || nfrags == 0)) { vecs[nfrags].iov_base = data; vecs[nfrags].iov_len = length; nfrags++; } } return writev(tunfd, vecs, nfrags); } static void flush_tun() { char data[SYZ_TUN_MAX_PACKET_SIZE]; while (read_tun(&data[0], sizeof(data)) != -1) { } } static void setup_common() { if (mount(0, "/sys/fs/fuse/connections", "fusectl", 0, 0)) { } } 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)) { } typedef struct { const char* name; const char* value; } sysctl_t; static const sysctl_t sysctls[] = { {"/proc/sys/kernel/shmmax", "16777216"}, {"/proc/sys/kernel/shmall", "536870912"}, {"/proc/sys/kernel/shmmni", "1024"}, {"/proc/sys/kernel/msgmax", "8192"}, {"/proc/sys/kernel/msgmni", "1024"}, {"/proc/sys/kernel/msgmnb", "1024"}, {"/proc/sys/kernel/sem", "1024 1048576 500 1024"}, }; unsigned i; for (i = 0; i < sizeof(sysctls) / sizeof(sysctls[0]); i++) write_file(sysctls[i].name, sysctls[i].value); } 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 do_sandbox_none(void) { if (unshare(CLONE_NEWPID)) { } int pid = fork(); if (pid != 0) return wait_for_loop(pid); setup_common(); sandbox_common(); initialize_netdevices_init(); if (unshare(CLONE_NEWNET)) { } initialize_tun(); initialize_netdevices(); loop(); 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) { } } static void setup_test() { prctl(PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0); setpgrp(); write_file("/proc/self/oom_score_adj", "1000"); flush_tun(); } static void close_fds() { int fd; for (fd = 3; fd < 30; fd++) close(fd); } static void execute_one(void); #define WAIT_FLAGS __WALL static void loop(void) { int iter; for (iter = 0;; iter++) { int pid = fork(); if (pid < 0) exit(1); if (pid == 0) { setup_test(); execute_one(); close_fds(); 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; } } } void execute_one(void) { *(uint8_t*)0x20000000 = 0xaa; *(uint8_t*)0x20000001 = 0xaa; *(uint8_t*)0x20000002 = 0xaa; *(uint8_t*)0x20000003 = 0xaa; *(uint8_t*)0x20000004 = 0xaa; *(uint8_t*)0x20000005 = 0xaa; *(uint8_t*)0x20000006 = 0xaa; *(uint8_t*)0x20000007 = 0xaa; *(uint8_t*)0x20000008 = 0xaa; *(uint8_t*)0x20000009 = 0xaa; *(uint8_t*)0x2000000a = 0xaa; *(uint8_t*)0x2000000b = 0xaa; *(uint16_t*)0x2000000c = htobe16(0x800); STORE_BY_BITMASK(uint8_t, , 0x2000000e, 5, 0, 4); STORE_BY_BITMASK(uint8_t, , 0x2000000e, 4, 4, 4); STORE_BY_BITMASK(uint8_t, , 0x2000000f, 0, 0, 2); STORE_BY_BITMASK(uint8_t, , 0x2000000f, 0, 2, 6); *(uint16_t*)0x20000010 = htobe16(0x28); *(uint16_t*)0x20000012 = htobe16(0); *(uint16_t*)0x20000014 = htobe16(0); *(uint8_t*)0x20000016 = 0; *(uint8_t*)0x20000017 = 0; *(uint16_t*)0x20000018 = htobe16(0); *(uint8_t*)0x2000001a = 0xac; *(uint8_t*)0x2000001b = 0x14; *(uint8_t*)0x2000001c = 0x14; *(uint8_t*)0x2000001d = 0; *(uint8_t*)0x2000001e = 0xac; *(uint8_t*)0x2000001f = 0x14; *(uint8_t*)0x20000020 = 0x23; *(uint8_t*)0x20000021 = 0xbb; *(uint8_t*)0x20000022 = 0xe; *(uint8_t*)0x20000023 = 0; *(uint16_t*)0x20000024 = htobe16(0); *(uint16_t*)0x20000026 = htobe16(0); *(uint16_t*)0x20000028 = htobe16(0); *(uint32_t*)0x2000002a = htobe32(0); *(uint32_t*)0x2000002e = htobe32(0); *(uint32_t*)0x20000032 = htobe32(0); *(uint32_t*)0x20000100 = 0; *(uint32_t*)0x20000104 = 3; *(uint32_t*)0x20000108 = 0; *(uint32_t*)0x2000010c = 0xe; *(uint32_t*)0x20000110 = 0xd77; *(uint32_t*)0x20000114 = 0; struct csum_inet csum_1; csum_inet_init(&csum_1); csum_inet_update(&csum_1, (const uint8_t*)0x20000022, 20); *(uint16_t*)0x20000024 = csum_inet_digest(&csum_1); struct csum_inet csum_2; csum_inet_init(&csum_2); csum_inet_update(&csum_2, (const uint8_t*)0x2000000e, 20); *(uint16_t*)0x20000018 = csum_inet_digest(&csum_2); syz_emit_ethernet(0x36, 0x20000000, 0x20000100); *(uint8_t*)0x20002940 = 0xaa; *(uint8_t*)0x20002941 = 0xaa; *(uint8_t*)0x20002942 = 0xaa; *(uint8_t*)0x20002943 = 0xaa; *(uint8_t*)0x20002944 = 0xaa; *(uint8_t*)0x20002945 = 0xbb; *(uint8_t*)0x20002946 = 0; *(uint8_t*)0x20002947 = 0; *(uint8_t*)0x20002948 = 0; *(uint8_t*)0x20002949 = 0; *(uint8_t*)0x2000294a = 0; *(uint8_t*)0x2000294b = 0; *(uint16_t*)0x2000294c = htobe16(0x8847); STORE_BY_BITMASK(uint32_t, htobe32, 0x2000294e, 8, 0, 8); STORE_BY_BITMASK(uint32_t, htobe32, 0x2000294e, 5, 8, 1); STORE_BY_BITMASK(uint32_t, htobe32, 0x2000294e, -1, 9, 3); STORE_BY_BITMASK(uint32_t, htobe32, 0x2000294e, 5, 12, 20); STORE_BY_BITMASK(uint32_t, htobe32, 0x20002952, 0, 0, 8); STORE_BY_BITMASK(uint32_t, htobe32, 0x20002952, 3, 8, 1); STORE_BY_BITMASK(uint32_t, htobe32, 0x20002952, 0x2b, 9, 3); STORE_BY_BITMASK(uint32_t, htobe32, 0x20002952, 2, 12, 20); STORE_BY_BITMASK(uint32_t, htobe32, 0x20002956, 7, 0, 8); STORE_BY_BITMASK(uint32_t, htobe32, 0x20002956, 4, 8, 1); STORE_BY_BITMASK(uint32_t, htobe32, 0x20002956, 0x101, 9, 3); STORE_BY_BITMASK(uint32_t, htobe32, 0x20002956, 0x100, 12, 20); STORE_BY_BITMASK(uint32_t, htobe32, 0x2000295a, 2, 0, 8); STORE_BY_BITMASK(uint32_t, htobe32, 0x2000295a, 0, 8, 1); STORE_BY_BITMASK(uint32_t, htobe32, 0x2000295a, 0x8001, 9, 3); STORE_BY_BITMASK(uint32_t, htobe32, 0x2000295a, 7, 12, 20); STORE_BY_BITMASK(uint32_t, htobe32, 0x2000295e, 8, 0, 8); STORE_BY_BITMASK(uint32_t, htobe32, 0x2000295e, 7, 8, 1); STORE_BY_BITMASK(uint32_t, htobe32, 0x2000295e, 0x39, 9, 3); STORE_BY_BITMASK(uint32_t, htobe32, 0x2000295e, 8, 12, 20); STORE_BY_BITMASK(uint8_t, , 0x20002962, 0, 0, 4); STORE_BY_BITMASK(uint8_t, , 0x20002962, 6, 4, 4); memcpy((void*)0x20002963, "\x63\xaf\x64", 3); *(uint16_t*)0x20002966 = htobe16(0x104); *(uint8_t*)0x20002968 = 0x2e; *(uint8_t*)0x20002969 = 0x1c; *(uint8_t*)0x2000296a = 0; *(uint8_t*)0x2000296b = 0; *(uint8_t*)0x2000296c = 0; *(uint8_t*)0x2000296d = 0; *(uint8_t*)0x2000296e = 0; *(uint8_t*)0x2000296f = 0; *(uint8_t*)0x20002970 = 0; *(uint8_t*)0x20002971 = 0; *(uint8_t*)0x20002972 = 0; *(uint8_t*)0x20002973 = 0; *(uint8_t*)0x20002974 = 0; *(uint8_t*)0x20002975 = 0; *(uint8_t*)0x20002976 = 0; *(uint8_t*)0x20002977 = 0; *(uint8_t*)0x20002978 = 0; *(uint8_t*)0x20002979 = 0; memcpy((void*)0x2000297a, "\x2d\x72\xc7\xe0\x24\x11\x85\x49\xab\xda\x41\x59\xcb\xfd\x2e\x7b", 16); *(uint8_t*)0x2000298a = 0x5e; *(uint8_t*)0x2000298b = 6; *(uint8_t*)0x2000298c = 0; *(uint8_t*)0x2000298d = 0; *(uint8_t*)0x2000298e = 0; *(uint8_t*)0x2000298f = 0; *(uint8_t*)0x20002990 = 0; *(uint8_t*)0x20002991 = 0; *(uint8_t*)0x20002992 = 7; *(uint8_t*)0x20002993 = 0x30; *(uint32_t*)0x20002994 = htobe32(5); *(uint8_t*)0x20002998 = 0xa; *(uint8_t*)0x20002999 = 1; *(uint16_t*)0x2000299a = 8; *(uint64_t*)0x2000299c = 0x8f; *(uint64_t*)0x200029a4 = 0xfffffffffffff800; *(uint64_t*)0x200029ac = 0x1f; *(uint64_t*)0x200029b4 = 0xfffffffffffffffc; *(uint64_t*)0x200029bc = 8; *(uint8_t*)0x200029ca = 0x6f; *(uint8_t*)0x200029cb = 0xe; *(uint8_t*)0x200029cc = 0; *(uint8_t*)0x200029cd = 0xfc; *(uint32_t*)0x200029ce = 0; *(uint8_t*)0x200029d2 = 0xfe; *(uint8_t*)0x200029d3 = 0x80; *(uint8_t*)0x200029d4 = 0; *(uint8_t*)0x200029d5 = 0; *(uint8_t*)0x200029d6 = 0; *(uint8_t*)0x200029d7 = 0; *(uint8_t*)0x200029d8 = 0; *(uint8_t*)0x200029d9 = 0; *(uint8_t*)0x200029da = 0; *(uint8_t*)0x200029db = 0; *(uint8_t*)0x200029dc = 0; *(uint8_t*)0x200029dd = 0; *(uint8_t*)0x200029de = 0; *(uint8_t*)0x200029df = 0; *(uint8_t*)0x200029e0 = 0; *(uint8_t*)0x200029e1 = 0x23; *(uint8_t*)0x200029e2 = 0xfe; *(uint8_t*)0x200029e3 = 0x88; *(uint8_t*)0x200029e4 = 0; *(uint8_t*)0x200029e5 = 0; *(uint8_t*)0x200029e6 = 0; *(uint8_t*)0x200029e7 = 0; *(uint8_t*)0x200029e8 = 0; *(uint8_t*)0x200029e9 = 0; *(uint8_t*)0x200029ea = 0; *(uint8_t*)0x200029eb = 0; *(uint8_t*)0x200029ec = 0; *(uint8_t*)0x200029ed = 0; *(uint8_t*)0x200029ee = 0; *(uint8_t*)0x200029ef = 0; *(uint8_t*)0x200029f0 = 0; *(uint8_t*)0x200029f1 = 1; *(uint64_t*)0x200029f2 = htobe64(0); *(uint64_t*)0x200029fa = htobe64(1); *(uint8_t*)0x20002a02 = 0xfe; *(uint8_t*)0x20002a03 = 0x80; *(uint8_t*)0x20002a04 = 0; *(uint8_t*)0x20002a05 = 0; *(uint8_t*)0x20002a06 = 0; *(uint8_t*)0x20002a07 = 0; *(uint8_t*)0x20002a08 = 0; *(uint8_t*)0x20002a09 = 0; *(uint8_t*)0x20002a0a = 0; *(uint8_t*)0x20002a0b = 0; *(uint8_t*)0x20002a0c = 0; *(uint8_t*)0x20002a0d = 0; *(uint8_t*)0x20002a0e = 0; *(uint8_t*)0x20002a0f = 0; *(uint8_t*)0x20002a10 = 0; *(uint8_t*)0x20002a11 = 0xbb; *(uint8_t*)0x20002a12 = -1; *(uint8_t*)0x20002a13 = 1; *(uint8_t*)0x20002a14 = 0; *(uint8_t*)0x20002a15 = 0; *(uint8_t*)0x20002a16 = 0; *(uint8_t*)0x20002a17 = 0; *(uint8_t*)0x20002a18 = 0; *(uint8_t*)0x20002a19 = 0; *(uint8_t*)0x20002a1a = 0; *(uint8_t*)0x20002a1b = 0; *(uint8_t*)0x20002a1c = 0; *(uint8_t*)0x20002a1d = 0; *(uint8_t*)0x20002a1e = 0; *(uint8_t*)0x20002a1f = 0; *(uint8_t*)0x20002a20 = 0; *(uint8_t*)0x20002a21 = 1; *(uint8_t*)0x20002a22 = 0; *(uint8_t*)0x20002a23 = 0; *(uint8_t*)0x20002a24 = 0; *(uint8_t*)0x20002a25 = 0; *(uint8_t*)0x20002a26 = 0; *(uint8_t*)0x20002a27 = 0; *(uint8_t*)0x20002a28 = 0; *(uint8_t*)0x20002a29 = 0; *(uint8_t*)0x20002a2a = 0; *(uint8_t*)0x20002a2b = 0; *(uint8_t*)0x20002a2c = -1; *(uint8_t*)0x20002a2d = -1; *(uint8_t*)0x20002a2e = 0xac; *(uint8_t*)0x20002a2f = 0x14; *(uint8_t*)0x20002a30 = 0x14; *(uint8_t*)0x20002a31 = 0xbb; *(uint8_t*)0x20002a32 = -1; *(uint8_t*)0x20002a33 = 2; *(uint8_t*)0x20002a34 = 0; *(uint8_t*)0x20002a35 = 0; *(uint8_t*)0x20002a36 = 0; *(uint8_t*)0x20002a37 = 0; *(uint8_t*)0x20002a38 = 0; *(uint8_t*)0x20002a39 = 0; *(uint8_t*)0x20002a3a = 0; *(uint8_t*)0x20002a3b = 0; *(uint8_t*)0x20002a3c = 0; *(uint8_t*)0x20002a3d = 0; *(uint8_t*)0x20002a3e = 0; *(uint8_t*)0x20002a3f = 0; *(uint8_t*)0x20002a40 = 0; *(uint8_t*)0x20002a41 = 1; STORE_BY_BITMASK(uint16_t, , 0x20002a42, 0, 0, 1); STORE_BY_BITMASK(uint16_t, , 0x20002a42, 0, 1, 1); STORE_BY_BITMASK(uint16_t, , 0x20002a42, 1, 2, 1); STORE_BY_BITMASK(uint16_t, , 0x20002a42, 0x71, 3, 1); STORE_BY_BITMASK(uint16_t, , 0x20002a42, 0, 4, 4); STORE_BY_BITMASK(uint16_t, , 0x20002a42, 1, 8, 1); STORE_BY_BITMASK(uint16_t, , 0x20002a42, 0, 9, 4); STORE_BY_BITMASK(uint16_t, , 0x20002a42, 1, 13, 3); *(uint16_t*)0x20002a44 = htobe16(0x880b); *(uint16_t*)0x20002a46 = htobe16(0); *(uint16_t*)0x20002a48 = htobe16(2); *(uint16_t*)0x20002a4a = htobe16(3); STORE_BY_BITMASK(uint16_t, , 0x20002a4c, 1, 0, 1); STORE_BY_BITMASK(uint16_t, , 0x20002a4c, 0, 1, 1); STORE_BY_BITMASK(uint16_t, , 0x20002a4c, 0xff04, 2, 1); STORE_BY_BITMASK(uint16_t, , 0x20002a4c, 6, 3, 1); STORE_BY_BITMASK(uint16_t, , 0x20002a4c, 0, 4, 9); STORE_BY_BITMASK(uint16_t, , 0x20002a4c, 0, 13, 3); *(uint16_t*)0x20002a4e = htobe16(0x800); *(uint16_t*)0x20002a50 = htobe16(0x40); STORE_BY_BITMASK(uint16_t, , 0x20002a52, 1, 0, 1); STORE_BY_BITMASK(uint16_t, , 0x20002a52, 0, 1, 1); STORE_BY_BITMASK(uint16_t, , 0x20002a52, 0x930c, 2, 1); STORE_BY_BITMASK(uint16_t, , 0x20002a52, 1, 3, 1); STORE_BY_BITMASK(uint16_t, , 0x20002a52, 0, 4, 9); STORE_BY_BITMASK(uint16_t, , 0x20002a52, 0, 13, 3); *(uint16_t*)0x20002a54 = htobe16(0x86dd); *(uint16_t*)0x20002a56 = htobe16(0xcc); *(uint16_t*)0x20002a58 = htobe16(0x7f); *(uint16_t*)0x20002a5a = 8; *(uint16_t*)0x20002a5c = htobe16(0x88be); *(uint32_t*)0x20002a5e = htobe32(0); STORE_BY_BITMASK(uint8_t, , 0x20002a62, 2, 0, 4); STORE_BY_BITMASK(uint8_t, , 0x20002a62, 1, 4, 4); *(uint8_t*)0x20002a63 = 5; STORE_BY_BITMASK(uint8_t, , 0x20002a64, 3, 0, 2); STORE_BY_BITMASK(uint8_t, , 0x20002a64, 7, 2, 1); STORE_BY_BITMASK(uint8_t, , 0x20002a64, 2, 3, 2); STORE_BY_BITMASK(uint8_t, , 0x20002a64, 0, 5, 3); *(uint8_t*)0x20002a65 = 9; *(uint32_t*)0x20002a66 = 1; *(uint32_t*)0x20002a6a = htobe32(6); *(uint16_t*)0x20002a6e = 8; *(uint16_t*)0x20002a70 = htobe16(0x22eb); *(uint32_t*)0x20002a72 = htobe32(3); STORE_BY_BITMASK(uint8_t, , 0x20002a76, 9, 0, 4); STORE_BY_BITMASK(uint8_t, , 0x20002a76, 2, 4, 4); *(uint8_t*)0x20002a77 = 1; STORE_BY_BITMASK(uint8_t, , 0x20002a78, 7, 0, 2); STORE_BY_BITMASK(uint8_t, , 0x20002a78, 5, 2, 1); STORE_BY_BITMASK(uint8_t, , 0x20002a78, 0, 3, 2); STORE_BY_BITMASK(uint8_t, , 0x20002a78, 4, 5, 3); *(uint8_t*)0x20002a79 = 9; *(uint32_t*)0x20002a7a = 2; *(uint32_t*)0x20002a7e = htobe32(8); *(uint16_t*)0x20002a82 = htobe16(0x800); STORE_BY_BITMASK(uint8_t, , 0x20002a84, 0, 0, 2); STORE_BY_BITMASK(uint8_t, , 0x20002a84, 9, 2, 5); STORE_BY_BITMASK(uint8_t, , 0x20002a84, 3, 7, 1); STORE_BY_BITMASK(uint8_t, , 0x20002a85, 9, 0, 1); STORE_BY_BITMASK(uint8_t, , 0x20002a85, 0x7f, 1, 2); STORE_BY_BITMASK(uint8_t, , 0x20002a85, 6, 3, 1); STORE_BY_BITMASK(uint8_t, , 0x20002a85, -1, 4, 1); *(uint16_t*)0x20002a86 = 8; *(uint16_t*)0x20002a88 = htobe16(0x6558); *(uint32_t*)0x20002a8a = htobe32(0); syz_emit_ethernet(0x14e, 0x20002940, 0); } int main(void) { syscall(__NR_mmap, 0x20000000, 0x1000000, 3, 0x32, -1, 0); do_sandbox_none(); return 0; }