| // KASAN: slab-out-of-bounds Read in ipt_init_target |
| // https://syzkaller.appspot.com/bug?id=bf1d98882a783b449bb42e9af6720e4f1b37919d |
| // status:open |
| // autogenerated by syzkaller (https://github.com/google/syzkaller) |
| |
| #define _GNU_SOURCE |
| |
| #include <endian.h> |
| #include <stdint.h> |
| #include <stdio.h> |
| #include <stdlib.h> |
| #include <string.h> |
| #include <sys/syscall.h> |
| #include <sys/types.h> |
| #include <unistd.h> |
| |
| #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, 0x20000000ul, 0x1000000ul, 3ul, 0x32ul, -1, 0); |
| intptr_t res = 0; |
| res = syscall(__NR_socket, 0x10ul, 3ul, 0ul); |
| if (res != -1) |
| r[0] = res; |
| *(uint64_t*)0x20000300 = 0; |
| *(uint32_t*)0x20000308 = 0; |
| *(uint64_t*)0x20000310 = 0x200002c0; |
| *(uint64_t*)0x200002c0 = 0x20000680; |
| *(uint32_t*)0x20000680 = 0x10c; |
| *(uint16_t*)0x20000684 = 0x30; |
| *(uint16_t*)0x20000686 = 0xfa3d; |
| *(uint32_t*)0x20000688 = 0; |
| *(uint32_t*)0x2000068c = 0; |
| *(uint8_t*)0x20000690 = 0; |
| *(uint8_t*)0x20000691 = 0; |
| *(uint16_t*)0x20000692 = 0; |
| *(uint16_t*)0x20000694 = 0xf8; |
| *(uint16_t*)0x20000696 = 1; |
| *(uint16_t*)0x20000698 = 0xf4; |
| STORE_BY_BITMASK(uint16_t, , 0x2000069a, 1, 0, 14); |
| STORE_BY_BITMASK(uint16_t, , 0x2000069b, 0, 6, 1); |
| STORE_BY_BITMASK(uint16_t, , 0x2000069b, 0, 7, 1); |
| *(uint16_t*)0x2000069c = 7; |
| *(uint16_t*)0x2000069e = 1; |
| memcpy((void*)0x200006a0, "xt\000", 3); |
| *(uint16_t*)0x200006a4 = 0xe4; |
| STORE_BY_BITMASK(uint16_t, , 0x200006a6, 2, 0, 14); |
| STORE_BY_BITMASK(uint16_t, , 0x200006a7, 0, 6, 1); |
| STORE_BY_BITMASK(uint16_t, , 0x200006a7, 1, 7, 1); |
| *(uint16_t*)0x200006a8 = 0x2a; |
| *(uint16_t*)0x200006aa = 6; |
| *(uint16_t*)0x200006ac = 0x81ca; |
| memcpy((void*)0x200006ae, "security\000\000\000\000\000\000\000\000\000\000" |
| "\000\000\000\000\000\000\000\000\000\000\000\000" |
| "\000\000", |
| 32); |
| *(uint8_t*)0x200006ce = 0x36; |
| *(uint16_t*)0x200006d0 = 4; |
| *(uint16_t*)0x200006d4 = 8; |
| *(uint16_t*)0x200006d6 = 3; |
| *(uint32_t*)0x200006d8 = 5; |
| *(uint16_t*)0x200006dc = 8; |
| *(uint16_t*)0x200006de = 2; |
| *(uint32_t*)0x200006e0 = 1; |
| *(uint16_t*)0x200006e4 = 8; |
| *(uint16_t*)0x200006e6 = 2; |
| *(uint32_t*)0x200006e8 = 0; |
| *(uint16_t*)0x200006ec = 8; |
| *(uint16_t*)0x200006ee = 3; |
| *(uint32_t*)0x200006f0 = 4; |
| *(uint16_t*)0x200006f4 = 0x2a; |
| *(uint16_t*)0x200006f6 = 6; |
| *(uint16_t*)0x200006f8 = 0x1f; |
| memcpy((void*)0x200006fa, "filter\000\000\000\000\000\000\000\000\000\000\000" |
| "\000\000\000\000\000\000\000\000\000\000\000\000" |
| "\000\000\000", |
| 32); |
| *(uint8_t*)0x2000071a = 6; |
| *(uint16_t*)0x2000071c = 0x7fff; |
| *(uint16_t*)0x20000720 = 0x2a; |
| *(uint16_t*)0x20000722 = 6; |
| *(uint16_t*)0x20000724 = 0x1ff; |
| memcpy((void*)0x20000726, "raw\000\000\000\000\000\000\000\000\000\000\000" |
| "\000\000\000\000\000\000\000\000\000\000\000\000" |
| "\000\000\000\000\000\000", |
| 32); |
| *(uint8_t*)0x20000746 = 2; |
| *(uint16_t*)0x20000748 = 0; |
| *(uint16_t*)0x2000074c = 8; |
| *(uint16_t*)0x2000074e = 2; |
| *(uint32_t*)0x20000750 = 0; |
| *(uint16_t*)0x20000754 = 8; |
| *(uint16_t*)0x20000756 = 3; |
| *(uint32_t*)0x20000758 = 0xd0; |
| *(uint16_t*)0x2000075c = 0x2a; |
| *(uint16_t*)0x2000075e = 6; |
| *(uint16_t*)0x20000760 = 4; |
| memcpy((void*)0x20000762, "filter\000\000\000\000\000\000\000\000\000\000\000" |
| "\000\000\000\000\000\000\000\000\000\000\000\000" |
| "\000\000\000", |
| 32); |
| *(uint8_t*)0x20000782 = 3; |
| *(uint16_t*)0x20000784 = 0; |
| *(uint16_t*)0x20000788 = 4; |
| *(uint16_t*)0x2000078a = 6; |
| *(uint64_t*)0x200002c8 = 0x10c; |
| *(uint64_t*)0x20000318 = 1; |
| *(uint64_t*)0x20000320 = 0; |
| *(uint64_t*)0x20000328 = 0; |
| *(uint32_t*)0x20000330 = 0; |
| syscall(__NR_sendmsg, r[0], 0x20000300ul, 0ul); |
| return 0; |
| } |