// https://syzkaller.appspot.com/bug?id=56e065d25b632864c8735369c55566776fa671e6 // 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 #ifndef __NR_memfd_create #define __NR_memfd_create 319 #endif static unsigned long long procid; static __thread int clone_ongoing; static __thread int skip_segv; static __thread jmp_buf segv_env; static void segv_handler(int sig, siginfo_t* info, void* ctx) { if (__atomic_load_n(&clone_ongoing, __ATOMIC_RELAXED) != 0) { exit(sig); } uintptr_t addr = (uintptr_t)info->si_addr; const uintptr_t prog_start = 1 << 20; const uintptr_t prog_end = 100 << 20; int skip = __atomic_load_n(&skip_segv, __ATOMIC_RELAXED) != 0; int valid = addr < prog_start || addr > prog_end; if (skip && valid) { _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(...) \ ({ \ int ok = 1; \ __atomic_fetch_add(&skip_segv, 1, __ATOMIC_SEQ_CST); \ if (_setjmp(segv_env) == 0) { \ __VA_ARGS__; \ } else \ ok = 0; \ __atomic_fetch_sub(&skip_segv, 1, __ATOMIC_SEQ_CST); \ ok; \ }) 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 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; } struct nlmsg { char* pos; int nesting; struct nlattr* nested[8]; char buf[4096]; }; static void netlink_init(struct nlmsg* nlmsg, 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(struct nlmsg* nlmsg, int typ, const void* data, int size) { struct nlattr* attr = (struct nlattr*)nlmsg->pos; attr->nla_len = sizeof(*attr) + size; attr->nla_type = typ; if (size > 0) memcpy(attr + 1, data, size); nlmsg->pos += NLMSG_ALIGN(attr->nla_len); } static void netlink_nest(struct nlmsg* nlmsg, 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(struct nlmsg* nlmsg) { struct nlattr* attr = nlmsg->nested[--nlmsg->nesting]; attr->nla_len = nlmsg->pos - (char*)attr; } static int netlink_send_ext(struct nlmsg* nlmsg, int sock, uint16_t reply_type, int* reply_len, bool dofail) { 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; ssize_t n = sendto(sock, nlmsg->buf, hdr->nlmsg_len, 0, (struct sockaddr*)&addr, sizeof(addr)); if (n != (ssize_t)hdr->nlmsg_len) { if (dofail) exit(1); return -1; } n = recv(sock, nlmsg->buf, sizeof(nlmsg->buf), 0); if (reply_len) *reply_len = 0; if (n < 0) { if (dofail) exit(1); return -1; } if (n < (ssize_t)sizeof(struct nlmsghdr)) { errno = EINVAL; if (dofail) exit(1); return -1; } if (hdr->nlmsg_type == NLMSG_DONE) return 0; if (reply_len && hdr->nlmsg_type == reply_type) { *reply_len = n; return 0; } if (n < (ssize_t)(sizeof(struct nlmsghdr) + sizeof(struct nlmsgerr))) { errno = EINVAL; if (dofail) exit(1); return -1; } if (hdr->nlmsg_type != NLMSG_ERROR) { errno = EINVAL; if (dofail) exit(1); return -1; } errno = -((struct nlmsgerr*)(hdr + 1))->error; return -errno; } static int netlink_send(struct nlmsg* nlmsg, int sock) { return netlink_send_ext(nlmsg, sock, 0, NULL, true); } static int netlink_query_family_id(struct nlmsg* nlmsg, int sock, const char* family_name, bool dofail) { struct genlmsghdr genlhdr; memset(&genlhdr, 0, sizeof(genlhdr)); genlhdr.cmd = CTRL_CMD_GETFAMILY; netlink_init(nlmsg, GENL_ID_CTRL, 0, &genlhdr, sizeof(genlhdr)); netlink_attr(nlmsg, CTRL_ATTR_FAMILY_NAME, family_name, strnlen(family_name, GENL_NAMSIZ - 1) + 1); int n = 0; int err = netlink_send_ext(nlmsg, sock, GENL_ID_CTRL, &n, dofail); if (err < 0) { return -1; } uint16_t id = 0; struct nlattr* attr = (struct nlattr*)(nlmsg->buf + NLMSG_HDRLEN + NLMSG_ALIGN(sizeof(genlhdr))); for (; (char*)attr < nlmsg->buf + n; attr = (struct nlattr*)((char*)attr + NLMSG_ALIGN(attr->nla_len))) { if (attr->nla_type == CTRL_ATTR_FAMILY_ID) { id = *(uint16_t*)(attr + 1); break; } } if (!id) { errno = EINVAL; return -1; } recv(sock, nlmsg->buf, sizeof(nlmsg->buf), 0); return id; } static void netlink_add_device_impl(struct nlmsg* nlmsg, const char* type, const char* name, bool up) { struct ifinfomsg hdr; memset(&hdr, 0, sizeof(hdr)); if (up) hdr.ifi_flags = hdr.ifi_change = IFF_UP; netlink_init(nlmsg, RTM_NEWLINK, NLM_F_EXCL | NLM_F_CREATE, &hdr, sizeof(hdr)); if (name) netlink_attr(nlmsg, IFLA_IFNAME, name, strlen(name)); netlink_nest(nlmsg, IFLA_LINKINFO); netlink_attr(nlmsg, IFLA_INFO_KIND, type, strlen(type)); } static void netlink_device_change(struct nlmsg* nlmsg, int sock, const char* name, bool up, const char* master, const void* mac, int macsize, const char* new_name) { struct ifinfomsg hdr; memset(&hdr, 0, sizeof(hdr)); if (up) hdr.ifi_flags = hdr.ifi_change = IFF_UP; hdr.ifi_index = if_nametoindex(name); netlink_init(nlmsg, RTM_NEWLINK, 0, &hdr, sizeof(hdr)); if (new_name) netlink_attr(nlmsg, IFLA_IFNAME, new_name, strlen(new_name)); if (master) { int ifindex = if_nametoindex(master); netlink_attr(nlmsg, IFLA_MASTER, &ifindex, sizeof(ifindex)); } if (macsize) netlink_attr(nlmsg, IFLA_ADDRESS, mac, macsize); int err = netlink_send(nlmsg, sock); if (err < 0) { } } static struct nlmsg nlmsg; //% This code is derived from puff.{c,h}, found in the zlib development. The //% original files come with the following copyright notice: //% Copyright (C) 2002-2013 Mark Adler, all rights reserved //% version 2.3, 21 Jan 2013 //% This software is provided 'as-is', without any express or implied //% warranty. In no event will the author be held liable for any damages //% arising from the use of this software. //% Permission is granted to anyone to use this software for any purpose, //% including commercial applications, and to alter it and redistribute it //% freely, subject to the following restrictions: //% 1. The origin of this software must not be misrepresented; you must not //% claim that you wrote the original software. If you use this software //% in a product, an acknowledgment in the product documentation would be //% appreciated but is not required. //% 2. Altered source versions must be plainly marked as such, and must not be //% misrepresented as being the original software. //% 3. This notice may not be removed or altered from any source distribution. //% Mark Adler madler@alumni.caltech.edu //% BEGIN CODE DERIVED FROM puff.{c,h} #define MAXBITS 15 #define MAXLCODES 286 #define MAXDCODES 30 #define MAXCODES (MAXLCODES + MAXDCODES) #define FIXLCODES 288 struct puff_state { unsigned char* out; unsigned long outlen; unsigned long outcnt; const unsigned char* in; unsigned long inlen; unsigned long incnt; int bitbuf; int bitcnt; jmp_buf env; }; static int puff_bits(struct puff_state* s, int need) { long val = s->bitbuf; while (s->bitcnt < need) { if (s->incnt == s->inlen) longjmp(s->env, 1); val |= (long)(s->in[s->incnt++]) << s->bitcnt; s->bitcnt += 8; } s->bitbuf = (int)(val >> need); s->bitcnt -= need; return (int)(val & ((1L << need) - 1)); } static int puff_stored(struct puff_state* s) { s->bitbuf = 0; s->bitcnt = 0; if (s->incnt + 4 > s->inlen) return 2; unsigned len = s->in[s->incnt++]; len |= s->in[s->incnt++] << 8; if (s->in[s->incnt++] != (~len & 0xff) || s->in[s->incnt++] != ((~len >> 8) & 0xff)) return -2; if (s->incnt + len > s->inlen) return 2; if (s->outcnt + len > s->outlen) return 1; for (; len--; s->outcnt++, s->incnt++) { if (s->in[s->incnt]) s->out[s->outcnt] = s->in[s->incnt]; } return 0; } struct puff_huffman { short* count; short* symbol; }; static int puff_decode(struct puff_state* s, const struct puff_huffman* h) { int first = 0; int index = 0; int bitbuf = s->bitbuf; int left = s->bitcnt; int code = first = index = 0; int len = 1; short* next = h->count + 1; while (1) { while (left--) { code |= bitbuf & 1; bitbuf >>= 1; int count = *next++; if (code - count < first) { s->bitbuf = bitbuf; s->bitcnt = (s->bitcnt - len) & 7; return h->symbol[index + (code - first)]; } index += count; first += count; first <<= 1; code <<= 1; len++; } left = (MAXBITS + 1) - len; if (left == 0) break; if (s->incnt == s->inlen) longjmp(s->env, 1); bitbuf = s->in[s->incnt++]; if (left > 8) left = 8; } return -10; } static int puff_construct(struct puff_huffman* h, const short* length, int n) { int len; for (len = 0; len <= MAXBITS; len++) h->count[len] = 0; int symbol; for (symbol = 0; symbol < n; symbol++) (h->count[length[symbol]])++; if (h->count[0] == n) return 0; int left = 1; for (len = 1; len <= MAXBITS; len++) { left <<= 1; left -= h->count[len]; if (left < 0) return left; } short offs[MAXBITS + 1]; offs[1] = 0; for (len = 1; len < MAXBITS; len++) offs[len + 1] = offs[len] + h->count[len]; for (symbol = 0; symbol < n; symbol++) if (length[symbol] != 0) h->symbol[offs[length[symbol]]++] = symbol; return left; } static int puff_codes(struct puff_state* s, const struct puff_huffman* lencode, const struct puff_huffman* distcode) { static const short lens[29] = {3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258}; static const short lext[29] = {0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0}; static const short dists[30] = { 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577}; static const short dext[30] = {0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13}; int symbol; do { symbol = puff_decode(s, lencode); if (symbol < 0) return symbol; if (symbol < 256) { if (s->outcnt == s->outlen) return 1; if (symbol) s->out[s->outcnt] = symbol; s->outcnt++; } else if (symbol > 256) { symbol -= 257; if (symbol >= 29) return -10; int len = lens[symbol] + puff_bits(s, lext[symbol]); symbol = puff_decode(s, distcode); if (symbol < 0) return symbol; unsigned dist = dists[symbol] + puff_bits(s, dext[symbol]); if (dist > s->outcnt) return -11; if (s->outcnt + len > s->outlen) return 1; while (len--) { if (dist <= s->outcnt && s->out[s->outcnt - dist]) s->out[s->outcnt] = s->out[s->outcnt - dist]; s->outcnt++; } } } while (symbol != 256); return 0; } static int puff_fixed(struct puff_state* s) { static int virgin = 1; static short lencnt[MAXBITS + 1], lensym[FIXLCODES]; static short distcnt[MAXBITS + 1], distsym[MAXDCODES]; static struct puff_huffman lencode, distcode; if (virgin) { lencode.count = lencnt; lencode.symbol = lensym; distcode.count = distcnt; distcode.symbol = distsym; short lengths[FIXLCODES]; int symbol; for (symbol = 0; symbol < 144; symbol++) lengths[symbol] = 8; for (; symbol < 256; symbol++) lengths[symbol] = 9; for (; symbol < 280; symbol++) lengths[symbol] = 7; for (; symbol < FIXLCODES; symbol++) lengths[symbol] = 8; puff_construct(&lencode, lengths, FIXLCODES); for (symbol = 0; symbol < MAXDCODES; symbol++) lengths[symbol] = 5; puff_construct(&distcode, lengths, MAXDCODES); virgin = 0; } return puff_codes(s, &lencode, &distcode); } static int puff_dynamic(struct puff_state* s) { static const short order[19] = {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15}; int nlen = puff_bits(s, 5) + 257; int ndist = puff_bits(s, 5) + 1; int ncode = puff_bits(s, 4) + 4; if (nlen > MAXLCODES || ndist > MAXDCODES) return -3; short lengths[MAXCODES]; int index; for (index = 0; index < ncode; index++) lengths[order[index]] = puff_bits(s, 3); for (; index < 19; index++) lengths[order[index]] = 0; short lencnt[MAXBITS + 1], lensym[MAXLCODES]; struct puff_huffman lencode = {lencnt, lensym}; int err = puff_construct(&lencode, lengths, 19); if (err != 0) return -4; index = 0; while (index < nlen + ndist) { int symbol; int len; symbol = puff_decode(s, &lencode); if (symbol < 0) return symbol; if (symbol < 16) lengths[index++] = symbol; else { len = 0; if (symbol == 16) { if (index == 0) return -5; len = lengths[index - 1]; symbol = 3 + puff_bits(s, 2); } else if (symbol == 17) symbol = 3 + puff_bits(s, 3); else symbol = 11 + puff_bits(s, 7); if (index + symbol > nlen + ndist) return -6; while (symbol--) lengths[index++] = len; } } if (lengths[256] == 0) return -9; err = puff_construct(&lencode, lengths, nlen); if (err && (err < 0 || nlen != lencode.count[0] + lencode.count[1])) return -7; short distcnt[MAXBITS + 1], distsym[MAXDCODES]; struct puff_huffman distcode = {distcnt, distsym}; err = puff_construct(&distcode, lengths + nlen, ndist); if (err && (err < 0 || ndist != distcode.count[0] + distcode.count[1])) return -8; return puff_codes(s, &lencode, &distcode); } static int puff(unsigned char* dest, unsigned long* destlen, const unsigned char* source, unsigned long sourcelen) { struct puff_state s = { .out = dest, .outlen = *destlen, .outcnt = 0, .in = source, .inlen = sourcelen, .incnt = 0, .bitbuf = 0, .bitcnt = 0, }; int err; if (setjmp(s.env) != 0) err = 2; else { int last; do { last = puff_bits(&s, 1); int type = puff_bits(&s, 2); err = type == 0 ? puff_stored(&s) : (type == 1 ? puff_fixed(&s) : (type == 2 ? puff_dynamic(&s) : -1)); if (err != 0) break; } while (!last); } *destlen = s.outcnt; return err; } //% END CODE DERIVED FROM puff.{c,h} #define ZLIB_HEADER_WIDTH 2 static int puff_zlib_to_file(const unsigned char* source, unsigned long sourcelen, int dest_fd) { if (sourcelen < ZLIB_HEADER_WIDTH) { errno = EMSGSIZE; return -1; } source += ZLIB_HEADER_WIDTH; sourcelen -= ZLIB_HEADER_WIDTH; const unsigned long max_destlen = 132 << 20; void* ret = mmap(0, max_destlen, PROT_WRITE | PROT_READ, MAP_PRIVATE | MAP_ANON, -1, 0); if (ret == MAP_FAILED) return -1; unsigned char* dest = (unsigned char*)ret; unsigned long destlen = max_destlen; int err = puff(dest, &destlen, source, sourcelen); if (err) { munmap(dest, max_destlen); errno = -err; return -1; } if (write(dest_fd, dest, destlen) != (ssize_t)destlen) { munmap(dest, max_destlen); return -1; } return munmap(dest, destlen); } static int setup_loop_device(unsigned char* data, unsigned long size, const char* loopname, int* loopfd_p) { int err = 0, loopfd = -1; int memfd = syscall(__NR_memfd_create, "syzkaller", 0); if (memfd == -1) { err = errno; goto error; } if (puff_zlib_to_file(data, size, memfd)) { err = errno; goto error_close_memfd; } loopfd = open(loopname, O_RDWR); if (loopfd == -1) { err = errno; goto error_close_memfd; } if (ioctl(loopfd, LOOP_SET_FD, memfd)) { if (errno != EBUSY) { err = errno; goto error_close_loop; } ioctl(loopfd, LOOP_CLR_FD, 0); usleep(1000); if (ioctl(loopfd, LOOP_SET_FD, memfd)) { err = errno; goto error_close_loop; } } close(memfd); *loopfd_p = loopfd; return 0; error_close_loop: close(loopfd); error_close_memfd: close(memfd); error: errno = err; return -1; } static long syz_mount_image(volatile long fsarg, volatile long dir, volatile long flags, volatile long optsarg, volatile long change_dir, volatile unsigned long size, volatile long image) { unsigned char* data = (unsigned char*)image; int res = -1, err = 0, loopfd = -1, need_loop_device = !!size; char* mount_opts = (char*)optsarg; char* target = (char*)dir; char* fs = (char*)fsarg; char* source = NULL; char loopname[64]; if (need_loop_device) { memset(loopname, 0, sizeof(loopname)); snprintf(loopname, sizeof(loopname), "/dev/loop%llu", procid); if (setup_loop_device(data, size, loopname, &loopfd) == -1) return -1; source = loopname; } mkdir(target, 0777); char opts[256]; memset(opts, 0, sizeof(opts)); if (strlen(mount_opts) > (sizeof(opts) - 32)) { } strncpy(opts, mount_opts, sizeof(opts) - 32); if (strcmp(fs, "iso9660") == 0) { flags |= MS_RDONLY; } else if (strncmp(fs, "ext", 3) == 0) { if (strstr(opts, "errors=panic") || strstr(opts, "errors=remount-ro") == 0) strcat(opts, ",errors=continue"); } else if (strcmp(fs, "xfs") == 0) { strcat(opts, ",nouuid"); } res = mount(source, target, fs, flags, opts); if (res == -1) { err = errno; goto error_clear_loop; } res = open(target, O_RDONLY | O_DIRECTORY); if (res == -1) { err = errno; goto error_clear_loop; } if (change_dir) { res = chdir(target); if (res == -1) { err = errno; } } error_clear_loop: if (need_loop_device) { ioctl(loopfd, LOOP_CLR_FD, 0); close(loopfd); } errno = err; return res; } #define FS_IOC_SETFLAGS _IOW('f', 2, long) static void remove_dir(const char* dir) { int iter = 0; DIR* dp = 0; retry: while (umount2(dir, MNT_DETACH | UMOUNT_NOFOLLOW) == 0) { } dp = opendir(dir); if (dp == NULL) { if (errno == EMFILE) { exit(1); } exit(1); } struct dirent* ep = 0; 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 | UMOUNT_NOFOLLOW) == 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 | UMOUNT_NOFOLLOW)) exit(1); } } closedir(dp); for (int 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 | UMOUNT_NOFOLLOW)) 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); for (int 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 reset_loop() { char buf[64]; snprintf(buf, sizeof(buf), "/dev/loop%llu", procid); int loopfd = open(buf, O_RDWR); if (loopfd != -1) { ioctl(loopfd, LOOP_CLR_FD, 0); close(loopfd); } } static void setup_test() { prctl(PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0); setpgrp(); write_file("/proc/self/oom_score_adj", "1000"); if (symlink("/dev/binderfs", "./binderfs")) { } } #define NL802154_CMD_SET_SHORT_ADDR 11 #define NL802154_ATTR_IFINDEX 3 #define NL802154_ATTR_SHORT_ADDR 10 static void setup_802154() { int sock_route = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE); if (sock_route == -1) exit(1); int sock_generic = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC); if (sock_generic < 0) exit(1); int nl802154_family_id = netlink_query_family_id(&nlmsg, sock_generic, "nl802154", true); for (int i = 0; i < 2; i++) { char devname[] = "wpan0"; devname[strlen(devname) - 1] += i; uint64_t hwaddr = 0xaaaaaaaaaaaa0002 + (i << 8); uint16_t shortaddr = 0xaaa0 + i; int ifindex = if_nametoindex(devname); struct genlmsghdr genlhdr; memset(&genlhdr, 0, sizeof(genlhdr)); genlhdr.cmd = NL802154_CMD_SET_SHORT_ADDR; netlink_init(&nlmsg, nl802154_family_id, 0, &genlhdr, sizeof(genlhdr)); netlink_attr(&nlmsg, NL802154_ATTR_IFINDEX, &ifindex, sizeof(ifindex)); netlink_attr(&nlmsg, NL802154_ATTR_SHORT_ADDR, &shortaddr, sizeof(shortaddr)); int err = netlink_send(&nlmsg, sock_generic); if (err < 0) { } netlink_device_change(&nlmsg, sock_route, devname, true, 0, &hwaddr, sizeof(hwaddr), 0); if (i == 0) { netlink_add_device_impl(&nlmsg, "lowpan", "lowpan0", false); netlink_done(&nlmsg); netlink_attr(&nlmsg, IFLA_LINK, &ifindex, sizeof(ifindex)); int err = netlink_send(&nlmsg, sock_route); if (err < 0) { } } } close(sock_route); close(sock_generic); } static void execute_one(void); #define WAIT_FLAGS __WALL static void loop(void) { int iter = 0; for (;; 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(); 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 < 5000) continue; kill_and_wait(pid, &status); break; } remove_dir(cwdbuf); } } uint64_t r[2] = {0xffffffffffffffff, 0xffffffffffffffff}; void execute_one(void) { intptr_t res = 0; NONFAILING(memcpy((void*)0x20000ec0, "nilfs2\000", 7)); NONFAILING(memcpy((void*)0x20000f00, "./file0\000", 8)); NONFAILING(memcpy((void*)0x20000040, "nodiscard", 9)); NONFAILING(*(uint8_t*)0x20000049 = 0x2c); NONFAILING(memcpy((void*)0x2000004a, "nobarrier", 9)); NONFAILING(*(uint8_t*)0x20000053 = 0x2c); NONFAILING(memcpy((void*)0x20000054, "order=strict", 12)); NONFAILING(*(uint8_t*)0x20000060 = 0x2c); NONFAILING(memcpy((void*)0x20000061, "discard", 7)); NONFAILING(*(uint8_t*)0x20000068 = 0x2c); NONFAILING(memcpy((void*)0x20000069, "barrier", 7)); NONFAILING(*(uint8_t*)0x20000070 = 0x2c); NONFAILING(memcpy((void*)0x20000071, "barrier", 7)); NONFAILING(*(uint8_t*)0x20000078 = 0x2c); NONFAILING(memcpy((void*)0x20000079, "discard", 7)); NONFAILING(*(uint8_t*)0x20000080 = 0x2c); NONFAILING(*(uint8_t*)0x20000081 = 0); NONFAILING(memcpy( (void*)0x20000f80, "\x78\x9c\xec\xdd\x4f\x6c\x1c\x57\x19\x00\xf0\x37\xeb\x7f\x49\xec\xc6\xeb" "\x36\x50\xb7\xa5\x49\x68\x09\x69\x03\x38\xc1\xc9\xa1\xdc\x52\x29\x02\xa9" "\xaa\xaa\x5e\xb8\xa7\x4a\xe3\x24\xc2\x0d\x11\x29\x87\x56\x89\xe2\x72\x0a" "\x12\x87\xa2\xa8\x97\x22\x0e\x45\xcd\x0d\x29\x1c\x90\x68\x85\x84\x22\x24" "\x24\xfe\xf4\xc0\x99\x53\x05\x17\x10\x0a\x52\xa4\x5c\x88\x14\x1b\xd9\x79" "\x6f\xbd\x7e\xc9\xb0\xeb\xb1\x3d\x1b\xef\xfe\x7e\xd2\xb7\x6f\xdf\xbc\xd9" "\xf9\xbe\xf1\x46\xce\xcc\x78\xf6\x6d\x00\x06\x56\x63\xe5\xf1\xd8\xb1\xe9" "\x22\x84\x0f\x3e\xbd\x76\xe2\x3b\x57\x16\x7f\xb3\xbc\x6c\x5f\x6b\x8d\xfd" "\x2b\x8f\x45\xec\x35\x43\x08\x23\x6d\xfd\x22\xdb\xde\xe7\x71\xc1\xbd\xdb" "\x97\x4e\x2d\xb7\x8b\x59\x5b\x84\xd9\x95\xc7\x34\x1e\x5e\xbb\xd5\x7a\xed" "\x78\x08\x61\x21\xec\x0f\x37\x43\x33\xec\x3b\xd4\xbc\x73\x75\xe8\xd5\xb9" "\xeb\x1f\x7e\x76\xf0\xf2\x85\x57\xce\x6e\xd1\xee\x03\x00\xc0\x40\xb9\xf1" "\xe7\xf9\xbf\xbd\xf8\xcf\x3f\x7d\x7d\xea\xee\x8d\xbd\xc7\xc3\x58\x6b\x79" "\x3a\x3e\x6f\xc6\xfe\x78\x3c\xee\x3f\x12\x8f\xef\xd3\x71\x7f\x23\xac\xed" "\x17\x6d\xd1\x6e\x34\x5b\x6f\x28\x46\x23\x5b\x6f\x28\x5b\x6f\x38\xcb\x33" "\x5c\x92\x6f\x24\xdb\xce\x48\xc9\x7a\xa3\x1d\xf2\x0d\xb5\x2d\x7b\xd8\x7e" "\x02\x00\x00\xc0\x76\x94\xce\x6b\x9b\xa1\x68\xcc\xac\xe9\x37\x1a\x33\x33" "\xf7\xcf\xfb\x97\x7d\x3e\x39\x5a\xcc\x9c\x3f\x37\x3f\x77\xb1\x47\x85\x02" "\x00\x00\x00\x95\xdd\xb9\xb2\x72\xd3\xad\x10\x42\x08\x21\x84\x10\x42\x08" "\x21\xfa\x38\x96\x26\x7b\x7d\x05\x02\x00\x00\x00\x18\x34\x69\xde\x81\xd6" "\xfc\x60\xb9\x85\x7c\x66\x81\x8d\x69\x6d\xad\xd9\x5d\xfe\x5b\x2f\x37\x1e" "\xfe\x7a\xd8\x04\x75\xff\xfb\x97\x7f\x7b\xe5\xff\xf8\x3d\xbf\x71\x00\x00" "\xa8\xae\x5f\x8f\x26\xd3\x7e\xa5\xe3\xe8\x34\x8f\x41\x3e\x8f\xe0\x50\xf6" "\xba\xf5\x1e\xff\x37\xb2\xed\x0c\xaf\xb3\xce\xb2\x79\x05\xb7\xcb\x7c\x83" "\x65\x75\xe6\x3f\xd7\x47\x55\x59\xfd\xeb\x7d\x1f\x7b\xa5\xac\xfe\x7c\x3e" "\xcc\x47\x55\x59\xfd\xf9\x3c\x9d\x8f\xaa\xb2\xfa\xc7\x6a\xae\xa3\xaa\xb2" "\xfa\x77\xd4\x5c\x47\x55\x65\xf5\xef\xac\xb9\x8e\xaa\xca\xea\xdf\x55\x73" "\x1d\x55\x95\xd5\x3f\x5e\x73\x1d\x55\x95\xd5\x3f\x51\x73\x1d\x55\x95\xd5" "\xff\x58\xcd\x75\x54\x55\x56\xff\xee\x9a\xeb\xa8\xaa\xac\xfe\xed\x72\x5b" "\x6d\x59\xfd\xcd\x9a\xeb\xa8\xaa\xac\xfe\xa9\x9a\xeb\xa8\xaa\xac\xfe\xc7" "\x6b\xae\xa3\xaa\xb2\xfa\x9f\xa8\xb9\x8e\xaa\xca\xea\xdf\x53\x73\x1d\xbd" "\xf2\x6c\x6c\xd3\xcf\x61\x6f\x36\xde\x7e\xfe\x9c\x9f\xd3\x6d\x97\x73\x3c" "\x00\x00\x00\x18\x74\xff\x35\xff\x9f\x10\x42\x08\x21\x84\x10\x42\x08\xd1" "\xf7\x71\xa5\xd7\x17\x20\x00\x00\x00\x80\x9e\x4b\x9f\x0b\x48\x9f\x7a\x5f" "\x8a\xd2\xf8\x50\x87\xf1\xe1\x0e\xe3\x23\x1d\xc6\x47\x3b\x8c\x8f\x75\x18" "\x07\x00\x00\x00\x42\xf8\xed\xd5\xb9\xa7\xde\x2f\x56\x3f\xe7\xbf\xd1\xf9" "\xf0\xd2\xbc\x51\x69\xfe\xa5\xf5\xce\x63\x94\xcf\x47\xb8\xde\xfc\x1b\x9d" "\xf7\x6c\xa3\xf9\xb7\xcb\xbc\x65\x00\x00\x00\x0c\x96\xe2\xdb\x37\x17\x0f" "\x9d\xf8\xe8\xed\xa9\xbb\x37\xf6\x1e\x6f\x3b\xfb\x5d\x8c\xe7\xbb\x69\x1e" "\xd0\xe1\x78\x6d\xe0\x93\xd8\x4f\xf7\x05\x4c\x64\xfd\x22\x9d\x43\x1f\x5f" "\x9b\xa7\x51\xb2\x5e\x7e\x7d\xe0\xb1\xb2\xed\xbd\xbe\xc1\x1d\x05\x00\x00" "\x80\x01\x96\xce\xdf\x9b\xa1\x68\xcc\xb4\x9d\x77\x37\x43\xa3\x31\x33\xb3" "\x7a\x3e\x3e\x1d\x46\x8a\xb9\x73\xf3\xa7\x8f\xc4\x7e\xfa\x7e\x96\x3f\x4e" "\x8e\x8c\x2d\x2f\xff\x66\xcd\x75\x03\x00\x00\x00\xdd\x5b\x3d\xdf\x7f\xf8" "\xf9\x7f\xfa\x1e\xdf\xe9\x30\x5a\xcc\x9c\x3f\x37\x3f\x77\xf1\x7e\x7f\xa2" "\xb5\x7c\xa4\xd1\x7e\x5d\x60\x72\x75\x79\xd1\x7e\x5d\xa0\x99\x2d\x9f\x2d" "\x59\x7e\x34\xf6\xd3\xf7\x77\x9e\x9d\xdc\xb9\xb2\x7c\xe6\xd4\xf7\xe7\xdf" "\xdc\xec\x9d\x07\x00\x00\x80\x01\x71\xf1\x9d\x77\xbf\xf7\xc6\xfc\xfc\xe9" "\x1f\x78\xe2\x89\x27\x9e\xb4\x9e\xf4\xfa\x37\x13\x00\x00\xb0\xd9\xae\xff" "\xe3\xda\x5f\x7e\x78\x74\xe2\x77\xf7\x3f\xff\xbf\x3a\xff\x5d\xfa\xfc\xff" "\xfe\xd8\x6f\xc6\xb9\xfd\xfe\x1a\x57\x48\xf7\x09\xa4\xcf\x01\x3c\xf0\x79" "\xfd\x93\x6b\xf3\x4c\x96\xad\x77\x61\xed\x7a\xcd\x6c\xbd\xa1\x18\x63\x59" "\xdd\x3b\xda\xb6\x13\xda\xe6\x1b\x4c\xaf\x9b\x2a\xcb\xd7\x5c\xbb\x9d\xd1" "\x92\x7c\xe3\x59\xbe\x89\x2c\x5f\x3e\x4f\xc1\x70\xb6\x7e\xca\xb7\x3b\x5b" "\x9e\xcf\x4f\x98\xd6\x9b\xcc\x96\xe7\xf3\x30\x0e\x67\x39\x8a\x2c\xff\x73" "\x01\x00\x00\x00\xca\x1d\x7e\xfb\xad\x0b\x87\x2f\xbe\xf3\xee\x37\xce\xbd" "\xf5\xc6\x99\xd3\x67\x4e\x9f\x3f\x7a\x64\xf6\x5b\xb3\x2f\xcd\xce\x1e\x9b" "\x3d\xbc\x72\x5f\xff\xe1\xf6\xbb\xfb\x01\x00\x00\x80\xed\x68\xf5\xa6\xdf" "\x5e\x57\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x83\xab\x8e\xaf\x13\xeb\xf5\x3e\x02\x00\x00\xc0\xa0\xfb\xcf\x95\x10\xc2" "\x82\x10\x42\x08\x21\x84\x10\x42\x08\x21\xfa\x39\x96\x96\xf2\x6f\x9a\x07" "\x00\x00\x00\xd8\x5a\xf7\x6e\x5f\x3a\xd5\xde\x3e\x60\xa1\xd8\xd4\x7c\xad" "\xad\x35\xef\x37\x8b\x31\x6f\x6a\xff\x70\xe0\xe7\x07\x96\x23\xad\x76\xeb" "\xe5\xb5\xd7\x4b\x76\x6d\x6a\x35\x0c\xba\xba\xff\xfd\xcb\xbf\xbd\xf2\x7f" "\xfc\xde\xe6\xe6\xdf\x91\x9e\x74\xfd\xfb\xaf\xb1\x76\x03\xc7\xab\xe5\xfd" "\xea\x4f\xff\xf5\x42\x7b\xfe\xa7\x87\xbb\xcc\x9f\xef\xff\xeb\xd5\xf2\x1f" "\xcc\xf2\x1f\x0c\xdd\xe5\x5f\xfa\x28\xcb\x7f\xb2\x5a\xfe\x17\xb2\xfc\xbb" "\xba\xcc\xff\xc0\xfe\x5f\xa8\x96\xff\xc5\x98\x7f\x3a\xd5\xf3\x7c\xb7\xf9" "\xd7\xbe\xff\x63\xb1\x4d\xfb\xb1\xb3\xcb\xfc\x87\xb2\xfd\x7f\x33\x74\x9b" "\x3f\xdb\xff\x66\x97\x09\x33\x5f\x8b\xf9\x01\x60\x10\x35\x7a\x5d\xc0\x16" "\x49\x47\x09\xe9\x38\x7a\x3c\xf6\xd3\xfe\xc6\xc3\xcd\x90\xdf\xfd\xb0\xde" "\xe3\xff\x46\xb6\x9d\xe1\x0d\x57\xbe\x76\xbb\xe9\x38\xe8\xc9\xd8\x4f\xc7" "\x4b\x13\x59\xde\x64\xbd\xf5\x8f\x67\xdb\x7b\xac\x62\x9d\xb9\xed\x72\x57" "\x49\x59\xfd\x9b\xf5\x3e\x6e\xb5\xb2\xfa\x47\x6a\xae\xa3\xaa\xb2\xfa\x47" "\x6b\xae\xa3\xaa\xb2\xfa\xc7\x6a\xae\xa3\xaa\xb2\xfa\x77\xd4\x5c\x47\x55" "\x65\xf5\x77\x7b\x1e\xda\x6b\x65\xf5\x6f\x97\xeb\xca\x65\xf5\x8f\xd7\x5c" "\x47\x55\x65\xf5\x4f\xd4\x5c\x47\x55\x65\xf5\xaf\xf7\xff\xf1\x5e\x29\xab" "\x7f\x77\xcd\x75\x54\x55\x56\xff\x64\xcd\x75\x54\x55\x56\x7f\xc5\xcb\x6a" "\xb5\x2b\xab\x7f\xaa\xe6\x3a\xaa\x2a\xab\xff\xf1\x9a\xeb\xa8\xaa\xac\xfe" "\x27\x6a\xae\xa3\xaa\xb2\xfa\xf7\xd4\x5c\x47\xaf\x3c\x13\xdb\xb2\xf3\xe1" "\x74\xfe\x39\x19\xc7\x52\xbf\x99\xf5\xc7\x1e\xf2\xb3\xec\xd7\x6b\x0b\x00" "\x00\x00\xb0\xdd\xfc\xdb\xfc\x7f\x42\x08\x21\x84\x10\x42\x08\x21\x44\xdf" "\xc7\xd2\x52\xaf\xaf\x40\xd0\x4b\x5b\xfb\x69\x66\x00\x1e\x55\x7e\xff\x0f" "\x36\xef\xff\x60\xf3\xfe\x0f\x36\xef\x3f\xff\x4f\xba\x87\xbf\xc8\xfa\xc9" "\x50\x87\xf1\xe1\x0e\xe3\x23\x1d\xc6\x47\xb3\xf1\xfc\xdf\xeb\x58\x87\xf1" "\x27\xb2\xed\x2e\x45\x69\x7c\x4f\x87\xf1\x2f\x74\x18\xdf\xdd\x61\xfc\xc9" "\x0e\xe3\xd3\x1d\xc6\x9f\xea\x30\xfe\x74\x87\xf1\x67\x3a\x8c\x03\x00\x00" "\x30\x18\xbe\x18\x5b\xe7\x87\x00\x00\x00\xd0\xbf\x2e\xff\xf2\x93\x9f\xfc" "\xfa\xe0\xc9\xdb\x53\x77\x6f\xec\x3d\x1e\x46\x1f\x98\x77\xfe\x48\xec\x8f" "\xc5\xbf\xad\x5f\x8d\xfd\x7c\xde\xfb\x64\x24\xfe\xcd\xff\x47\xb1\xff\x8b" "\xd8\xfe\x3e\xb6\x7f\xcf\xd6\x77\xff\x09\x00\x00\x00\x6c\xbd\xf4\x3d\x31" "\xfe\xfe\x0f\x00\x00\x00\xfd\x2b\x7d\x4f\xa9\xf3\x7f\x00\x00\x00\xe8\x5f" "\x53\xb1\x75\xfe\x0f\x00\x00\x00\xfd\xeb\xf1\xd8\x3a\xff\x07\x00\x00\x80" "\x3e\x56\xec\x78\xf8\xe2\xd8\xa6\xeb\x02\xcf\xc5\xb6\xdb\x79\xfd\x00\x80" "\x47\xdf\x97\x62\xfb\x6c\x6c\xf7\xc6\x76\x5f\x6c\xbf\x1c\xdb\x74\x1c\xf0" "\x7c\x6c\xbf\x52\x53\x7d\x00\xc0\xe6\xf9\xd9\x77\x7f\xfc\xd2\xfb\xc5\xea" "\x7c\xff\x47\xb3\xf1\x7b\x71\x79\x6a\x1f\xb0\x70\xff\x4a\x41\xd1\x58\x3b" "\x93\xff\xce\xd8\xee\x8a\xed\x81\x2e\xeb\xc9\xbf\x0f\xa0\xdb\xfc\xc9\xee" "\x2e\xf3\x6c\x55\xfe\xc9\x0d\xe6\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xfa\x47\x63\xe5\xf1" "\xd8\xb1\xe9\x22\x84\x0f\x3e\xbd\x76\x62\xf2\xf2\x89\x33\xcb\xcb\xf6\xb5" "\xd6\xd8\xbf\xf2\x58\xc4\x5e\x33\x84\x30\xd2\x7a\x5d\x1a\x5d\xed\xff\x2a" "\xae\x78\xef\xf6\xa5\x53\xcb\xed\x62\x6c\x97\x62\x5b\x84\xd9\x50\x84\xa2" "\x35\x1e\x5e\xbb\xd5\xca\x34\x1e\x42\x58\x08\xfb\xc3\xcd\xd0\x0c\xfb\x0e" "\x35\xef\x5c\x1d\x7a\x75\xee\xfa\x87\x9f\x1d\xbc\x7c\xe1\x95\xb3\x5b\xf8" "\x23\x00\x00\x00\x80\xbe\xf7\xbf\x00\x00\x00\xff\xff\xc6\x09\x2a\x11", 3761)); NONFAILING(syz_mount_image(0x20000ec0, 0x20000f00, 0, 0x20000040, 1, 0xeb1, 0x20000f80)); NONFAILING(memcpy((void*)0x200000c0, "./bus\000", 6)); res = syscall(__NR_open, 0x200000c0ul, 0x14da42ul, 0ul); if (res != -1) r[0] = res; NONFAILING(*(uint32_t*)0x20000b40 = 0); NONFAILING(*(uint16_t*)0x20000b44 = 0x18); NONFAILING(*(uint16_t*)0x20000b46 = 0xfa00); NONFAILING(*(uint64_t*)0x20000b48 = 0); NONFAILING(*(uint64_t*)0x20000b50 = 0); NONFAILING(*(uint16_t*)0x20000b58 = 0); NONFAILING(*(uint8_t*)0x20000b5a = 0); NONFAILING(memset((void*)0x20000b5b, 0, 5)); syscall(__NR_write, r[0], 0x20000b40ul, 0x20ul); NONFAILING(memcpy((void*)0x20000040, "/proc/self/exe\000", 15)); res = syscall(__NR_openat, -1, 0x20000040ul, 0ul, 0ul); if (res != -1) r[1] = res; syscall(__NR_sendfile, r[0], r[1], 0ul, 0x80001d00c0d0ul); } int main(void) { syscall(__NR_mmap, 0x1ffff000ul, 0x1000ul, 0ul, 0x32ul, -1, 0ul); syscall(__NR_mmap, 0x20000000ul, 0x1000000ul, 7ul, 0x32ul, -1, 0ul); syscall(__NR_mmap, 0x21000000ul, 0x1000ul, 0ul, 0x32ul, -1, 0ul); setup_802154(); install_segv_handler(); use_temporary_dir(); loop(); return 0; }