// https://syzkaller.appspot.com/bug?id=8db82ffc78782603af41c5f2f01cc898078edb4f // 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 #ifndef __NR_getdents64 #define __NR_getdents64 61 #endif #ifndef __NR_memfd_create #define __NR_memfd_create 279 #endif #ifndef __NR_mmap #define __NR_mmap 222 #endif #ifndef __NR_openat #define __NR_openat 56 #endif static unsigned long long procid; 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"); } else if (strncmp(fs, "gfs2", 4) == 0 && (strstr(opts, "errors=panic") || strstr(opts, "debug"))) { strcat(opts, ",errors=withdraw"); } 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 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; } uint64_t r[1] = {0xffffffffffffffff}; int main(void) { syscall(__NR_mmap, /*addr=*/0x1ffff000ul, /*len=*/0x1000ul, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/(intptr_t)-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=*/(intptr_t)-1, /*offset=*/0ul); syscall(__NR_mmap, /*addr=*/0x21000000ul, /*len=*/0x1000ul, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul); const char* reason; (void)reason; if ((reason = setup_802154())) printf("the reproducer may not work as expected: 802154 injection setup " "failed: %s\n", reason); intptr_t res = 0; if (write(1, "executing program\n", sizeof("executing program\n") - 1)) { } // syz_mount_image$hfsplus arguments: [ // fs: ptr[in, buffer] { // buffer: {68 66 73 70 6c 75 73 00} (length 0x8) // } // dir: ptr[in, buffer] { // buffer: {2e 2f 66 69 6c 65 31 00} (length 0x8) // } // flags: mount_flags = 0x8 (8 bytes) // opts: ptr[inout, array[ANYUNION]] { // array[ANYUNION] { // union ANYUNION { // ANYRES8: ANYRES8 (resource) // } // union ANYUNION { // ANYRESOCT: ANYRES64 (resource) // } // union ANYUNION { // ANYRES8: ANYRES8 (resource) // } // union ANYUNION { // ANYBLOB: buffer: {0a 42 f7 41 5a 36 63 f0 cc ff 19 a8 b6 c7 4a 5c // a3 6c de 3a 07 64 e4 53 9a 00 72 11 8a 8c a3 5f 4c fd 92 54 32 ff // 27 a5 61 20 6d e8 7f 8e f8 fd 02 4e b3 b7 29 3d 4f 80 41 64 aa 55 // af fb 40 3b ca 8a f4 c0 f0 fb 72 f9 1e 3d 6b 0b b8 44 b3 19 43 a9 // de ee af b1 a1 47 ec 27 03 ef 0d cb 51 f0 b1 30 65 3a b2 05 38 03 // 32 88 49 a0 ce 15 49 b8 46 73 bd 29 05 fb 13 71 c0 74 86 fc c5 47 // a8 16 c1 17 c3 40 d1 68 3e 87 ff de 30 73 bb 03 c6 b1 15 5e 6c b6 // 45 b5 e7 9b 6c 21 6b ef e7 79 03 45 34 9e} (length 0xa2) // } // union ANYUNION { // ANYRESOCT: ANYRES64 (resource) // } // union ANYUNION { // ANYRES8: ANYRES8 (resource) // } // } // } // chdir: int8 = 0xfb (1 bytes) // size: len = 0x6b4 (8 bytes) // img: ptr[in, buffer] { // buffer: (compressed buffer with length 0x6b4) // } // ] // returns fd_dir memcpy((void*)0x20000c00, "hfsplus\000", 8); memcpy((void*)0x20000100, "./file1\000", 8); *(uint8_t*)0x200003c0 = 0; sprintf((char*)0x200003c1, "%023llo", (long long)-1); *(uint8_t*)0x200003d8 = -1; memcpy((void*)0x200003d9, "\x0a\x42\xf7\x41\x5a\x36\x63\xf0\xcc\xff\x19\xa8\xb6\xc7\x4a\x5c\xa3" "\x6c\xde\x3a\x07\x64\xe4\x53\x9a\x00\x72\x11\x8a\x8c\xa3\x5f\x4c\xfd" "\x92\x54\x32\xff\x27\xa5\x61\x20\x6d\xe8\x7f\x8e\xf8\xfd\x02\x4e\xb3" "\xb7\x29\x3d\x4f\x80\x41\x64\xaa\x55\xaf\xfb\x40\x3b\xca\x8a\xf4\xc0" "\xf0\xfb\x72\xf9\x1e\x3d\x6b\x0b\xb8\x44\xb3\x19\x43\xa9\xde\xee\xaf" "\xb1\xa1\x47\xec\x27\x03\xef\x0d\xcb\x51\xf0\xb1\x30\x65\x3a\xb2\x05" "\x38\x03\x32\x88\x49\xa0\xce\x15\x49\xb8\x46\x73\xbd\x29\x05\xfb\x13" "\x71\xc0\x74\x86\xfc\xc5\x47\xa8\x16\xc1\x17\xc3\x40\xd1\x68\x3e\x87" "\xff\xde\x30\x73\xbb\x03\xc6\xb1\x15\x5e\x6c\xb6\x45\xb5\xe7\x9b\x6c" "\x21\x6b\xef\xe7\x79\x03\x45\x34\x9e", 162); sprintf((char*)0x2000047b, "%023llo", (long long)-1); *(uint8_t*)0x20000492 = -1; memcpy( (void*)0x200013c0, "\x78\x9c\xec\xdd\xcb\x6f\x5c\x57\x1d\x07\xf0\xef\x1d\x4f\x6c\x4f\x5a\x42" "\x9a\x26\x6d\x40\x95\x6a\x35\x12\x20\x22\x12\x27\x56\x5a\xcc\x86\x80\x10" "\xca\xa2\xaa\xaa\xb2\x60\x6d\x25\x4e\x63\xc5\x49\x8b\xe3\x22\xb7\x42\xc4" "\xe1\xb9\xed\xa2\x7f\x40\x59\x64\x83\x58\x21\xb1\x62\x13\xa9\xb0\x60\x03" "\xbb\xee\x90\x97\x48\x48\x6c\xca\x82\xb0\x61\xd0\xbd\x73\xc7\x1e\xcf\x8c" "\x27\xe3\x36\xf1\x03\x3e\x9f\xe8\xce\x39\xe7\x9e\x73\xcf\x3d\xe7\x77\x1f" "\xf3\xb0\xa2\x1b\xe0\xff\xd6\x95\xb3\x69\x3e\x48\x91\x2b\x67\x5f\x5d\x2b" "\xcb\x1b\xf7\xe7\x96\x37\xee\xcf\xdd\xea\xe4\x5f\x6b\x26\x99\x4a\xb2\x9e" "\x94\xd9\x46\x92\xe2\x5f\xed\x76\xfb\xa3\xe4\x72\x52\x6c\x76\x53\xf4\xa5" "\x03\x3e\x58\x9a\x7f\xe3\xe3\x4f\x36\xfe\xd6\x29\x35\xeb\xa5\x6a\xdf\x18" "\xb5\x5d\x9f\xba\xdd\x7a\xdf\xea\xf5\xee\xba\x99\x24\x13\x75\xfa\x19\x6c" "\xeb\xef\xea\x67\xee\xaf\xd8\x1c\xf9\xe5\x24\x67\xea\x14\xf6\xdd\x91\x24" "\xed\x6d\x7e\xf0\xa7\xa7\x37\x6b\x7a\xb4\x86\x6d\x3d\xbd\x27\x63\x04\x9e" "\xac\xa2\xf3\xbe\x39\xe0\x78\x72\xb4\xbe\xd0\xcb\xcf\x01\xdd\x77\xde\xc6" "\xde\x8e\x6e\x3c\x13\xdd\x41\x76\x15\xcd\x1d\xdb\xf6\x7f\x82\x00\x00\x00" "\x80\xc3\xa6\xfa\x0e\x3c\xf8\xd5\x77\xdb\x9a\xcf\x3f\xcc\xc3\xac\x15\xc7" "\xf6\x70\x58\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x70\xa8\xad\x27\x93\xf5" "\xe3\xf3\x8b\x7a\x69\x74\xf3\x33\x29\xba\xcf\xff\x9f\xac\xd7\xa5\xce\x1f" "\x2c\x2f\xee\xae\xf9\x83\xce\x9c\x00\x00\x00\x00\x00\x00\x00\xe0\x50\x7b" "\xf1\x61\x1e\x66\x2d\xc7\xba\xe5\x76\x51\xfd\xcd\xff\xa5\xaa\x70\xb2\x7a" "\x7d\x2a\xef\xe4\x4e\x16\xb3\x92\x73\x59\xcb\x42\x56\xb3\x5a\x24\x17\x92" "\x1c\xef\xe9\x68\x72\x6d\x61\x75\x75\xaa\x5b\xda\x71\xcb\xac\xe4\xe2\xb0" "\x2d\x57\x2e\x3e\x62\xa0\xdd\xae\x5b\x8f\x61\xd2\x00\x00\x00\x00\x00\x00" "\x00\xf0\xbf\xe7\x27\xb9\xb2\xf5\xf7\x7f\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x38\x08\x8a\x64\xa2\x93\xa4\xb8\xd7\xb3\xfa\x78\x1a\xcd\x24" "\xd3\x49\x26\xcb\x15\xeb\x49\xd1\xac\xf3\x07\xdb\xf4\xc8\xda\x07\x7b\x36" "\x0e\x00\x00\x00\xd8\x3f\x53\xc9\xc3\xac\xe5\x58\xb7\xdc\x2e\x72\x32\xc9" "\x73\xd5\x6f\x00\xd3\x79\x27\xb7\xb3\x9a\xa5\xac\x66\x39\x8b\xb9\x56\xfd" "\x2e\xd0\xf9\xd6\xdf\xd8\xb8\x3f\xb7\xbc\x71\x7f\xee\x56\xb9\x0c\xf6\xfb" "\xad\x7f\xec\x6a\x18\x55\x8f\xe9\xfc\xf6\x30\x7c\xcf\xa7\xcb\x16\xed\x22" "\xd7\xb3\x54\xad\x39\x97\xab\x79\x2b\xcb\xb9\x96\x46\xb5\x65\xe9\x74\x3d" "\x9e\x6e\xaf\x7d\xe3\xba\x57\x8e\xa9\xf8\x66\xed\x95\xf1\x46\x76\xad\x4e" "\xcb\x99\xbf\x5f\xa7\x03\xee\xee\x6a\xb2\x3b\xd9\xe5\x8f\x29\xc7\xab\x98" "\x1d\xe9\x44\x64\x22\x99\xad\xc7\x56\x46\xe3\x99\xee\x91\x19\x7e\x84\x76" "\x79\x74\xb6\xed\x29\x8b\xb9\x90\xc6\xe6\x60\x4f\xf6\xed\x69\x72\xfb\x64" "\xb6\xc7\x7c\xab\xcb\xc6\xa8\xfd\x1d\xad\xd3\x72\x3e\xbf\xd8\x29\xe6\xfb" "\xa2\x13\x89\xff\xb4\x3b\x16\x73\xb1\xe7\xec\x7b\x6e\x74\xcc\x93\x2f\xff" "\xee\x37\xdf\x9f\xad\xf3\x07\x67\x4a\xe3\x99\xa8\xd3\x76\xf5\xda\x1a\x3c" "\x27\xe6\x7a\x22\xf1\xfc\x38\x91\xb8\xb1\x7c\xfb\xe6\x8d\xeb\x77\xce\x1e" "\xb6\x48\x0c\x98\xad\x22\x71\x6a\xb3\x7c\x25\xdf\xcd\xf7\x72\x36\x33\x79" "\x3d\x2b\x59\xca\x0f\xb3\x90\xd5\x2c\x66\x26\xdf\xa9\x72\x0b\xf5\xc1\x2f" "\x7a\x2e\xf9\x1d\x22\x75\x79\x5b\xe9\xf5\x47\x8d\x64\xb2\x3e\x43\x3b\x07" "\x6b\x77\x63\x7a\xa9\xda\xf6\x58\x96\xf2\x5a\xde\xca\xb5\x2c\xe6\xe5\xea" "\xdf\xc5\x5c\xc8\x2b\xb9\x94\x4b\x99\xef\x39\xc2\xa7\x46\x1f\xe1\xea\xaa" "\x6f\x0c\x5e\xf5\x95\xf6\xe7\x86\x0e\xfe\xcc\x57\xea\x4c\x2b\xc9\x2f\xeb" "\xf4\x60\x28\xe3\xfa\x4c\x4f\x5c\xb7\xce\xfa\xd9\x2a\xde\xcf\x6c\x5b\x53" "\x47\xa9\x68\xe6\xc4\x18\x51\x1a\x72\x6f\x1c\xa5\xf9\xc5\x3a\x53\xee\xe3" "\xa7\x8f\xba\x91\xee\xa9\xfe\x48\x5c\xe8\x39\x5f\x9e\x1d\x1d\x89\x5f\x55" "\xb7\x95\x3b\xcb\xb7\x6f\xae\xdc\x58\x78\x7b\xbc\xdd\x9d\x78\xbf\xce\x94" "\xd7\xd1\xcf\x93\x99\x83\x73\x23\x29\xcf\x97\x13\xe5\xc1\xaa\x4a\x53\xdb" "\xce\x8e\xb2\xee\xd9\xcd\xba\xed\xf1\x2a\xeb\x4e\x6e\xd6\x35\x06\xea\x4e" "\xe5\xf7\x69\x36\xbb\x7b\x59\xca\xfa\x8e\x57\xea\x64\xfd\x19\x6e\xb0\xa7" "\x8b\x55\xdd\xf3\x43\xeb\xe6\xaa\xba\xd3\x3d\x75\xad\x21\x9f\xb7\x00\x38" "\xf0\x8e\x7e\xf5\xe8\x64\xeb\xef\xad\x3f\xb7\x3e\x6c\xfd\xac\x75\xa3\xf5" "\xea\xf4\xb7\xa7\xbe\x3e\xf5\xc2\x64\x8e\xfc\xe1\xc8\x37\x9a\xb3\x13\x5f" "\x6a\xbc\x50\xfc\x36\x1f\xe6\xc7\x5b\xdf\xff\x01\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x4f" "\xef\xce\xbb\xef\xdd\x5c\x58\x5e\x5e\x5c\xe9\xcb\xb4\xdb\xed\xbb\x7f\x19" "\x5e\x35\x66\xa6\xfb\xbc\x9a\x4f\xb9\x79\x7f\xa6\xfb\x54\xa8\x31\x1a\x67" "\xe6\xaf\x4f\x95\x4d\x87\x54\x4d\xa4\x7d\x77\x87\xaa\x27\x95\xf9\xc2\xd3" "\xc9\x5e\xed\xeb\xe0\x66\xfe\xdd\x6e\xb7\xeb\x35\xc5\x0e\x6d\x7e\xfd\xc7" "\xfe\x40\x4d\x65\x9f\x42\x57\x3f\xe7\xaf\x7d\x20\x42\x37\x22\x33\xfd\xf8" "\xae\xaf\x81\xcc\xbe\xdd\x92\x80\x3d\x72\x7e\xf5\xd6\xdb\xe7\xef\xbc\xfb" "\xde\xd7\x96\x6e\x2d\xbc\xb9\xf8\xe6\xe2\xed\xf9\x4b\x97\xe6\x67\xe7\x2f" "\xbd\x3c\x37\x7d\x7d\x69\x79\x71\xf6\x7c\xf5\xba\xdf\xa3\x04\x9e\x84\xad" "\x37\xfd\xfd\x1e\x09\x00\x00\x00\x00\x00\x00\x00\x00\x00\x30\xae\xc7\xfc" "\x7f\x06\xd6\x87\x55\xed\xf7\x1c\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\xc3\xed\xca\xd9\x34\x1f" "\xa4\xc8\x85\xd9\x73\xb3\x65\x79\xe3\xfe\xdc\x72\xb9\x74\xf3\x5b\x2d\x9b" "\x49\x1a\x49\x8a\x1f\x25\xc5\x47\xc9\xe5\x74\x96\x1c\xef\xe9\xae\xd8\x69" "\x3f\x1f\x2c\xcd\xbf\xf1\xf1\x27\x1b\xff\x6c\x77\xd4\xfd\x55\xed\x1b\xa3" "\xb6\x1b\xcf\x7a\xbd\x64\x26\xc9\x44\x27\xbd\xf7\xb8\xfa\xbb\x5a\xa7\x23" "\x15\xa3\xa6\x50\x6c\xce\xb0\x0c\xd8\x99\x6e\xe0\x60\xbf\xfd\x37\x00\x00" "\xff\xff\x30\x3b\x0e\x3c", 1716); syz_mount_image(/*fs=*/0x20000c00, /*dir=*/0x20000100, /*flags=MS_NOEXEC*/ 8, /*opts=*/0x200003c0, /*chdir=*/0xfb, /*size=*/0x6b4, /*img=*/0x200013c0); // openat$dir arguments: [ // fd: const = 0xffffffffffffff9c (8 bytes) // file: ptr[in, buffer] { // buffer: {2e 00} (length 0x2) // } // flags: open_flags = 0x0 (4 bytes) // mode: open_mode = 0x120 (2 bytes) // ] // returns fd_dir memcpy((void*)0x20000040, ".\000", 2); res = syscall(__NR_openat, /*fd=*/0xffffffffffffff9cul, /*file=*/0x20000040ul, /*flags=*/0, /*mode=S_IRGRP|S_IRUSR*/ 0x120); if (res != -1) r[0] = res; // getdents64 arguments: [ // fd: fd_dir (resource) // ent: ptr[out, buffer] { // buffer: (DirOut) // } // count: len = 0xcb (8 bytes) // ] syscall(__NR_getdents64, /*fd=*/r[0], /*ent=*/0x20000080ul, /*count=*/0xcbul); return 0; }