// https://syzkaller.appspot.com/bug?id=5a34035b13d7f4215357b46093ca6d5c45c93f93 // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include static long syz_open_dev(volatile long a0, volatile long a1, volatile long a2) { if (a0 == 0xc || a0 == 0xb) { char buf[128]; sprintf(buf, "/dev/%s/%d:%d", a0 == 0xc ? "char" : "block", (uint8_t)a1, (uint8_t)a2); return open(buf, O_RDWR, 0); } else { unsigned long nb = a1; char buf[1024]; char* hash; strncpy(buf, (char*)a0, sizeof(buf) - 1); buf[sizeof(buf) - 1] = 0; while ((hash = strchr(buf, '#'))) { *hash = '0' + (char)(nb % 10); nb /= 10; } return open(buf, a2, 0); } } uint64_t r[2] = {0xffffffffffffffff, 0xffffffffffffffff}; int main(void) { syscall(__NR_mmap, /*addr=*/0x1ffffffff000ul, /*len=*/0x1000ul, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul); syscall(__NR_mmap, /*addr=*/0x200000000000ul, /*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=*/0x200001000000ul, /*len=*/0x1000ul, /*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)) { } // openat$sysfs arguments: [ // fd: const = 0xffffffffffffff9c (8 bytes) // dir: ptr[in, buffer] { // buffer: {2f 73 79 73 2f 70 6f 77 65 72 2f 70 6d 5f 77 61 6b 65 75 70 // 5f 69 72 71} (length 0x18) // } // flags: open_flags = 0x0 (4 bytes) // mode: open_mode = 0x1a0 (2 bytes) // ] // returns fd memcpy((void*)0x2000000002c0, "/sys/power/pm_wakeup_irq", 24); res = syscall(__NR_openat, /*fd=*/0xffffffffffffff9cul, /*dir=*/0x2000000002c0ul, /*flags=*/0, /*mode=S_IRGRP|S_IWUSR|S_IRUSR*/ 0x1a0); if (res != -1) r[0] = res; // syz_open_dev$loop arguments: [ // dev: ptr[in, buffer] { // buffer: {2f 64 65 76 2f 6c 6f 6f 70 23 00} (length 0xb) // } // id: intptr = 0x81 (8 bytes) // flags: open_flags = 0x0 (8 bytes) // ] // returns fd_loop memcpy((void*)0x200000000440, "/dev/loop#\000", 11); res = -1; res = syz_open_dev(/*dev=*/0x200000000440, /*id=*/0x81, /*flags=*/0); if (res != -1) r[1] = res; // ioctl$LOOP_CONFIGURE arguments: [ // fd: fd_loop (resource) // cmd: const = 0x4c0a (4 bytes) // arg: ptr[in, loop_config] { // loop_config { // fd: fd_loop (resource) // block_size: int32 = 0x800 (4 bytes) // info: loop_info64 { // lo_device: const = 0x2a00 (8 bytes) // lo_inode: const = 0x80010000 (8 bytes) // lo_rdevice: const = 0x0 (8 bytes) // lo_offset: int64 = 0x5 (8 bytes) // lo_sizelimit: int64 = 0x0 (8 bytes) // lo_number: const = 0x0 (4 bytes) // lo_enc_type: lo_encrypt_type = 0x0 (4 bytes) // lo_enc_key_size: int32 = 0x20 (4 bytes) // lo_flags: lo_flags = 0x1c (4 bytes) // lo_file_name: buffer: {fe e8 a2 ab 78 fc 17 9f d1 f8 a0 e9 1d da // ac a7 bd 64 47 a4 b4 e0 0d 96 83 dd a1 af 1e a0 9d e2 b7 fb 0a 01 // 00 00 00 00 00 00 00 00 03 00 00 00 00 00 00 00 00 00 00 00 00 00 // 00 00 00 00 00 00} (length 0x40) lo_crypt_name: buffer: {28 09 e8 // db e1 08 59 89 27 87 53 97 ba b2 2d 00 00 b4 20 a9 c8 1f 40 f0 5f // 81 9e 01 17 7d 3d 45 8d ac 00 00 00 00 00 00 00 00 00 00 00 3b 00 // 00 00 00 00 00 00 00 02 00 00 00 00 00 00 00 00 00} (length 0x40) // lo_enc_key: buffer: {90 be 8b 1c 55 12 40 6c 7f 00 00 00 00 00 00 // 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00} (length 0x20) // lo_init: array[int64] { // int64 = 0x4 (8 bytes) // int64 = 0x40000000000000 (8 bytes) // } // } // reserved: buffer: {00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 // 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 // 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 // 00 00} (length 0x40) // } // } // ] *(uint32_t*)0x200000001600 = r[0]; *(uint32_t*)0x200000001604 = 0x800; *(uint64_t*)0x200000001608 = 0x2a00; *(uint64_t*)0x200000001610 = 0x80010000; *(uint64_t*)0x200000001618 = 0; *(uint64_t*)0x200000001620 = 5; *(uint64_t*)0x200000001628 = 0; *(uint32_t*)0x200000001630 = 0; *(uint32_t*)0x200000001634 = 0; *(uint32_t*)0x200000001638 = 0x20; *(uint32_t*)0x20000000163c = 0x1c; memcpy((void*)0x200000001640, "\xfe\xe8\xa2\xab\x78\xfc\x17\x9f\xd1\xf8\xa0\xe9\x1d\xda\xac\xa7\xbd" "\x64\x47\xa4\xb4\xe0\x0d\x96\x83\xdd\xa1\xaf\x1e\xa0\x9d\xe2\xb7\xfb" "\x0a\x01\x00\x00\x00\x00\x00\x00\x00\x00\x03\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 64); memcpy((void*)0x200000001680, "\x28\x09\xe8\xdb\xe1\x08\x59\x89\x27\x87\x53\x97\xba\xb2\x2d\x00\x00" "\xb4\x20\xa9\xc8\x1f\x40\xf0\x5f\x81\x9e\x01\x17\x7d\x3d\x45\x8d\xac" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x3b\x00\x00\x00\x00\x00" "\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00", 64); memcpy((void*)0x2000000016c0, "\x90\xbe\x8b\x1c\x55\x12\x40\x6c\x7f\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 32); *(uint64_t*)0x2000000016e0 = 4; *(uint64_t*)0x2000000016e8 = 0x40000000000000; memset((void*)0x2000000016f0, 0, 64); syscall(__NR_ioctl, /*fd=*/r[1], /*cmd=*/0x4c0a, /*arg=*/0x200000001600ul); // ioctl$LOOP_CHANGE_FD arguments: [ // fd: fd_loop (resource) // cmd: const = 0x4c06 (4 bytes) // arg: fd (resource) // ] syscall(__NR_ioctl, /*fd=*/r[1], /*cmd=*/0x4c06, /*arg=*/r[0]); return 0; }