// https://syzkaller.appspot.com/bug?id=9d5c2867cf62ffa5b099079467db2de0522fd597 // 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 #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; } //% 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; retry: const int umount_flags = MNT_FORCE | UMOUNT_NOFOLLOW; 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 execute_one(void); #define WAIT_FLAGS __WALL static void loop(void) { int iter = 0; for (;; iter++) { char cwdbuf[32]; sprintf(cwdbuf, "./%d", iter); if (mkdir(cwdbuf, 0777)) exit(1); reset_loop(); int pid = fork(); if (pid < 0) exit(1); if (pid == 0) { if (chdir(cwdbuf)) exit(1); setup_test(); execute_one(); exit(0); } int status = 0; uint64_t start = current_time_ms(); for (;;) { if (waitpid(-1, &status, WNOHANG | WAIT_FLAGS) == pid) break; sleep_ms(1); if (current_time_ms() - start < 5000) continue; kill_and_wait(pid, &status); break; } remove_dir(cwdbuf); } } uint64_t r[4] = {0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff}; void execute_one(void) { intptr_t res = 0; memcpy((void*)0x20000180, "ext4\000", 5); memcpy((void*)0x200000c0, "./file0\000", 8); memcpy((void*)0x20000240, "dioread_nolock", 14); *(uint8_t*)0x2000024e = 0x2c; memcpy((void*)0x2000024f, "auto_da_alloc", 13); *(uint8_t*)0x2000025c = 0x2c; memcpy((void*)0x2000025d, "debug_want_extra_isize", 22); *(uint8_t*)0x20000273 = 0x3d; sprintf((char*)0x20000274, "0x%016llx", (long long)0x5c); *(uint8_t*)0x20000286 = 0x2c; memcpy((void*)0x20000287, "discard", 7); *(uint8_t*)0x2000028e = 0x2c; memcpy((void*)0x2000028f, "mblk_io_submit", 14); *(uint8_t*)0x2000029d = 0x2c; memcpy((void*)0x2000029e, "errors=continue", 15); *(uint8_t*)0x200002ad = 0x2c; memcpy((void*)0x200002ae, "usrjquota=", 10); *(uint8_t*)0x200002b8 = 0x2c; *(uint8_t*)0x200002b9 = 0; memcpy( (void*)0x200008c0, "\x78\x9c\xec\xdb\xbb\x6f\x1c\xc5\x1f\x00\xf0\xef\xee\xd9\xc9\xef\x97\x97" "\x4d\x08\x8f\x98\x00\x86\x80\xb0\x78\xd8\xb1\x13\x20\x05\x0d\x08\x24\x0a" "\x90\x90\xa0\x08\xa5\xb1\x9d\xc8\xe4\x12\xa3\xd8\x48\x24\xb2\xc0\x20\x14" "\x4a\x14\x89\x1e\x51\x22\xf1\x17\x50\x41\x83\x80\x0a\x89\x16\x7a\x14\x29" "\x02\x37\x09\x54\x46\xbb\xb7\xeb\x9c\x2f\x3e\xc7\x8f\x73\x2e\x64\x3f\x1f" "\x69\xed\x99\xdb\xb9\x9b\xf9\xde\xec\xdc\xce\xee\xdc\x05\x50\x59\x83\xd9" "\x9f\x24\x62\x4f\x44\xfc\x16\x11\x7d\x8d\xec\xca\x02\x83\x8d\x7f\xd7\x16" "\xe7\x27\xfe\x5e\x9c\x9f\x48\x62\x69\xe9\xcd\x3f\x93\xbc\xdc\xd5\xc5\xf9" "\x89\xb2\x68\xf9\xbc\xdd\x45\x66\x28\x8d\x48\x3f\x4d\x8a\x4a\x56\x9a\x3d" "\x7f\xe1\xf4\x78\xbd\x3e\x75\xae\xc8\x8f\xcc\x9d\x79\x6f\x64\xf6\xfc\x85" "\x67\xa6\xcf\x8c\x9f\x9a\x3a\x35\x75\x76\xec\xf8\xf1\x63\x47\x47\x9f\x7f" "\x6e\xec\xd9\x8e\xc4\x99\xc5\x75\x75\xe0\xc3\x99\x43\x07\x5f\x7d\xfb\xd2" "\xeb\x13\x27\x2e\xbd\xf3\xd3\x37\x59\x7b\xf7\x14\xfb\x9b\xe3\xe8\x94\xc1" "\x2c\xf0\xbf\x96\x72\xad\xfb\x1e\xef\x74\x65\x5d\xb6\xb7\x29\x9d\xf4\x74" "\xb1\x21\x6c\x48\x2d\x22\xb2\xee\xea\xcd\xc7\x7f\x5f\xd4\xe2\x7a\xe7\xf5" "\xc5\x2b\x9f\x74\xb5\x71\xc0\xb6\xca\xce\x4d\x3b\xdb\xef\x5e\x58\x02\xee" "\x60\x49\x74\xbb\x05\x40\x77\x94\x27\xfa\xec\xfa\xb7\xdc\x6e\xd1\xd4\xe3" "\xb6\x70\xe5\xc5\xc6\x05\x50\x16\xf7\xb5\x62\x6b\xec\xe9\x89\xb4\x28\xd3" "\xdb\x72\x7d\xdb\x49\x83\x11\x71\x62\xe1\x9f\x2f\xb3\x2d\xb6\xe9\x3e\x04" "\x00\x40\xb3\xef\xb2\xf9\xcf\xd3\xab\xcd\xff\xd2\xb8\xb7\xa9\xdc\xbe\x62" "\x0d\xa5\x3f\x22\xee\x8a\x88\xfd\x11\x71\x77\x44\x1c\x88\x88\x7b\x22\xf2" "\xb2\xf7\x45\xc4\xfd\x1b\xac\xbf\x75\x69\xe8\xc6\xf9\x4f\x7a\x79\x53\x81" "\xad\x53\x36\xff\x7b\xa1\x58\xdb\x5a\x39\xff\x2b\x67\x7f\xd1\x5f\x2b\x72" "\x7b\xf3\xf8\x7b\x93\x93\xd3\xf5\xa9\x23\xc5\x7b\x32\x14\xbd\x3b\xb3\xfc" "\xe8\x1a\x75\x7c\xff\xf2\xaf\x9f\xb7\xdb\xd7\x3c\xff\xcb\xb6\xac\xfe\x72" "\x2e\x58\xb4\xe3\x72\x4f\xcb\x0d\xba\xc9\xf1\xb9\xf1\x7c\x52\xda\x01\x57" "\x3e\x8e\x18\xe8\x59\x2d\xfe\x64\x79\x25\x20\x89\x88\x83\x11\x31\xb0\xb1" "\x97\xde\x57\x26\xa6\x9f\xfc\xfa\x50\xbb\x42\x37\x8f\x7f\x0d\x1d\x58\x67" "\x5a\xfa\x2a\xe2\x89\x46\xff\x2f\x44\x4b\xfc\xa5\x64\xed\xf5\xc9\x91\xff" "\x45\x7d\xea\xc8\x48\x79\x54\xdc\xe8\xe7\x5f\x2e\xbe\xd1\xae\xfe\x2d\xc5" "\xdf\x01\x59\xff\xef\x5a\x79\xfc\xb7\x16\xe9\x4f\x9a\xd7\x6b\x67\x37\x5e" "\xc7\xc5\xdf\x3f\x6b\x7b\x4d\xb3\xd9\xe3\x7f\x47\xf2\x56\xde\x2f\x3b\x8a" "\xc7\x3e\x18\x9f\x9b\x3b\x37\x1a\xb1\x23\x79\x2d\xcf\xaf\x78\x7c\xec\xfa" "\x73\xcb\x7c\x59\x3e\x8b\x7f\xe8\xf0\xea\xe3\x7f\x7f\xf1\x9c\xac\x9e\x07" "\x22\x22\x3b\x88\x1f\x8c\x88\x87\x22\xe2\xe1\xa2\xed\x8f\x44\xc4\xa3\x11" "\x71\x78\x8d\xf8\x7f\x7c\xe9\xb1\x77\x37\x1f\xff\xf6\xca\xe2\x9f\x5c\xf5" "\xf3\x6f\xf9\xf8\x6f\xe9\xff\x8d\x27\x6a\xa7\x7f\xf8\xb6\x5d\xfd\xeb\xeb" "\xff\x63\x79\x6a\xa8\x78\x24\xff\xfc\xbb\x89\xf5\x36\x70\x2b\xef\x1d\x00" "\x00\x00\xfc\x57\xa4\xf9\x77\xe0\x93\x74\x78\x39\x9d\xa6\xc3\xc3\x8d\xef" "\xf0\x1f\x88\x5d\x69\x7d\x66\x76\xee\xa9\x93\x33\xef\x9f\x9d\x6c\x7c\x57" "\xbe\x3f\x7a\xd3\xf2\x4e\x57\x5f\xd3\xfd\xd0\xd1\x64\xa1\x78\xc5\x46\x7e" "\xac\xb8\x57\x5c\xee\x3f\x5a\xdc\x37\xfe\xa2\xf6\xff\x3c\x3f\x3c\x31\x53" "\x9f\xec\x72\xec\x50\x75\xbb\xdb\x8c\xff\xcc\x1f\xb5\x6e\xb7\x0e\xd8\x76" "\x7e\xaf\x05\xd5\xd5\x3a\xfe\xd3\x2e\xb5\x03\xb8\xf5\x9c\xff\xa1\xba\x8c" "\x7f\xa8\x2e\xe3\x1f\xaa\x6b\xb5\xf1\xff\x51\x4b\xde\x5a\x00\xdc\x99\x9c" "\xff\xa1\xba\x8c\x7f\xa8\x2e\xe3\x1f\xaa\xcb\xf8\x87\x4a\xda\xca\xef\xfa" "\x25\xaa\x9c\x88\xf4\xb6\x68\x86\xc4\x36\x25\xba\xfd\xc9\x04\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\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\x19\xff\x06\x00\x00\xff\xff\x59\x4d" "\xed\x85", 1082); syz_mount_image(/*fs=*/0x20000180, /*dir=*/0x200000c0, /*flags=MS_I_VERSION|MS_NOATIME|0x300*/ 0x800700, /*opts=*/0x20000240, /*chdir=*/1, /*size=*/0x43a, /*img=*/0x200008c0); syscall(__NR_chdir, /*dir=*/0ul); memcpy((void*)0x20000080, "./file0\000", 8); memcpy((void*)0x20000000, "trusted.overlay.upper\000", 22); *(uint8_t*)0x20000d00 = 0; *(uint8_t*)0x20000d01 = 0xfb; *(uint8_t*)0x20000d02 = 0x81; *(uint8_t*)0x20000d03 = 0; *(uint8_t*)0x20000d04 = 0; memcpy((void*)0x20000d05, "\x1a\x37\x97\x04\x6e\x58\x3c\xdf\x55\xf5\x13\xc7\xe3\x8f\xad\x93", 16); memcpy( (void*)0x20000d15, "\x87\x2e\x64\x95\xfa\xcc\xbe\x0c\xe2\x34\xc9\xa9\x38\x17\xc2\x08\xf7\xeb" "\x0b\x94\x17\x78\x53\x06\xa7\x13\x1f\x81\xb8\x48\xdb\x3e\x64\x13\x95\xab" "\x33\xec\x3d\x29\x49\x1d\x66\x4c\x45\x6b\x0c\x90\x5a\x56\x62\xba\xd0\xef" "\x4e\xdb\x3d\x11\xf1\xb9\xfa\x73\xe4\xfd\x87\x25\x9d\x11\xdf\xbd\x02\x97" "\x54\xdf\x17\x8b\x17\xae\x18\x81\x4c\x58\xce\x36\x61\x54\xb1\xa4\x8d\xcb" "\x58\x26\x80\x5e\x9e\x6e\x60\x6b\x6f\x08\x34\x21\x83\xe1\xb9\xca\x2b\x68" "\x68\x29\x9c\xf1\xc1\x71\xdc\x70\x7b\xcf\xf4\x4c\xfe\x45\x95\xd0\x77\x1b" "\x9c\x43\x12\xd2\x58\x3b\x45\xef\xd8\xea\x76\x0c\xc5\xe1\x96\x7a\xe4\x7a" "\x6b\x31\xd3\x7e\x4c\xdd\x40\x64\x5d\x81\x93\x4c\x08\x28\x28\x9d\x6a\x50" "\x6d\x3e\x85\x85\x33\xe7\xcf\xcd\x83\x57\x7d\x75\xc7\xdd\x3f\x45\xb8\x54" "\x4d\x0c\xac\x7f\x2e\x83\x21\xd4\xdc\x11\xda\xf3\x81\x7b\xf9\xd5\x37\xdf" "\x76\x7a\x75\x54\x30\x09\xfc\x98\x00\xd3\xf1\x2e\x9e\x4a\xb4\xf5\x65\x93" "\x14\xf9\x26\x92\x5d\x7f\x8f\x78\xe3\x54\x6f\x39\x79\xd3\xb7\xb7\x72\x30" "\xda\xc6\xf2\x25\xdf\x0b\x8c\xda\x29\x3f\xb8\xee\xfb\x09\xed\xa9\x8c\xb1" "\x33\x4b\xc1\xe0\xfc\xa8\xa0\x81\x2b\x72\x04\x1d\xea\x4f\xe9\x46\x1b\x0c" "\x1f\x92\x5e\x1e\xa1\x9d\xbd\x19\xfd\x81\xaa\x19\x83\x84\x11\x9a\xd0\xe5" "\x95\x48\x81\x0f\xf5\x40\x40\xf8\x8d\x04\x93\xaa\x6f\xd2\x6e\x1b\x73\x42" "\xe4\xa3\x62\x88\x2d\x3c\xc9\xde\x5b\xb1\x3b\x7e\x78\x21\x2b\xb3\x14\xae" "\xe9\x4d\x1d\x1f\xde\x2f\x6c\x79\x34\x4f\x9e\xf1\xf3\x88\xf3\xcd\x71\x4a" "\x53\x55\xef\x6f\xba\x7b\xe3\xe4\x7d\xba\x3a\x61\x6d\xa8\xfc\x6a\x6a\x78" "\x97\x36\x94\xe4\xd0\xa2\x09\x7a\xed\xc0\xd2\x6b\x43\x13\xca\x16\xc4\x81" "\x35\x95\x84\x47\xc9\x55\x69\x62\xcf\x54\xab\xfb\x33\x53\xaf\x16\xef\xdc" "\xce\x7f\x53\x49\xf9\xaa\x3f\x91\x89\x29\x10\x72\x65\x94\xba\x01\xd4\xec" "\xd4\x98\xf7\x95\x79\x85\xdb\xb6\x19\xe4\x2b\x46\x2b\xac\xab\x4e\x60\x08" "\x70\xc3\xc1\x2f\x1e\x24\xa5\x99\x1d\x0a\x0e\x70\xff\x03\x7f\x6e\x0e\xe5" "\xdb\x01\xb7\x93\xe2\x7f\xf8\x89\xe9\x00\x37\x2e\xec\xa9\xa4\x05\xb4\x3a" "\x67\xe0\x4c\xf2\x3a\xed\x69\x1f\x9c\x01\xf9\xfe\xc2\x0d\x3a\x8c\xb0\xb2" "\x48\x2d\x31\xa6\x6e\x10\x4e\x87\x1c\x1b\xea\xba\xfc\xc3\xc4\x39\x13\x4f" "\xde\x98\x68\x35\x2c\xc1\x2e\x3e\xa1\x39\x97\x48\x2d\x67\x3c\x5e\x0e\xf1" "\xa8\x8f\x52\xad\xd7\xe1\x1a\xb4\xa6\xb2\x22\x9a\x53\xd5\x01\xcc\x91\x3d" "\xb3\x79\x39\x43\x6c\x49\x2a\x52\x8c\x31\xd4\x65\x3c\x49\xe9\x79\xf3\xbe" "\x79\xba\xc5\x7d\x80\xb7\xa9\x11\x24\x2c\x5b\x81\x49\xd1\x1e\x51\x3f\x8a" "\xbe\x59\x32\xf2\xe9\x41\xb7\xc1\x4f\x0f\xd4\x11\x8c\x43\x2b\x6b\xa3\xf9" "\xa8\x04\xa9\x78\xc6\x6e\x93\x5f\xd0\x95\x93\x6b\xe7\xa2\x5f\x4c\xc4\xd3" "\x23\x66\x5e\x1b\x38\x7f\x1c\x4d\x1a\xf2\x6c\xab\x1f\xd0\x5b\x3a\x66\x08" "\x4d\x9f\x42\x41\x6e\xab\xa7\xd9\x99\xf5\x85\x81\xd8\x4a\xbf\x49\xbb\xde" "\x35\x46\x39\x7e\x71\xc2\xac\xdd\xea\x15\x96\xbc\x92\xd4\x45\x51\xb9\xfb" "\x5c\x5a\xe8\x5e\xda\xa9\xab\xb4\x7b\x2e\xe0\x64\x66\x21\x63\x1f\x8f\x2d" "\xe6\xd2\x73\xf9\x35\x08\x75\x36\x87\x73\x0a\xf8\xfb\xb7\x5d\xda\xc4\x2d" "\x9a\xb9\xd6\x63\x24\x16\xe1\xc2\xb2\x70\xf2\x43\x8a\x6d\x0e\x6d\x64\xeb" "\xdd\x16\x1a\xfd\x84\x98\x4c\xac\xab\x60\xf2\x13\x9c\x29\xef\x5e\x85\x15" "\x80\x84\x2f\xb3\xde\x91\x88\x0a\x65\x85\xbb\xdf\x13\xcc\x57\xfe\x53\x29" "\x65\x9a\x29\x54\xf3\x13\x3d\xe8\xf5\xc8\xf3\x4d\xee\x68\x06\xda\x03\x29" "\x97\x95\xe3\x2b\xa1\x90\x5e\xc9\x2b\x7f\xab\xdf\xbe\x1d\x7c\x14\x36\x0a" "\xe2\x66\x6f\x1e\x56\x2f\xed\x1c\x99\x6e\x01\xb3\x5e\xa2\xc8\xd7\xf6\xd6" "\xa8\xa2\x17\xa7\xfb\xb4\x3c\x41\x81\x09\xc9\x06\xa7\x28\x96\x45\x45\x81" "\x7a\xc6\xaf\xa8\x59\x0f\x31\x76\x1c\x3d\x25\x1d\x53\xed\xde\xc9\x60\x96" "\x35\x94\xf9\xf8\xd3\x05\xa9\xa1\xb4\xe7\x9c\x16\xc0\x07\x5c\x4d\x24\x28" "\x13\x43\x7b\xd4\x77\xae\x96\xb0\xbd\x7c\xa6\xec", 876); syscall(__NR_lsetxattr, /*path=*/0x20000080ul, /*name=*/0x20000000ul, /*val=*/0x20000d00ul, /*size=*/0x381ul, /*flags=*/0ul); memcpy((void*)0x20000280, "cgroup.controllers\000", 19); res = syscall(__NR_openat, /*fd=*/0xffffff9c, /*file=*/0x20000280ul, /*flags=*/0x275aul, /*mode=*/0ul); if (res != -1) r[0] = res; memcpy((void*)0x20000180, "cgroup.controllers\000", 19); res = syscall(__NR_openat, /*fd=*/0xffffff9c, /*file=*/0x20000180ul, /*flags=*/0x275aul, /*mode=*/0ul); if (res != -1) r[1] = res; res = syscall(__NR_dup3, /*oldfd=*/r[1], /*newfd=*/r[0], /*flags=*/0ul); if (res != -1) r[2] = res; memcpy((void*)0x200001c0, "cpuset.effective_cpus\000", 22); res = syscall(__NR_openat, /*fd=*/0xffffff9c, /*file=*/0x200001c0ul, /*flags=*/0x275aul, /*mode=*/0ul); if (res != -1) r[3] = res; *(uint32_t*)0x200000c0 = 0; *(uint32_t*)0x200000c4 = r[3]; *(uint64_t*)0x200000c8 = 7; *(uint64_t*)0x200000d0 = 0; *(uint64_t*)0x200000d8 = 0; *(uint64_t*)0x200000e0 = 0; syscall(__NR_ioctl, /*fd=*/r[2], /*cmd=*/0xc028660f, /*arg=*/0x200000c0ul); } 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); for (procid = 0; procid < 5; procid++) { if (fork() == 0) { use_temporary_dir(); loop(); } } sleep(1000000); return 0; }