// https://syzkaller.appspot.com/bug?id=f05f0a51882a32fe0599a03221cb560729e0a703 // autogenerated by syzkaller (http://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include static uintptr_t syz_open_dev(uintptr_t a0, uintptr_t a1, uintptr_t 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); } } static void execute_one(); extern unsigned long long procid; void loop() { while (1) { execute_one(); } } uint64_t r[1] = {0xffffffffffffffff}; unsigned long long procid; void execute_one() { long res = 0; memcpy((void*)0x20000100, "/dev/binder#", 13); res = syz_open_dev(0x20000100, 0, 0); if (res != -1) r[0] = res; syscall(__NR_mmap, 0x20001000, 0x3000, 0, 0x20011, r[0], 0); syscall(__NR_ioctl, r[0], 0x40046207, 0); *(uint8_t*)0x20000500 = 0xfe; *(uint8_t*)0x20000501 = 0x80; *(uint8_t*)0x20000502 = 0; *(uint8_t*)0x20000503 = 0; *(uint8_t*)0x20000504 = 0; *(uint8_t*)0x20000505 = 0; *(uint8_t*)0x20000506 = 0; *(uint8_t*)0x20000507 = 0; *(uint8_t*)0x20000508 = 0; *(uint8_t*)0x20000509 = 0; *(uint8_t*)0x2000050a = 0; *(uint8_t*)0x2000050b = 0; *(uint8_t*)0x2000050c = 0; *(uint8_t*)0x2000050d = 0; *(uint8_t*)0x2000050e = 0; *(uint8_t*)0x2000050f = 0xbb; *(uint32_t*)0x20000510 = 0; *(uint32_t*)0x20000514 = 0; syscall(__NR_ioctl, -1, 0x8936, 0x20000500); } int main() { syscall(__NR_mmap, 0x20000000, 0x1000000, 3, 0x32, -1, 0); for (procid = 0; procid < 8; procid++) { if (fork() == 0) { for (;;) { loop(); } } } sleep(1000000); return 0; }