// https://syzkaller.appspot.com/bug?id=6b4e2b81615c710577f2832bf4d54a7834fa11de // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #ifndef __NR_bpf #define __NR_bpf 321 #endif #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)))) uint64_t r[1] = {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)) { } *(uint32_t*)0x200000000000 = 0xa; *(uint32_t*)0x200000000004 = 1; *(uint32_t*)0x200000000008 = 0x42; *(uint32_t*)0x20000000000c = 0x40; *(uint32_t*)0x200000000010 = 0xc2; *(uint32_t*)0x200000000014 = 1; *(uint32_t*)0x200000000018 = 0; memset((void*)0x20000000001c, 0, 16); *(uint32_t*)0x20000000002c = 0; *(uint32_t*)0x200000000030 = -1; *(uint32_t*)0x200000000034 = 0; *(uint32_t*)0x200000000038 = 0; *(uint32_t*)0x20000000003c = 0; *(uint64_t*)0x200000000040 = 0; *(uint32_t*)0x200000000048 = 0; *(uint32_t*)0x20000000004c = 0; res = syscall(__NR_bpf, /*cmd=*/0ul, /*arg=*/0x200000000000ul, /*size=*/0x48ul); if (res != -1) r[0] = res; *(uint32_t*)0x2000000005c0 = 0xe; *(uint32_t*)0x2000000005c4 = 8; *(uint64_t*)0x2000000005c8 = 0x200000000100; *(uint8_t*)0x200000000100 = 0x18; STORE_BY_BITMASK(uint8_t, , 0x200000000101, 2, 0, 4); STORE_BY_BITMASK(uint8_t, , 0x200000000101, 0, 4, 4); *(uint16_t*)0x200000000102 = 0; *(uint32_t*)0x200000000104 = 1; *(uint8_t*)0x200000000108 = 0; *(uint8_t*)0x200000000109 = 0; *(uint16_t*)0x20000000010a = 0; *(uint32_t*)0x20000000010c = 7; *(uint8_t*)0x200000000110 = 0x18; STORE_BY_BITMASK(uint8_t, , 0x200000000111, 2, 0, 4); STORE_BY_BITMASK(uint8_t, , 0x200000000111, 1, 4, 4); *(uint16_t*)0x200000000112 = 0; *(uint32_t*)0x200000000114 = r[0]; *(uint8_t*)0x200000000118 = 0; *(uint8_t*)0x200000000119 = 0; *(uint16_t*)0x20000000011a = 0; *(uint32_t*)0x20000000011c = 0; STORE_BY_BITMASK(uint8_t, , 0x200000000120, 7, 0, 3); STORE_BY_BITMASK(uint8_t, , 0x200000000120, 0, 3, 1); STORE_BY_BITMASK(uint8_t, , 0x200000000120, 0xb, 4, 4); STORE_BY_BITMASK(uint8_t, , 0x200000000121, 3, 0, 4); STORE_BY_BITMASK(uint8_t, , 0x200000000121, 0, 4, 4); *(uint16_t*)0x200000000122 = 0; *(uint32_t*)0x200000000124 = 0; *(uint8_t*)0x200000000128 = 0x85; *(uint8_t*)0x200000000129 = 0; *(uint16_t*)0x20000000012a = 0; *(uint32_t*)0x20000000012c = 0xc; STORE_BY_BITMASK(uint8_t, , 0x200000000130, 7, 0, 3); STORE_BY_BITMASK(uint8_t, , 0x200000000130, 0, 3, 1); STORE_BY_BITMASK(uint8_t, , 0x200000000130, 0xb, 4, 4); STORE_BY_BITMASK(uint8_t, , 0x200000000131, 0, 0, 4); STORE_BY_BITMASK(uint8_t, , 0x200000000131, 0, 4, 4); *(uint16_t*)0x200000000132 = 0; *(uint32_t*)0x200000000134 = 0; *(uint8_t*)0x200000000138 = 0x95; *(uint8_t*)0x200000000139 = 0; *(uint16_t*)0x20000000013a = 0; *(uint32_t*)0x20000000013c = 0; *(uint64_t*)0x2000000005d0 = 0x200000000340; memcpy((void*)0x200000000340, "GPL\000", 4); *(uint32_t*)0x2000000005d8 = 8; *(uint32_t*)0x2000000005dc = 0; *(uint64_t*)0x2000000005e0 = 0; *(uint32_t*)0x2000000005e8 = 0x41000; *(uint32_t*)0x2000000005ec = 0; memset((void*)0x2000000005f0, 0, 16); *(uint32_t*)0x200000000600 = 0; *(uint32_t*)0x200000000604 = 0x25; *(uint32_t*)0x200000000608 = -1; *(uint32_t*)0x20000000060c = 8; *(uint64_t*)0x200000000610 = 0; *(uint32_t*)0x200000000618 = 0; *(uint32_t*)0x20000000061c = 0x10; *(uint64_t*)0x200000000620 = 0; *(uint32_t*)0x200000000628 = 0; *(uint32_t*)0x20000000062c = 0; *(uint32_t*)0x200000000630 = 0; *(uint32_t*)0x200000000634 = 0; *(uint64_t*)0x200000000638 = 0; *(uint64_t*)0x200000000640 = 0; *(uint32_t*)0x200000000648 = 0x10; *(uint32_t*)0x20000000064c = 0x8000; *(uint32_t*)0x200000000650 = 0; syscall(__NR_bpf, /*cmd=*/5ul, /*arg=*/0x2000000005c0ul, /*size=*/0x94ul); return 0; }