// https://syzkaller.appspot.com/bug?id=1163cf8b96699285da33559ca268ef1edcffd104 // 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(long a0, long a1, 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 { char buf[1024]; char* hash; strncpy(buf, (char*)a0, sizeof(buf) - 1); buf[sizeof(buf) - 1] = 0; while ((hash = strchr(buf, '#'))) { *hash = '0' + (char)(a1 % 10); a1 /= 10; } return open(buf, a2, 0); } } #ifndef __NR_bpf #define __NR_bpf 321 #endif uint64_t r[3] = {0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff}; int main(void) { syscall(__NR_mmap, 0x20000000, 0x1000000, 3, 0x32, -1, 0); long res = 0; res = syscall(__NR_socket, 0x2b, 1, 0); if (res != -1) r[0] = res; syscall(__NR_ioctl, r[0], 0x8912, 0x400200); *(uint32_t*)0x20000100 = 0x16; *(uint32_t*)0x20000104 = 0; *(uint32_t*)0x20000108 = 0x40002; *(uint32_t*)0x2000010c = -1; *(uint32_t*)0x20000110 = 0; *(uint32_t*)0x20000114 = 1; *(uint32_t*)0x20000118 = 0; *(uint8_t*)0x2000011c = 0; *(uint8_t*)0x2000011d = 0; *(uint8_t*)0x2000011e = 0; *(uint8_t*)0x2000011f = 0; *(uint8_t*)0x20000120 = 0; *(uint8_t*)0x20000121 = 0; *(uint8_t*)0x20000122 = 0; *(uint8_t*)0x20000123 = 0; *(uint8_t*)0x20000124 = 0; *(uint8_t*)0x20000125 = 0; *(uint8_t*)0x20000126 = 0; *(uint8_t*)0x20000127 = 0; *(uint8_t*)0x20000128 = 0; *(uint8_t*)0x20000129 = 0; *(uint8_t*)0x2000012a = 0; *(uint8_t*)0x2000012b = 0; res = syscall(__NR_bpf, 0, 0x20000100, 0x2c); if (res != -1) r[1] = res; *(uint32_t*)0x20000040 = r[1]; *(uint64_t*)0x20000048 = 0; *(uint64_t*)0x20000050 = 0x20000000; *(uint64_t*)0x20000058 = 2; syscall(__NR_bpf, 2, 0x20000040, 0x20); syscall(__NR_bpf, 7, 0, 0); syscall(__NR_perf_event_open, 0, 0, -1, -1, 0); syscall(__NR_openat, 0xffffffffffffff9c, 0, 0x4002, 0); syscall(__NR_getsockopt, -1, 1, 0x11, 0, 0); syscall(__NR_io_destroy, 0); syscall(__NR_ioctl, -1, 0x4c00, -1); syscall(__NR_io_setup, 4, 0); syscall(__NR_ioctl, -1, 0xc0285629, 0); syscall(__NR_ioctl, -1, 0x4c01); syscall(__NR_ioctl, -1, 0x8018456f, 0); syscall(__NR_setsockopt, -1, 6, 1, 0, 0); syscall(__NR_ioctl, -1, 0x4b40, 0); syscall(__NR_connect, -1, 0, 0); syscall(__NR_ioctl, -1, 0xc0205649, 0); syscall(__NR_ioctl, -1, 0x8912, 0x400200); syscall(__NR_bpf, 2, 0, 0); syscall(__NR_bind, -1, 0, 0); syscall(__NR_getsockopt, -1, 1, 0x11, 0, 0); res = syz_open_dev(0, 3, 0x182); if (res != -1) r[2] = res; syscall(__NR_clock_gettime, 0, 0); syscall(__NR_io_setup, 4, 0); syscall(__NR_io_destroy, 0); syscall(__NR_add_key, 0, 0, 0, 0, 0xfffffffb); syscall(__NR_ioctl, r[2], 0x4c00, -1); syscall(__NR_setsockopt, -1, 6, 1, 0, 0); syscall(__NR_ioctl, -1, 0x4b40, 0); syscall(__NR_mmap, 0x20004000, 0x4000, 0, 0x6012, -1, 0x2000); return 0; }