// https://syzkaller.appspot.com/bug?id=33ec22fbb67b1b129164ca6c1709958292abbb32 // 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 #ifndef __NR_bpf #define __NR_bpf 321 #endif #ifndef __NR_memfd_create #define __NR_memfd_create 319 #endif #ifndef __NR_renameat2 #define __NR_renameat2 316 #endif static unsigned long long procid; //% 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; } uint64_t r[2] = {0xffffffffffffffff, 0xffffffffffffffff}; int main(void) { syscall(__NR_mmap, /*addr=*/0x1ffffffff000ul, /*len=*/0x1000, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul); syscall(__NR_mmap, /*addr=*/0x200000000000ul, /*len=*/0x1000000, /*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=*/0x200001000000ul, /*len=*/0x1000, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul); const char* reason; (void)reason; intptr_t res = 0; if (write(1, "executing program\n", sizeof("executing program\n") - 1)) { } // syz_mount_image$ext4 arguments: [ // fs: ptr[in, buffer] { // buffer: {65 78 74 34 00} (length 0x5) // } // dir: ptr[in, buffer] { // buffer: {2e 2f 66 69 6c 65 30 00} (length 0x8) // } // flags: mount_flags = 0x2010480 (8 bytes) // opts: ptr[in, fs_options[ext4_options]] { // fs_options[ext4_options] { // elems: array[fs_opt_elem[ext4_options]] { // fs_opt_elem[ext4_options] { // elem: union ext4_options { // grpjquota: buffer: {67 72 70 6a 71 75 6f 74 61 3d} (length // 0xa) // } // comma: const = 0x2c (1 bytes) // } // } // common: array[fs_opt_elem[fs_options_common]] { // } // null: const = 0x0 (1 bytes) // } // } // chdir: int8 = 0x5 (1 bytes) // size: len = 0x77a (8 bytes) // img: ptr[in, buffer] { // buffer: (compressed buffer with length 0x77a) // } // ] // returns fd_dir memcpy((void*)0x200000000780, "ext4\000", 5); memcpy((void*)0x200000000240, "./file0\000", 8); memcpy((void*)0x2000000006c0, "grpjquota=", 10); *(uint8_t*)0x2000000006ca = 0x2c; *(uint8_t*)0x2000000006cb = 0; memcpy( (void*)0x2000000012c0, "\x78\x9c\xec\xdd\xcd\x6b\x1c\xe5\x1f\x00\xf0\xef\x6c\xde\x9a\xb4\xbf\x5f" "\x22\x08\x5a\x4f\x01\x41\x03\xa5\x1b\x53\x63\xab\xe0\xa1\xe2\x41\x04\x0b" "\x05\x3d\xdb\x2e\x9b\x6d\xa8\xd9\x64\x4b\x76\x53\x9a\x10\xb0\x45\x04\x2f" "\x82\x8a\x07\x41\x2f\x3d\xfb\x52\x6f\x5e\x7d\xb9\xea\x7f\xe1\x41\x5a\xaa" "\xa6\xc5\x8a\x07\x89\xcc\x66\xb7\xdd\x34\xbb\xe9\x26\xcd\x6e\x94\xfd\x7c" "\x60\xb2\xcf\x33\x2f\x79\x9e\xef\xcc\x3c\x33\xcf\xee\x0c\x33\x01\xf4\xac" "\xf1\xf4\x4f\x26\xe2\x70\x44\x7c\x90\x44\x8c\xd6\xc6\x27\x11\x31\x50\x4d" "\xf5\x47\x9c\xdc\x98\xef\xce\xda\x6a\x3e\x1d\x92\x58\x5f\x7f\xfd\xb7\xa4" "\x3a\xcf\xed\xb5\xd5\x7c\x34\x2c\x93\x3a\x58\xcb\x3c\x1e\x11\xdf\xbf\x1b" "\x71\x24\xb3\xb5\xdc\xf2\xf2\xca\x5c\xae\x58\x2c\x2c\xd6\xf2\x93\x95\xf9" "\x0b\x93\xe5\xe5\x95\xa3\xe7\xe7\x73\xb3\x85\xd9\xc2\xc2\xf1\xa9\xe9\xe9" "\x63\x27\x9e\x3b\x71\x7c\xef\x62\xfd\xe3\xa7\x95\x43\x37\x3e\x7c\xe5\xe9" "\xaf\x4e\xfe\xf5\xce\x63\xd7\xde\xff\x21\x89\x93\x71\xa8\x36\xad\x31\x8e" "\xbd\x32\x1e\xe3\xb5\x75\x32\x90\xae\xc2\x4d\x5e\xde\xeb\xc2\xf6\x59\xb2" "\xdf\x15\x60\x57\xd2\xa6\xd9\xb7\xd1\xca\xe3\x70\x8c\x46\x5f\x35\xd5\xc2" "\x70\x37\x6b\x06\x00\x74\xca\xdb\x11\xb1\x0e\x00\xf4\x98\xc4\xf9\x1f\x00" "\x7a\x4c\xfd\x77\x80\xdb\x6b\xab\xf9\xfa\xb0\xbf\xbf\x48\x74\xd7\xcd\x97" "\x22\xe2\xc0\x46\xfc\xf5\xeb\x9b\x1b\x53\xfa\x6b\xd7\xec\x0e\x54\xaf\x83" "\x8e\xdc\x4e\x36\x5d\x19\x49\x22\x62\x6c\x0f\xca\x1f\x8f\x88\xcf\xbe\x79" "\xf3\x8b\x74\x88\x0e\x5d\x87\x04\x68\xe6\xf2\x95\x88\x38\x3b\x36\xbe\xf5" "\xf8\x9f\x6c\xb9\x67\x61\xa7\x9e\x69\x63\x9e\xf1\xfb\xf2\x8e\x7f\xd0\x3d" "\xdf\xa6\xfd\x9f\xe7\x9b\xf5\xff\x32\x77\xfb\x3f\xd1\xa4\xff\x33\xd4\xa4" "\xed\xee\xc6\x83\xdb\x7f\xe6\xfa\x1e\x14\xd3\x52\xda\xff\x7b\xb1\xe1\xde" "\xb6\x3b\x0d\xf1\xd7\x8c\xf5\xd5\x72\xff\xab\xf6\xf9\x06\x92\x73\xe7\x8b" "\x85\xf4\xd8\xf6\xff\x88\x98\x88\x81\xa1\x34\x3f\xb5\x4d\x19\x13\xb7\xfe" "\xbe\xd5\x6a\x5a\x63\xff\xef\xf7\x8f\xde\xfa\x3c\x2d\x3f\xfd\xbc\x37\x47" "\xe6\x7a\xff\xd0\xe6\x65\x66\x72\x95\xdc\xc3\xc4\xdc\xe8\xe6\x95\x88\x27" "\xfa\x9b\xc5\x9f\xdc\xdd\xfe\x49\x8b\xfe\xef\xe9\x36\xcb\x78\xf5\x85\xf7" "\x3e\x6d\x35\x2d\x8d\x3f\x8d\xb7\x3e\x6c\x8d\xbf\xb3\xd6\xaf\x46\x3c\xd5" "\x74\xfb\xdf\xbb\xa3\x2d\xd9\xf6\xfe\xc4\xc9\xea\xee\x30\x59\xdf\x29\x9a" "\xf8\xfa\xe7\x4f\x46\x5a\x95\xdf\xb8\xfd\xd3\x21\x2d\xbf\xfe\x5d\xa0\x1b" "\xd2\xed\x3f\xb2\x7d\xfc\x63\x49\xe3\xfd\x9a\xe5\x9d\x97\xf1\xe3\xd5\xd1" "\xef\x5a\x4d\x7b\x70\xfc\xcd\xf7\xff\xc1\xe4\x8d\x6a\x7a\xb0\x36\xee\x52" "\xae\x52\x59\x9c\x8a\x18\x4c\x5e\xdb\x3a\xfe\xd8\xbd\x65\xeb\xf9\xfa\xfc" "\x69\xfc\x13\x4f\x36\x6f\xff\xdb\xed\xff\xe9\x77\xc2\xb3\x6d\xc6\xdf\x7f" "\xe3\xd7\x2f\x77\x1f\x7f\x67\xa5\xf1\xcf\xec\x68\xfb\xb7\x95\xa8\xaf\xfe" "\xea\x98\x6b\x77\xe6\xfa\x5a\x95\xdf\xde\xf6\x9f\xae\xa6\x26\x6a\x63\xda" "\x39\xfe\xb5\x5b\xd3\xdd\xae\x37\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\xd8\x89\x4c\x44\x1c\x8a\x24\x93\xbd" "\x9b\xce\x64\xb2\xd9\x8d\x77\x78\x3f\x1a\x23\x99\x62\xa9\x5c\x39\x72\xae" "\xb4\xb4\x30\x13\xd5\x77\x65\x8f\xc5\x40\xa6\xfe\xa8\xcb\xd1\x86\xe7\xa1" "\x4e\xd5\x9e\x87\x5f\xcf\x1f\xbb\x2f\xff\x6c\x44\x3c\x12\x11\x1f\x0f\x0d" "\x57\xf3\xd9\x7c\xa9\x38\xd3\xf2\xa9\xa0\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\xd0\x5d\x07\x5b\xbc\xff\x3f\xf5\xcb\xd0\x7e\xd7\x0e" "\x00\xe8\x98\x03\xfb\x5d\x01\x00\xa0\xeb\x9c\xff\x01\xa0\xf7\xec\xec\xfc" "\x3f\xdc\xb1\x7a\x00\x00\xdd\xe3\xfb\x3f\x00\xf4\x1e\xe7\x7f\x00\xe8\x3d" "\xce\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x74" "\xd8\xe9\x53\xa7\xd2\x61\xfd\xcf\xb5\xd5\x7c\x9a\x9f\xb9\xb8\xbc\x34\x57" "\xba\x78\x74\xa6\x50\x9e\xcb\xce\x2f\xe5\xb3\xf9\xd2\xe2\x85\xec\x6c\xa9" "\x34\x5b\x2c\x64\xf3\xa5\xf9\x96\xff\xe8\xf2\xc6\x47\xb1\x54\xba\x30\x1d" "\x0b\x4b\x97\x26\x2b\x85\x72\x65\xb2\xbc\xbc\x72\x66\xbe\xb4\xb4\x50\x39" "\x73\x7e\x3e\x37\x5b\x38\x53\x18\xe8\x5a\x64\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\xd0\xbe\xf2\xf2\xca\x5c\xae\x58\x2c\x2c\x4a\x48" "\x48\xec\x30\x31\xf8\xef\xa8\x46\xf3\x44\xbd\x89\x3f\xe4\xe2\xa9\xe1\x7d" "\x39\x36\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\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xfc\x17\xfc\x13\x00\x00" "\xff\xff\x43\x36\x24\x1a", 1914); syz_mount_image( /*fs=*/0x200000000780, /*dir=*/0x200000000240, /*flags=MS_LAZYTIME|MS_POSIXACL|MS_NOATIME|MS_DIRSYNC*/ 0x2010480, /*opts=*/0x2000000006c0, /*chdir=*/5, /*size=*/0x77a, /*img=*/0x2000000012c0); // sendmsg$netlink arguments: [ // fd: sock_netlink (resource) // msg: ptr[in, msghdr_netlink_full[netlink_msg_t[netlink_random_msg_type, // void, nl_generic_attr]]] { // msghdr_netlink_full[netlink_msg_t[netlink_random_msg_type, void, // nl_generic_attr]] { // addr: nil // addrlen: len = 0x0 (4 bytes) // pad = 0x0 (4 bytes) // vec: ptr[in, array[iovec[in, netlink_msg_t[netlink_random_msg_type, // void, nl_generic_attr]]]] { // array[iovec[in, netlink_msg_t[netlink_random_msg_type, void, // nl_generic_attr]]] { // iovec[in, netlink_msg_t[netlink_random_msg_type, void, // nl_generic_attr]] { // addr: ptr[inout, array[ANYUNION]] { // array[ANYUNION] { // union ANYUNION { // ANYBLOB: buffer: {e0 00 00 00 10 00 09 05 00 c1 00 00 00 // 00 00 00 08 00 43 00 ff 03 00 00 a9 00 00 00 0b 0e 13 e7 // 35 a3 18 4f 12 3d 6d 92 f1 ac cf da ee 2d d2 b1 84 b2 7d // b1 f3 ea 77 67 bf 00 04 00 3d d9 3d 00 00 00 00 00 1d ce // df 59 66 bd 8b 85 b0 1b} (length 0x4e) // } // union ANYUNION { // ANYRESOCT: ANYRES64 (resource) // } // } // } // len: len = 0xe0 (8 bytes) // } // } // } // vlen: len = 0x1 (8 bytes) // ctrl: nil // ctrllen: bytesize = 0x0 (8 bytes) // f: send_flags = 0x4000011 (4 bytes) // pad = 0x0 (4 bytes) // } // } // f: send_flags = 0x200480c2 (8 bytes) // ] *(uint64_t*)0x200000000080 = 0; *(uint32_t*)0x200000000088 = 0; *(uint64_t*)0x200000000090 = 0x200000000b00; *(uint64_t*)0x200000000b00 = 0x200000000200; memcpy((void*)0x200000000200, "\xe0\x00\x00\x00\x10\x00\x09\x05\x00\xc1\x00\x00\x00\x00\x00\x00\x08" "\x00\x43\x00\xff\x03\x00\x00\xa9\x00\x00\x00\x0b\x0e\x13\xe7\x35\xa3" "\x18\x4f\x12\x3d\x6d\x92\xf1\xac\xcf\xda\xee\x2d\xd2\xb1\x84\xb2\x7d" "\xb1\xf3\xea\x77\x67\xbf\x00\x04\x00\x3d\xd9\x3d\x00\x00\x00\x00\x00" "\x1d\xce\xdf\x59\x66\xbd\x8b\x85\xb0\x1b", 78); sprintf((char*)0x20000000024e, "%023llo", (long long)-1); *(uint64_t*)0x200000000b08 = 0xe0; *(uint64_t*)0x200000000098 = 1; *(uint64_t*)0x2000000000a0 = 0; *(uint64_t*)0x2000000000a8 = 0; *(uint32_t*)0x2000000000b0 = 0x4000011; syscall(__NR_sendmsg, /*fd=*/(intptr_t)-1, /*msg=*/0x200000000080ul, /*f=MSG_FASTOPEN|MSG_BATCH|MSG_MORE|MSG_EOR|MSG_DONTWAIT|0x2*/ 0x200480c2ul); // renameat2 arguments: [ // oldfd: fd_dir (resource) // old: ptr[in, buffer] { // buffer: {2e 2f 66 69 6c 65 30 00} (length 0x8) // } // newfd: fd_dir (resource) // new: ptr[in, buffer] { // buffer: {2e 2f 66 69 6c 65 37 00} (length 0x8) // } // flags: renameat2_flags = 0x5 (8 bytes) // ] memcpy((void*)0x200000000000, "./file0\000", 8); memcpy((void*)0x200000000480, "./file7\000", 8); syscall(__NR_renameat2, /*oldfd=*/0xffffff9c, /*old=*/0x200000000000ul, /*newfd=*/0xffffff9c, /*new=*/0x200000000480ul, /*flags=RENAME_WHITEOUT|RENAME_NOREPLACE*/ 5ul); // pipe2$9p arguments: [ // pipefd: ptr[out, pipe_9p] { // pipe_9p { // rfd: rfd9p (resource) // wfd: wfd9p (resource) // } // } // flags: pipe_flags = 0x800 (8 bytes) // ] res = syscall(__NR_pipe2, /*pipefd=*/0x2000000005c0ul, /*flags=O_NONBLOCK*/ 0x800ul); if (res != -1) { r[0] = *(uint32_t*)0x2000000005c0; r[1] = *(uint32_t*)0x2000000005c4; } // bpf$PROG_LOAD arguments: [ // cmd: const = 0x5 (8 bytes) // arg: ptr[in, bpf_prog_t[flags[bpf_prog_type, int32], // bpf_prog_attach_types, bpf_btf_id[opt], fd_bpf_prog[opt]]] { // bpf_prog_t[flags[bpf_prog_type, int32], bpf_prog_attach_types, // bpf_btf_id[opt], fd_bpf_prog[opt]] { // type: bpf_prog_type = 0xc (4 bytes) // ninsn: bytesize8 = 0x16 (4 bytes) // insns: ptr[inout, array[ANYUNION]] { // array[ANYUNION] { // union ANYUNION { // ANYBLOB: buffer: {61 12 6f 00 00 00 00 00 61 13 50 00 00 00 00 // 00 bf 20 00 00 00 00 00 00 07 00 00 00 18 00 00 00 3d 03 01 00 // 00 00 00 00 95 00 f0 00 00 00 00 00 69 26 00 00 00 00 00 00 bf // 67 00 00 00 00 00 00 56 07 02 00 0f 02 00 00 67 06 00 00 20 00 // 00 00 7a 0a 00 ff 0e e6 00 00 bf 25 00 00 00 00 00 00 2d} // (length 0x61) // } // } // } // license: nil // loglev: int32 = 0x0 (4 bytes) // logsize: len = 0x0 (4 bytes) // log: nil // kern_version: bpf_kern_version = 0x0 (4 bytes) // flags: bpf_prog_load_flags = 0x0 (4 bytes) // prog_name: buffer: {00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00} // (length 0x10) prog_ifindex: ifindex (resource) expected_attach_type: // union bpf_prog_attach_types { // fallback: bpf_attach_types = 0x0 (4 bytes) // } // btf_fd: fd_btf (resource) // func_info_rec_size: const = 0x8 (4 bytes) // func_info: nil // func_info_cnt: len = 0x0 (4 bytes) // line_info_rec_size: const = 0x10 (4 bytes) // line_info: nil // line_info_cnt: len = 0x0 (4 bytes) // attach_btf_id: bpf_btf_id (resource) // attach_prog_fd: fd_bpf_prog (resource) // core_relo_cnt: len = 0x0 (4 bytes) // fd_array: nil // core_relos: nil // core_relo_rec_size: const = 0x10 (4 bytes) // log_true_size: int32 = 0x0 (4 bytes) // prog_token_fd: union _bpf_prog_t[flags[bpf_prog_type, int32], // bpf_prog_attach_types, bpf_btf_id[opt], // fd_bpf_prog[opt]]_prog_token_fd_wrapper { // void: buffer: {} (length 0x0) // } // pad: union _bpf_prog_t[flags[bpf_prog_type, int32], // bpf_prog_attach_types, bpf_btf_id[opt], // fd_bpf_prog[opt]]_pad_wrapper { // value: const = 0x0 (4 bytes) // } // } // } // size: len = 0x94 (8 bytes) // ] // returns fd_bpf_prog *(uint32_t*)0x2000000054c0 = 0xc; *(uint32_t*)0x2000000054c4 = 0x16; *(uint64_t*)0x2000000054c8 = 0x200000000200; memcpy((void*)0x200000000200, "\x61\x12\x6f\x00\x00\x00\x00\x00\x61\x13\x50\x00\x00\x00\x00\x00\xbf" "\x20\x00\x00\x00\x00\x00\x00\x07\x00\x00\x00\x18\x00\x00\x00\x3d\x03" "\x01\x00\x00\x00\x00\x00\x95\x00\xf0\x00\x00\x00\x00\x00\x69\x26\x00" "\x00\x00\x00\x00\x00\xbf\x67\x00\x00\x00\x00\x00\x00\x56\x07\x02\x00" "\x0f\x02\x00\x00\x67\x06\x00\x00\x20\x00\x00\x00\x7a\x0a\x00\xff\x0e" "\xe6\x00\x00\xbf\x25\x00\x00\x00\x00\x00\x00\x2d", 97); *(uint64_t*)0x2000000054d0 = 0; *(uint32_t*)0x2000000054d8 = 0; *(uint32_t*)0x2000000054dc = 0; *(uint64_t*)0x2000000054e0 = 0; *(uint32_t*)0x2000000054e8 = 0; *(uint32_t*)0x2000000054ec = 0; memset((void*)0x2000000054f0, 0, 16); *(uint32_t*)0x200000005500 = 0; *(uint32_t*)0x200000005504 = 0; *(uint32_t*)0x200000005508 = -1; *(uint32_t*)0x20000000550c = 8; *(uint64_t*)0x200000005510 = 0; *(uint32_t*)0x200000005518 = 0; *(uint32_t*)0x20000000551c = 0x10; *(uint64_t*)0x200000005520 = 0; *(uint32_t*)0x200000005528 = 0; *(uint32_t*)0x20000000552c = 0; *(uint32_t*)0x200000005530 = -1; *(uint32_t*)0x200000005534 = 0; *(uint64_t*)0x200000005538 = 0; *(uint64_t*)0x200000005540 = 0; *(uint32_t*)0x200000005548 = 0x10; *(uint32_t*)0x20000000554c = 0; *(uint32_t*)0x200000005550 = 0; syscall(__NR_bpf, /*cmd=*/5ul, /*arg=*/0x2000000054c0ul, /*size=*/0x94ul); // mount$9p_fd arguments: [ // src: const = 0x0 (8 bytes) // dst: ptr[in, buffer] { // buffer: {2e 2f 66 69 6c 65 37 00} (length 0x8) // } // type: ptr[in, buffer] { // buffer: {39 70 00} (length 0x3) // } // flags: mount_flags = 0x2 (8 bytes) // opts: ptr[inout, array[ANYUNION]] { // array[ANYUNION] { // union ANYUNION { // ANYBLOB: buffer: {74 72 61 6e 73 3d 66 64 2c 72 66 64 6e 6f 3d} // (length 0xf) // } // union ANYUNION { // ANYRESHEX: ANYRES64 (resource) // } // union ANYUNION { // ANYBLOB: buffer: {2c 77 66 64 6e 6f 3d} (length 0x7) // } // union ANYUNION { // ANYRESHEX: ANYRES64 (resource) // } // union ANYUNION { // ANYBLOB: buffer: {2c 61 6e 61 6d 65 3d 62 c5 8c 09 d6 cb 19 a2 71 // 2c 76 65 72 73 69 6f 6e 3d 39 70 32 30 30 30 2c 63 61 63 68 65 3d} // (length 0x26) // } // } // } // ] memcpy((void*)0x200000002500, "./file7\000", 8); memcpy((void*)0x200000002540, "9p\000", 3); memcpy((void*)0x200000000200, "trans=fd,rfdno=", 15); sprintf((char*)0x20000000020f, "0x%016llx", (long long)r[0]); memcpy((void*)0x200000000221, ",wfdno=", 7); sprintf((char*)0x200000000228, "0x%016llx", (long long)r[1]); memcpy((void*)0x20000000023a, "\x2c\x61\x6e\x61\x6d\x65\x3d\x62\xc5\x8c\x09\xd6\xcb\x19\xa2\x71\x2c" "\x76\x65\x72\x73\x69\x6f\x6e\x3d\x39\x70\x32\x30\x30\x30\x2c\x63\x61" "\x63\x68\x65\x3d", 38); syscall(__NR_mount, /*src=*/0ul, /*dst=*/0x200000002500ul, /*type=*/0x200000002540ul, /*flags=MS_NOSUID*/ 2ul, /*opts=*/0x200000000200ul); return 0; }