// https://syzkaller.appspot.com/bug?id=9f54c9ad3dec036caa23bc578d99434c6e33e016 // 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 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) return 0; 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, max_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 void reset_loop_device(const char* loopname) { int loopfd = open(loopname, O_RDWR); if (loopfd == -1) { return; } if (ioctl(loopfd, LOOP_CLR_FD, 0)) { } close(loopfd); } 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, 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) { int loopfd; memset(loopname, 0, sizeof(loopname)); snprintf(loopname, sizeof(loopname), "/dev/loop%llu", procid); if (setup_loop_device(data, size, loopname, &loopfd) == -1) return -1; close(loopfd); 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) { bool has_remount_ro = false; char* remount_ro_start = strstr(opts, "errors=remount-ro"); if (remount_ro_start != NULL) { char after = *(remount_ro_start + strlen("errors=remount-ro")); char before = remount_ro_start == opts ? '\0' : *(remount_ro_start - 1); has_remount_ro = ((before == '\0' || before == ',') && (after == '\0' || after == ',')); } if (strstr(opts, "errors=panic") || !has_remount_ro) 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) reset_loop_device(loopname); 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; const int umount_flags = MNT_FORCE | UMOUNT_NOFOLLOW; retry: while (umount2(dir, umount_flags) == 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, umount_flags) == 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, umount_flags)) 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, umount_flags)) 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")) { } } static void setup_sysctl() { int cad_pid = fork(); if (cad_pid < 0) exit(1); if (cad_pid == 0) { for (;;) sleep(100); } char tmppid[32]; snprintf(tmppid, sizeof(tmppid), "%d", cad_pid); struct { const char* name; const char* data; } files[] = { {"/sys/kernel/debug/x86/nmi_longest_ns", "10000000000"}, {"/proc/sys/kernel/hung_task_check_interval_secs", "20"}, {"/proc/sys/net/core/bpf_jit_kallsyms", "1"}, {"/proc/sys/net/core/bpf_jit_harden", "0"}, {"/proc/sys/kernel/kptr_restrict", "0"}, {"/proc/sys/kernel/softlockup_all_cpu_backtrace", "1"}, {"/proc/sys/fs/mount-max", "100"}, {"/proc/sys/vm/oom_dump_tasks", "0"}, {"/proc/sys/debug/exception-trace", "0"}, {"/proc/sys/kernel/printk", "7 4 1 3"}, {"/proc/sys/kernel/keys/gc_delay", "1"}, {"/proc/sys/vm/oom_kill_allocating_task", "1"}, {"/proc/sys/kernel/ctrl-alt-del", "0"}, {"/proc/sys/kernel/cad_pid", tmppid}, }; for (size_t i = 0; i < sizeof(files) / sizeof(files[0]); i++) { if (!write_file(files[i].name, files[i].data)) { } } kill(cad_pid, SIGKILL); while (waitpid(cad_pid, NULL, 0) != cad_pid) ; } #define NL802154_CMD_SET_SHORT_ADDR 11 #define NL802154_ATTR_IFINDEX 3 #define NL802154_ATTR_SHORT_ADDR 10 static const char* setup_802154() { const char* error = NULL; int sock_generic = -1; int sock_route = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE); if (sock_route == -1) { error = "socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE) failed"; goto fail; } sock_generic = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC); if (sock_generic == -1) { error = "socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC) failed"; goto fail; } { int nl802154_family_id = netlink_query_family_id(&nlmsg, sock_generic, "nl802154", true); if (nl802154_family_id < 0) { error = "netlink_query_family_id failed"; goto fail; } 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)); if (netlink_send(&nlmsg, sock_generic) < 0) { error = "NL802154_CMD_SET_SHORT_ADDR failed"; goto fail; } 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)); if (netlink_send(&nlmsg, sock_route) < 0) { error = "netlink: adding device lowpan0 type lowpan link wpan0"; goto fail; } } } } fail: close(sock_route); close(sock_generic); return error; } 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 (;;) { sleep_ms(10); if (waitpid(-1, &status, WNOHANG | WAIT_FLAGS) == pid) break; if (current_time_ms() - start < 5000) continue; kill_and_wait(pid, &status); break; } remove_dir(cwdbuf); } } void execute_one(void) { if (write(1, "executing program\n", sizeof("executing program\n") - 1)) { } memcpy((void*)0x20000a40, "udf\000", 4); memcpy((void*)0x20000500, "./file1\000", 8); memcpy((void*)0x20000480, "shortad,rootdir=00000000000000000002,noadinicb\000\000\000\000=", 51); sprintf((char*)0x200004b3, "%020llu", (long long)0); *(uint16_t*)0x200004c7 = -1; memcpy( (void*)0x20001b00, "\x78\x9c\xec\xdb\x4f\x6c\x9b\xe7\x7d\x07\xf0\xdf\xc3\x57\xb2\x69\xa7\x6b" "\x15\xb7\x75\x93\x36\xcb\x58\xb4\x08\x3c\xa5\x0d\xe4\xff\x4a\xbc\x01\xf6" "\xac\x0a\x6d\xe6\x26\x46\x65\x65\xf3\x65\x30\x65\xc9\x0e\x11\xfd\xab\x24" "\x17\x4e\x37\xb4\x1e\x36\xa0\x08\xd0\x83\x51\x60\x3d\x6c\xc0\x90\xcb\x0e" "\x03\x76\xf0\x0e\xbb\xec\x14\xec\x30\x0c\x18\x36\x18\x3b\x0c\xc5\x8a\x76" "\x5a\xba\x66\xe9\x8d\xc1\x06\xe4\xb4\x69\x78\x5f\x3e\x94\x28\x59\xb6\xd5" "\x38\xb6\x64\xe7\xf3\x31\xec\x2f\xf9\xf2\xf7\x92\xcf\x1f\x9a\x7c\xc9\x87" "\x6f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x11\xbf\xf5" "\x95\x53\x43\x07\xd3\x76\xb7\x02\x00\x78\x90\x5e\x1a\xfb\xc6\xd0\x61\xef" "\xff\x00\xf0\x91\x72\xce\xe7\x7f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\xd8\xe9\x52\x14\xf1\x67\x91\xe2\xd5\x9f\xb4\xd3\x85\xea\x7a\x47\xfd" "\x4c\x6b\xf6\xca\xd5\xf1\x91\xd1\xcd\x77\xdb\x93\x22\x45\x2d\x8a\xaa\xbe" "\xfc\x5b\x3f\x78\xe8\xf0\x91\xa3\xc7\x8e\x0f\x77\xf3\xce\xfb\x7f\xd8\x9e" "\x8c\x97\xc7\xce\x9d\x6a\x9c\x9e\x9b\x99\x5f\x98\x5a\x5c\x9c\x9a\x6c\x8c" "\xcf\xb6\x2e\xce\x4d\x4e\x6d\xf9\x1e\xee\x75\xff\x8d\x06\xab\x01\x68\xcc" "\xbc\x76\x65\xf2\xd2\xa5\xc5\xc6\xa1\xe7\x0e\xaf\xbb\xf9\xea\xc0\x3b\xbb" "\x1f\xdb\x3f\x70\xe2\xf8\x8b\xe7\xf7\x75\x6b\xc7\x47\x46\x47\xc7\x7a\x6a" "\xfa\xfa\x3f\xf0\xa3\xdf\xe2\x76\x67\x78\xec\x8a\x22\x7e\x16\x29\xea\xdf" "\x7b\x37\x35\x23\xa2\x16\xf7\x3e\x16\x77\x79\xee\xdc\x6f\x7b\xaa\x4e\x0c" "\x56\x9d\x18\x1f\x19\xad\x3a\x32\xdd\x6a\xce\x2e\x95\x37\xa6\x5a\xae\xaa" "\x45\x0c\xf4\xec\x74\xb2\x3b\x46\x0f\x60\x2e\xee\x49\x23\xe2\x5a\xd9\xfc" "\xb2\xc1\x83\x65\xf7\xc6\xe6\x9b\x0b\xcd\x89\xe9\xa9\xc6\xd9\xe6\xc2\x52" "\x6b\xa9\x35\x37\x9b\x6a\x9d\xd6\x96\xfd\x19\x88\x5a\x0c\xa7\x88\xf9\x88" "\x68\x17\xb7\xde\x5d\x7f\x14\xf1\xef\x91\xe2\xfb\xef\xb7\xd3\x44\x44\x14" "\xdd\x71\x78\xb6\x3a\x31\xf8\xee\xed\xa9\xdd\x87\x3e\x6e\x41\x5f\xd9\xb7" "\x22\xe2\x66\x3c\x04\x73\xb6\x83\xed\x8e\x22\xde\x88\x14\x3f\x38\x3f\x14" "\x17\xf3\xb8\x56\xc3\xf6\x4c\xc4\xd7\xcb\x7c\x3a\xe2\x9b\x65\x2e\x47\x5c" "\xcf\xd7\x53\xf9\x04\x79\x2a\xe2\xbd\x4d\x9e\x4f\x3c\x5c\xfa\xa2\x88\x7f" "\x8a\x14\x73\xa9\x9d\x26\xbb\x73\x5f\xbd\xae\x9c\x79\xa5\xf1\xb5\xd9\x4b" "\x73\x3d\xb5\xdd\xd7\x95\x87\xfe\xfd\xe1\x41\xda\xe1\xaf\x4d\xf5\x28\x62" "\xa2\x7a\xc5\x6f\xa7\x0f\x7e\xb0\x03\x00\x00\x00\x00\xc0\xce\x53\xc4\xdf" "\x46\x8a\x1b\x33\x07\xd2\x7c\xf4\xae\x29\xb6\x66\x2f\x37\xce\x35\x27\xa6" "\x3b\xdf\x0a\x77\xbf\xfb\x6f\xe4\xbd\x56\x56\x56\x56\x06\x52\x27\x1b\x39" "\x87\x72\x9e\xcc\x79\x36\xe7\x85\x9c\xf3\x39\xaf\xe5\xbc\x9e\xf3\xcd\x9c" "\x37\x72\xbe\x95\xf3\x66\xce\xe5\x9c\xed\x9c\x51\xcb\x8f\x9f\xb3\x91\x73" "\x28\xe7\xc9\x9c\x67\x73\x5e\xc8\x39\x9f\xf3\x5a\xce\xeb\x39\xdf\xcc\x79" "\x23\xe7\x5b\x39\x6f\xe6\x5c\xce\xd9\xce\x19\xd6\xbd\x00\x00\x00\x00\x00" "\x00\x00\xd8\x61\xf6\x44\x11\x3f\x8e\x14\x5f\xf8\x9b\x6f\x55\xe7\x15\x47" "\x75\x5e\xfa\x27\x4e\x0c\x1f\xf8\xea\x17\x7b\xcf\x19\xff\xcc\x5d\xee\xa7" "\xac\x7d\x2e\x22\x6e\xc4\xd6\xce\xc9\xed\xcf\xa7\x0e\xa7\x5a\xf9\xe7\xc3" "\xef\x17\x5b\x53\x8f\x22\xbe\x93\xcf\xff\xfb\xc3\xed\x6e\x0c\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\xb0\xad\x6a\x51\xc4\x67\x22\xc5\x0f\xdf\x68\xa7\x48" "\x11\xd1\x88\xb8\x10\x9d\x5c\x2e\xb6\xbb\x75\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\xc0\x07\x51\x4f\x45\x9c\x8e\x14\xbf\xf8\x4a\xbd\xba\x7e\x33\x22" "\x3e\x1b\x11\xff\xb7\x52\xfe\x89\x88\xe5\x95\x0d\xb6\xbb\xc5\x00\x00\x00" "\x00\x00\x00\x00\xc0\x2d\x52\x11\x43\x91\xe2\xf1\x27\xdb\x69\x20\x22\xae" "\x0e\xbc\xb3\xfb\xb1\xfd\x03\x27\x8e\xbf\x78\x7e\x5f\x11\x45\xa4\xb2\xa4" "\xb7\xfe\xe5\xb1\x73\xa7\x1a\xa7\xe7\x66\xe6\x17\xa6\x16\x17\xa7\x26\x1b" "\xe3\xb3\xad\x8b\x73\x93\x53\x5b\x7d\xb8\xfa\x99\xd6\xec\x95\xab\xe3\x23" "\xa3\xf7\xa5\x33\x77\xb5\xe7\x3e\xb7\x7f\x4f\xfd\xf4\xdc\xfc\xeb\x0b\xad" "\xcb\xaf\x2e\x6d\x7a\xfb\xde\xfa\xa9\x89\xc5\xa5\x85\xe6\xc5\xcd\x6f\x8e" "\x3d\x51\x8b\x18\xea\xdd\x32\x58\x35\x78\x7c\x64\xb4\x6a\xf4\x74\xab\x39" "\x5b\xed\x9a\x6a\xb7\x69\x60\x2d\xa2\xb1\xd5\xce\x00\x00\x00\x00\x00\x00" "\x00\xf0\xc8\xd8\x9b\x8a\x38\x1a\x29\x5e\x6d\x1d\x49\xdd\x75\xe3\xbe\xce" "\x9a\xff\xaf\x74\xae\x15\xab\xb5\x7f\xf1\x07\x6b\xbf\x05\x98\xde\x90\x5d" "\xbd\xbf\x1f\xd8\xca\xe5\xb4\xd5\x86\x0e\x56\x0b\xef\x8d\xf1\x91\xd1\xd1" "\xb1\x9e\xcd\x7d\xfd\xb7\x96\x96\x6d\x4a\xa9\x88\xbf\x8e\x14\x9f\xfb\xdd" "\x27\xaa\xf5\xf0\x14\x7b\x37\x5d\x1b\x2f\xeb\x76\x45\x8a\x63\xdf\x3a\x92" "\xeb\x06\x3e\x57\xd6\x9d\x5c\x57\x55\x1f\x1c\x1f\x19\x6d\xbc\x34\x37\xfb" "\xe5\x53\xd3\xd3\x73\x17\x9b\x4b\xcd\x89\xe9\xa9\xc6\xd8\x7c\xf3\xe2\x96" "\x7f\x38\x00\x00\x00\x00\x00\x00\x00\x00\xf7\xd1\xde\x54\xc4\x9f\x47\x8a" "\xdf\x1b\xba\x99\xba\xe7\x9d\xe7\xf5\xff\xbe\xce\xb5\x9e\xf5\xff\xdf\xa8" "\x96\xd0\x2b\xf5\xb4\x3e\x57\x55\x6b\xfb\x1f\xaf\xd6\xf6\x3b\x97\x3f\x71" "\x62\xb8\x31\xfa\x6b\xb7\xdb\x7e\x3f\xd6\xff\xcb\x36\xa5\x54\xc4\xbf\x45" "\x8a\xc7\x7f\xff\x89\xea\x7c\xfa\xee\xfa\xff\xd0\x86\xda\xb2\xee\xbf\x23" "\xc5\xbf\xfe\xe3\x53\xb9\xae\xb6\xab\xac\x3b\xd8\xed\x4e\xe7\x1e\x2f\xb5" "\xa6\xa7\x86\x52\x1e\xab\xcf\x3f\xdb\xad\x8d\xaa\xf6\x78\xae\xfd\xe4\x5a" "\xed\xc1\xb2\xf6\xf3\x91\xe2\x2f\x9f\x59\x5f\x3b\x9c\x6b\x3f\xb5\x56\x7b" "\xa8\xac\xfd\xe3\x48\xf1\xbf\x47\x37\xaf\xfd\xf4\x5a\xed\xe1\xb2\xf6\x8f" "\x22\xc5\x6f\xbf\xdd\xe8\xd6\xee\x2d\x6b\xcf\xe4\xda\xfd\x6b\xb5\xcf\x5d" "\x9c\x9b\x9e\xbc\xdb\xb0\x96\xf3\xff\x77\x91\xe2\xec\x2f\xbe\x9a\xba\x7d" "\xbe\xed\xfc\xf7\xfc\xfe\xe3\xda\x86\x5c\x75\xcb\x9c\xdf\xf9\xf2\x87\x35" "\xff\x03\x3d\xdb\xae\xe5\x79\xfd\x71\x9e\xff\x83\x77\x99\xff\xbf\x8f\x14" "\x7f\xf2\xd3\xa7\x72\x5d\x67\xec\x0f\xe5\xdb\x1f\xaf\xfe\x5d\x9b\xff\xdf" "\x89\x14\xff\xf5\xab\xeb\x6b\x8f\xe5\xda\x7d\x6b\xb5\x07\xb7\xda\xad\xed" "\x56\xce\xff\x97\x22\xc5\x89\x1f\xfd\x68\xb5\xcf\x79\xfe\xf3\xc8\xae\xcd" "\x50\xef\xfc\x7f\xb6\x6f\x7d\xae\x3e\x4b\xb6\x69\xfe\x1f\xef\xd9\x36\x90" "\xdb\x75\xf8\x97\x1c\x8b\x8f\xa2\xc5\xd7\xbf\xfd\x5a\x73\x7a\x7a\x6a\xc1" "\x05\x17\x1e\xd8\x85\xf2\x28\x62\x07\x34\xc3\x85\x3b\x5c\xd8\xee\x57\x26" "\x1e\x84\xf2\xfd\xff\x9f\x23\xc5\x0b\x67\x6a\xa9\x7b\x1c\x93\xdf\xff\x3f" "\xd6\xb9\xb6\x76\xfc\xf7\xfe\x77\xd6\xde\xff\x5f\xd8\x90\xab\xb6\xe9\xfd" "\x7f\x5f\xcf\xb6\x17\xf2\x51\x4b\x7f\x5f\x44\x7d\x69\x66\xbe\x7f\x7f\x44" "\x7d\xf1\xf5\x6f\x7f\xb9\x35\xd3\xbc\x3c\x75\x79\x6a\x76\xf8\xd8\xd1\x23" "\xcf\x0f\x1f\x3b\xf6\x7c\xff\xae\xee\xb1\xdd\xda\xa5\x2d\x0f\xdd\x23\xa1" "\x9c\xff\x33\x91\xe2\x95\x9f\xfe\xcb\xea\xe7\x98\xf5\xc7\x7f\x9b\x1f\xff" "\xef\xdd\x90\xab\xb6\x69\xfe\x3f\xd9\xdb\xa7\x75\xc7\x35\x5b\x1e\x8a\x8f" "\xa4\x72\xfe\xaf\x47\x8a\xef\xbe\xfd\xee\xea\xe7\xcd\x3b\x1d\xff\x77\x3f" "\xff\x1f\xf8\xc2\xfa\x5c\xfd\xff\xb7\x4d\xf3\xff\xa9\x9e\x6d\xd5\x6f\xfc" "\x3f\x1e\xf1\x7c\xcf\xb6\x03\x9f\x8e\x38\xb5\xd5\xc7\x02\x00\x00\x80\x47" "\xcc\xde\xbc\x4e\xfe\xa7\xbf\xfe\x0f\xab\xe7\xbc\xaf\xff\xfc\x1f\x5f\xec" "\xd6\xf6\x7e\xff\x73\x3b\x3b\xe1\xfc\x7f\x00\x00\x00\x00\x00\xf8\xa8\xdb" "\x9b\x8a\xf8\xab\x48\xf1\x3f\x43\x5f\x4a\xdd\x73\xc8\xb6\xf2\xfb\xcf\xc9" "\x0d\xb9\x6a\x9b\x7e\xff\xb7\xbf\x67\xdb\xe4\x03\x3a\xaf\x65\xcb\x83\x0c" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xb0\x03\xa5\x28\xe2\xe9\x48\xf1" "\xea\x4f\xda\x69\xb9\x28\xaf\x77\xd4\xcf\xb4\x66\xaf\x5c\x1d\x1f\x19\xdd" "\x7c\xb7\x3d\x29\x52\xd4\xa2\xa8\xea\xcb\xbf\xf5\x83\x87\x0e\x1f\x39\x7a" "\xec\xf8\x70\x37\xef\xbc\xff\x87\xed\xc9\x78\x79\xec\xdc\xa9\xc6\xe9\xb9" "\x99\xf9\x85\xa9\xc5\xc5\xa9\xc9\xc6\xf8\x6c\xeb\xe2\xdc\xe4\xd4\x96\xef" "\xe1\x5e\xf7\xdf\x68\xb0\x1a\x80\xc6\xcc\x6b\x57\x26\x2f\x5d\x5a\x6c\x1c" "\x7a\xee\xf0\xba\x9b\xaf\x0e\xbc\xb3\xfb\xb1\xfd\x03\x27\x8e\xbf\x78\x7e" "\x5f\xb7\x76\x7c\x64\x74\x74\xac\xa7\xa6\xaf\xff\x03\x3f\xfa\x2d\xd2\x6d" "\xb6\xef\x8a\x22\x2e\x45\x8a\xfa\xf7\xde\x4d\xff\x51\x44\xd4\xe2\xde\xc7" "\xe2\x2e\xcf\x9d\xfb\x6d\x4f\xd5\x89\xc1\xaa\x13\xe3\x23\xa3\x55\x47\xa6" "\x5b\xcd\xd9\xa5\xf2\xc6\x54\xcb\x55\xb5\x88\x81\x9e\x9d\x4e\x76\xc7\xe8" "\x01\xcc\xc5\x3d\x69\x44\x5c\x2b\x9b\x5f\x36\x78\xb0\xec\xde\xd8\x7c\x73" "\xa1\x39\x31\x3d\xd5\x38\xdb\x5c\x58\x6a\x2d\xb5\xe6\x66\x53\xad\xd3\xda" "\xb2\x3f\x03\x51\x8b\xe1\x14\x31\x1f\x11\xed\xe2\xd6\xbb\xeb\x8f\x22\x26" "\x22\xc5\xf7\xdf\x6f\xa7\xb7\x8b\x88\xa2\x3b\x0e\xcf\xbe\x34\xf6\x8d\xa1" "\xc3\x77\x6f\x4f\xed\x3e\xf4\xb1\xd7\xca\x77\x37\xdd\xdc\x57\xf6\xad\x88" "\xb8\x19\x0f\xc1\x9c\xed\x60\xbb\xa3\x88\x8f\x45\x8a\x1f\x9c\x1f\x8a\x9f" "\x15\x9d\x71\xad\x86\xed\x99\x88\xaf\x97\xf9\x74\xc4\x37\xcb\x5c\x8e\xb8" "\x9e\xaf\xa7\xf2\x09\xf2\x54\xc4\x7b\x9b\x3c\x9f\x78\xb8\xf4\x45\x11\x67" "\x23\xc5\x5c\x6a\xa7\xff\x2c\xf2\xdc\x57\xaf\x2b\x67\x5e\x69\x7c\x6d\xf6" "\xd2\x5c\x4f\x6d\xf7\x75\xe5\xa1\x7f\x7f\x78\x90\x76\xf8\x6b\x53\x3d\x8a" "\xf8\x79\xf5\x8a\xdf\x4e\x3f\xf7\xff\x19\x00\x00\x00\x00\xe0\x11\x52\xc4" "\x6f\x46\x8a\x1b\x33\x07\x52\xb5\x3e\xb8\xba\xa6\xd8\x9a\xbd\xdc\x38\xd7" "\x9c\x98\xee\x7c\xad\xdf\xfd\xee\xbf\x91\xf7\x5a\x59\x59\x59\x19\x48\x9d" "\x6c\xe4\x1c\xca\x79\x32\xe7\xd9\x9c\x17\x72\xce\xe7\xbc\x96\xf3\x7a\xce" "\x37\x73\xde\xc8\xf9\x56\xce\x9b\x39\x97\x73\xb6\x73\x46\x2d\x3f\x7e\xce" "\x46\xce\xa1\x9c\x27\x73\x9e\xcd\x79\x21\xe7\x7c\xce\x6b\x39\xaf\xe7\x7c" "\x33\xe7\x8d\x9c\x6f\xe5\xbc\x99\x73\x39\x67\x3b\x67\xf8\x9e\x1c\x00\x00" "\x00\x00\x00\x00\xd8\x81\x6a\x51\xc4\x13\x91\xe2\x87\x6f\xb4\xd3\x4a\xd1" "\x59\xe0\xbd\x10\x9d\x5c\xb6\xce\xf9\xc8\xfb\xff\x00\x00\x00\xff\xff\xff" "\x0c\x3d\x5f", 2595); syz_mount_image(/*fs=*/0x20000a40, /*dir=*/0x20000500, /*flags=MS_REC|MS_NOATIME*/ 0x4400, /*opts=*/0x20000480, /*chdir=*/1, /*size=*/0xa23, /*img=*/0x20001b00); memcpy((void*)0x20000540, "./file1\000", 8); memcpy((void*)0x20000580, "./file1\000", 8); memcpy((void*)0x200005c0, "erofs\000", 6); syscall(__NR_mount, /*src=*/0x20000540ul, /*dst=*/0x20000580ul, /*type=*/0x200005c0ul, /*flags=MS_RELATIME*/ 0x200000ul, /*data=*/0ul); } int main(void) { syscall(__NR_mmap, /*addr=*/0x1ffff000ul, /*len=*/0x1000ul, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/-1, /*offset=*/0ul); syscall(__NR_mmap, /*addr=*/0x20000000ul, /*len=*/0x1000000ul, /*prot=PROT_WRITE|PROT_READ|PROT_EXEC*/ 7ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/-1, /*offset=*/0ul); syscall(__NR_mmap, /*addr=*/0x21000000ul, /*len=*/0x1000ul, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/-1, /*offset=*/0ul); setup_sysctl(); const char* reason; (void)reason; if ((reason = setup_802154())) printf("the reproducer may not work as expected: 802154 injection setup " "failed: %s\n", reason); use_temporary_dir(); loop(); return 0; }