// https://syzkaller.appspot.com/bug?id=02aa198e98c66663f04aef8b563f45a72d9e4bcd // autogenerated by syzkaller (http://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #define BITMASK_LEN(type, bf_len) (type)((1ull << (bf_len)) - 1) #define BITMASK_LEN_OFF(type, bf_off, bf_len) \ (type)(BITMASK_LEN(type, (bf_len)) << (bf_off)) #define STORE_BY_BITMASK(type, addr, val, bf_off, bf_len) \ if ((bf_off) == 0 && (bf_len) == 0) { \ *(type*)(addr) = (type)(val); \ } else { \ type new_val = *(type*)(addr); \ new_val &= ~BITMASK_LEN_OFF(type, (bf_off), (bf_len)); \ new_val |= ((type)(val)&BITMASK_LEN(type, (bf_len))) << (bf_off); \ *(type*)(addr) = new_val; \ } uint64_t r[2] = {0xffffffffffffffff, 0xffffffffffffffff}; void loop() { long res = 0; memcpy((void*)0x20000000, "./file0", 8); res = syscall(__NR_open, 0x20000000, 0x440, 0); if (res != -1) r[0] = res; *(uint32_t*)0x2025c000 = 6; *(uint32_t*)0x2025c004 = 0x70; *(uint8_t*)0x2025c008 = 0; *(uint8_t*)0x2025c009 = 0; *(uint8_t*)0x2025c00a = 0; *(uint8_t*)0x2025c00b = 0; *(uint32_t*)0x2025c00c = 0; *(uint64_t*)0x2025c010 = 0; *(uint64_t*)0x2025c018 = 0; *(uint64_t*)0x2025c020 = 0; STORE_BY_BITMASK(uint64_t, 0x2025c028, 0, 0, 1); STORE_BY_BITMASK(uint64_t, 0x2025c028, 0, 1, 1); STORE_BY_BITMASK(uint64_t, 0x2025c028, 0, 2, 1); STORE_BY_BITMASK(uint64_t, 0x2025c028, 0, 3, 1); STORE_BY_BITMASK(uint64_t, 0x2025c028, 0, 4, 1); STORE_BY_BITMASK(uint64_t, 0x2025c028, 0, 5, 1); STORE_BY_BITMASK(uint64_t, 0x2025c028, 0, 6, 1); STORE_BY_BITMASK(uint64_t, 0x2025c028, 0, 7, 1); STORE_BY_BITMASK(uint64_t, 0x2025c028, 0, 8, 1); STORE_BY_BITMASK(uint64_t, 0x2025c028, 0, 9, 1); STORE_BY_BITMASK(uint64_t, 0x2025c028, 0, 10, 1); STORE_BY_BITMASK(uint64_t, 0x2025c028, 0, 11, 1); STORE_BY_BITMASK(uint64_t, 0x2025c028, 0, 12, 1); STORE_BY_BITMASK(uint64_t, 0x2025c028, 0, 13, 1); STORE_BY_BITMASK(uint64_t, 0x2025c028, 0, 14, 1); STORE_BY_BITMASK(uint64_t, 0x2025c028, 0, 15, 2); STORE_BY_BITMASK(uint64_t, 0x2025c028, 0, 17, 1); STORE_BY_BITMASK(uint64_t, 0x2025c028, 0, 18, 1); STORE_BY_BITMASK(uint64_t, 0x2025c028, 0, 19, 1); STORE_BY_BITMASK(uint64_t, 0x2025c028, 0, 20, 1); STORE_BY_BITMASK(uint64_t, 0x2025c028, 0, 21, 1); STORE_BY_BITMASK(uint64_t, 0x2025c028, 0, 22, 1); STORE_BY_BITMASK(uint64_t, 0x2025c028, 0, 23, 1); STORE_BY_BITMASK(uint64_t, 0x2025c028, 0, 24, 1); STORE_BY_BITMASK(uint64_t, 0x2025c028, 0, 25, 1); STORE_BY_BITMASK(uint64_t, 0x2025c028, 0, 26, 1); STORE_BY_BITMASK(uint64_t, 0x2025c028, 0, 27, 1); STORE_BY_BITMASK(uint64_t, 0x2025c028, 0, 28, 1); STORE_BY_BITMASK(uint64_t, 0x2025c028, 0, 29, 35); *(uint32_t*)0x2025c030 = 0; *(uint32_t*)0x2025c034 = 2; *(uint64_t*)0x2025c038 = 0x20000000; *(uint64_t*)0x2025c040 = 0; *(uint64_t*)0x2025c048 = 0; *(uint64_t*)0x2025c050 = 0; *(uint32_t*)0x2025c058 = 0; *(uint32_t*)0x2025c05c = 0; *(uint64_t*)0x2025c060 = 0; *(uint32_t*)0x2025c068 = 0; *(uint16_t*)0x2025c06c = 0; *(uint16_t*)0x2025c06e = 0; syscall(__NR_perf_event_open, 0x2025c000, 0, 0, -1, 0); memcpy((void*)0x20000140, "./file0", 8); res = syscall(__NR_creat, 0x20000140, -1); if (res != -1) r[1] = res; memcpy((void*)0x20000080, "\x4b\x9a\xc5\x0e\x6c\x79\xfd\x21\x00\xcd\x64\xeb\xc9\xeb\x47\x32\x33" "\xe3\xd7\xa6\x52\xff\x03\x00\x00\xfd\x07\x32\xad\xc7\x58\xc4\x83\xab" "\xed\xba\x15\x0d\xf0\x4a\xc7\x24\x49\x05\x83\x81\x81\x4c\x6f\x27\x8f" "\x57\x60\xfe\x5c\x51\x81\xd4\xa1\xb4\xea\x5e\x4f\x66\x97\x7c\x84\x5d" "\x8e\x23\xf7\xd9\xab\x56\xb6\x5a\x5c\xfa\xd8\x06\xc2\x0d\xc1\x98\x8b" "\x42\xd7\x10\x2f\xd3\x7b\x60\xd2\x6b\x28\x89\xdb\xbd\x32\x06\x2b\xff" "\x83\x12\xc4\x73\x58\x51\x38\xd6\xa9\x57\xe0\x82\x37", 115); syscall(__NR_write, r[1], 0x20000080, 0x73); syscall(__NR_mmap, 0x2000c000, 0x2000, 0, 0x12, r[0], 0); } int main() { syscall(__NR_mmap, 0x20000000, 0x1000000, 3, 0x32, -1, 0); loop(); return 0; }