// https://syzkaller.appspot.com/bug?id=bc195cf62ac17381792072c72a692bf133c528d4 // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #define BITMASK(bf_off, bf_len) (((1ull << (bf_len)) - 1) << (bf_off)) #define STORE_BY_BITMASK(type, htobe, addr, val, bf_off, bf_len) \ *(type*)(addr) = \ htobe((htobe(*(type*)(addr)) & ~BITMASK((bf_off), (bf_len))) | \ (((type)(val) << (bf_off)) & BITMASK((bf_off), (bf_len)))) #ifndef __NR_sched_setattr #define __NR_sched_setattr 314 #endif uint64_t r[2] = {0xffffffffffffffff, 0xffffffffffffffff}; int main(void) { syscall(__NR_mmap, 0x20000000, 0x1000000, 3, 0x32, -1, 0); long res = 0; *(uint32_t*)0x200002c0 = 0; *(uint32_t*)0x200002c4 = 2; *(uint64_t*)0x200002c8 = 0; *(uint32_t*)0x200002d0 = 0; *(uint32_t*)0x200002d4 = 3; *(uint64_t*)0x200002d8 = 0; *(uint64_t*)0x200002e0 = 0; *(uint64_t*)0x200002e8 = 0; syscall(__NR_sched_setattr, 0, 0x200002c0, 0); memcpy((void*)0x200000c0, "./bus\000", 6); res = syscall(__NR_creat, 0x200000c0, 0); if (res != -1) r[0] = res; *(uint64_t*)0x20000380 = -1; syscall(__NR_write, r[0], 0x20000380, 1); *(uint32_t*)0x20000040 = 1; *(uint32_t*)0x20000044 = 0x70; *(uint8_t*)0x20000048 = 0; *(uint8_t*)0x20000049 = 0; *(uint8_t*)0x2000004a = 0; *(uint8_t*)0x2000004b = 0; *(uint32_t*)0x2000004c = 0; *(uint64_t*)0x20000050 = 0x50d; *(uint64_t*)0x20000058 = 0; *(uint64_t*)0x20000060 = 0; STORE_BY_BITMASK(uint64_t, , 0x20000068, 0, 0, 1); STORE_BY_BITMASK(uint64_t, , 0x20000068, 0, 1, 1); STORE_BY_BITMASK(uint64_t, , 0x20000068, 0, 2, 1); STORE_BY_BITMASK(uint64_t, , 0x20000068, 0, 3, 1); STORE_BY_BITMASK(uint64_t, , 0x20000068, 0, 4, 1); STORE_BY_BITMASK(uint64_t, , 0x20000068, 0, 5, 1); STORE_BY_BITMASK(uint64_t, , 0x20000068, 0, 6, 1); STORE_BY_BITMASK(uint64_t, , 0x20000068, 0, 7, 1); STORE_BY_BITMASK(uint64_t, , 0x20000068, 0, 8, 1); STORE_BY_BITMASK(uint64_t, , 0x20000068, 0, 9, 1); STORE_BY_BITMASK(uint64_t, , 0x20000068, 0, 10, 1); STORE_BY_BITMASK(uint64_t, , 0x20000068, 0, 11, 1); STORE_BY_BITMASK(uint64_t, , 0x20000068, 0, 12, 1); STORE_BY_BITMASK(uint64_t, , 0x20000068, 0, 13, 1); STORE_BY_BITMASK(uint64_t, , 0x20000068, 0, 14, 1); STORE_BY_BITMASK(uint64_t, , 0x20000068, 0, 15, 2); STORE_BY_BITMASK(uint64_t, , 0x20000068, 0, 17, 1); STORE_BY_BITMASK(uint64_t, , 0x20000068, 0, 18, 1); STORE_BY_BITMASK(uint64_t, , 0x20000068, 0, 19, 1); STORE_BY_BITMASK(uint64_t, , 0x20000068, 0, 20, 1); STORE_BY_BITMASK(uint64_t, , 0x20000068, 0, 21, 1); STORE_BY_BITMASK(uint64_t, , 0x20000068, 0, 22, 1); STORE_BY_BITMASK(uint64_t, , 0x20000068, 0, 23, 1); STORE_BY_BITMASK(uint64_t, , 0x20000068, 0, 24, 1); STORE_BY_BITMASK(uint64_t, , 0x20000068, 0, 25, 1); STORE_BY_BITMASK(uint64_t, , 0x20000068, 0, 26, 1); STORE_BY_BITMASK(uint64_t, , 0x20000068, 0, 27, 1); STORE_BY_BITMASK(uint64_t, , 0x20000068, 0, 28, 1); STORE_BY_BITMASK(uint64_t, , 0x20000068, 0, 29, 35); *(uint32_t*)0x20000070 = 0; *(uint32_t*)0x20000074 = 0; *(uint64_t*)0x20000078 = 0; *(uint64_t*)0x20000080 = 0; *(uint64_t*)0x20000088 = 0; *(uint64_t*)0x20000090 = 0; *(uint32_t*)0x20000098 = 0; *(uint32_t*)0x2000009c = 0; *(uint64_t*)0x200000a0 = 0; *(uint32_t*)0x200000a8 = 0; *(uint16_t*)0x200000ac = 0; *(uint16_t*)0x200000ae = 0; syscall(__NR_perf_event_open, 0x20000040, 0, -1, -1, 0); memcpy((void*)0x20000180, "./bus\000", 6); res = syscall(__NR_open, 0x20000180, 0, 0); if (res != -1) r[1] = res; syscall(__NR_sendfile, r[0], r[1], 0, 0x8000fffffffe); return 0; }