| // general protection fault in refcount_sub_and_test |
| // https://syzkaller.appspot.com/bug?id=01b492b33678ff55be2662197c845a8db5e6b148 |
| // status:open |
| // autogenerated by syzkaller (https://github.com/google/syzkaller) |
| |
| #define _GNU_SOURCE |
| |
| #include <endian.h> |
| #include <fcntl.h> |
| #include <stdint.h> |
| #include <stdio.h> |
| #include <stdlib.h> |
| #include <string.h> |
| #include <sys/stat.h> |
| #include <sys/syscall.h> |
| #include <sys/types.h> |
| #include <unistd.h> |
| |
| static long syz_open_dev(volatile long a0, volatile long a1, volatile 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); |
| } |
| } |
| |
| uint64_t r[1] = {0xffffffffffffffff}; |
| |
| int main(void) |
| { |
| syscall(__NR_mmap, 0x20000000, 0x1000000, 3, 0x32, -1, 0); |
| long res = 0; |
| memcpy((void*)0x20000240, "/dev/swradio#\000", 14); |
| res = syz_open_dev(0x20000240, 0, 2); |
| if (res != -1) |
| r[0] = res; |
| *(uint32_t*)0x20000080 = 0; |
| *(uint32_t*)0x20000084 = 9; |
| *(uint32_t*)0x20000088 = 1; |
| *(uint32_t*)0x20000090 = 0xb; |
| *(uint32_t*)0x20000098 = 0; |
| *(uint32_t*)0x2000009c = 0xffff; |
| *(uint32_t*)0x200000a0 = 0; |
| *(uint32_t*)0x200000a4 = 0; |
| *(uint32_t*)0x200000a8 = 0; |
| *(uint32_t*)0x200000ac = 0; |
| *(uint64_t*)0x200000b0 = 0; |
| *(uint32_t*)0x200000b8 = 0; |
| *(uint64_t*)0x200000c0 = 0; |
| *(uint8_t*)0x200000c8 = 0; |
| *(uint32_t*)0x20000160 = 0; |
| *(uint32_t*)0x20000164 = 0; |
| *(uint32_t*)0x20000168 = 0; |
| *(uint32_t*)0x2000016c = 0; |
| *(uint32_t*)0x20000170 = 0; |
| *(uint32_t*)0x20000174 = 0; |
| *(uint32_t*)0x20000178 = 0; |
| *(uint32_t*)0x2000017c = 0; |
| syscall(__NR_ioctl, r[0], 0xc100565c, 0x20000080); |
| *(uint32_t*)0x20001280 = 0; |
| *(uint32_t*)0x20001284 = 0x1ff; |
| *(uint32_t*)0x20001288 = 2; |
| *(uint32_t*)0x20001290 = 0xb; |
| *(uint32_t*)0x20001298 = 0; |
| *(uint32_t*)0x2000129c = 9; |
| *(uint32_t*)0x200012a0 = 0; |
| *(uint32_t*)0x200012a4 = 0; |
| *(uint32_t*)0x200012a8 = 0; |
| *(uint32_t*)0x200012ac = 0; |
| *(uint64_t*)0x200012b0 = 0; |
| *(uint32_t*)0x200012b8 = 0; |
| *(uint64_t*)0x200012c0 = 0; |
| *(uint8_t*)0x200012c8 = 0; |
| *(uint32_t*)0x20001360 = 0; |
| *(uint32_t*)0x20001364 = 0; |
| *(uint32_t*)0x20001368 = 0; |
| *(uint32_t*)0x2000136c = 0; |
| *(uint32_t*)0x20001370 = 0; |
| *(uint32_t*)0x20001374 = 0; |
| *(uint32_t*)0x20001378 = 0; |
| *(uint32_t*)0x2000137c = 0; |
| syscall(__NR_ioctl, r[0], 0xc100565c, 0x20001280); |
| return 0; |
| } |