| // general protection fault in nft_tunnel_get_init |
| // https://syzkaller.appspot.com/bug?id=227e4f089706f1eebc06b17a04815d2a44a4b50f |
| // 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[2] = {0xffffffffffffffff, 0xffffffffffffffff}; |
| |
| int main(void) |
| { |
| syscall(__NR_mmap, 0x20000000ul, 0x1000000ul, 3ul, 0x32ul, -1, 0); |
| intptr_t res = 0; |
| res = syscall(__NR_socket, 0x10ul, 3ul, 0xcul); |
| if (res != -1) |
| r[0] = res; |
| *(uint64_t*)0x20000200 = 0; |
| *(uint32_t*)0x20000208 = 0; |
| *(uint64_t*)0x20000210 = 0x20000180; |
| *(uint64_t*)0x20000180 = 0x200009c0; |
| *(uint32_t*)0x200009c0 = 0x14; |
| *(uint16_t*)0x200009c4 = 0x10; |
| *(uint16_t*)0x200009c6 = 1; |
| *(uint32_t*)0x200009c8 = 0; |
| *(uint32_t*)0x200009cc = 0; |
| *(uint8_t*)0x200009d0 = 0; |
| *(uint8_t*)0x200009d1 = 0; |
| *(uint16_t*)0x200009d2 = htobe16(0xa); |
| *(uint32_t*)0x200009d4 = 0x28; |
| *(uint8_t*)0x200009d8 = 0; |
| *(uint8_t*)0x200009d9 = 0xa; |
| *(uint16_t*)0x200009da = 1; |
| *(uint32_t*)0x200009dc = 0; |
| *(uint32_t*)0x200009e0 = 0; |
| *(uint8_t*)0x200009e4 = 0; |
| *(uint8_t*)0x200009e5 = 0; |
| *(uint16_t*)0x200009e6 = htobe16(0); |
| *(uint16_t*)0x200009e8 = 9; |
| *(uint16_t*)0x200009ea = 1; |
| memcpy((void*)0x200009ec, "syz0\000", 5); |
| *(uint16_t*)0x200009f4 = 8; |
| STORE_BY_BITMASK(uint16_t, , 0x200009f6, 2, 0, 14); |
| STORE_BY_BITMASK(uint16_t, , 0x200009f7, 1, 6, 1); |
| STORE_BY_BITMASK(uint16_t, , 0x200009f7, 0, 7, 1); |
| *(uint32_t*)0x200009f8 = htobe32(1); |
| *(uint32_t*)0x200009fc = 0x14; |
| *(uint16_t*)0x20000a00 = 0x11; |
| *(uint16_t*)0x20000a02 = 3; |
| *(uint32_t*)0x20000a04 = 0; |
| *(uint32_t*)0x20000a08 = 0; |
| *(uint8_t*)0x20000a0c = 0; |
| *(uint8_t*)0x20000a0d = 0; |
| *(uint16_t*)0x20000a0e = htobe16(0xa); |
| *(uint64_t*)0x20000188 = 0x50; |
| *(uint64_t*)0x20000218 = 1; |
| *(uint64_t*)0x20000220 = 0; |
| *(uint64_t*)0x20000228 = 0; |
| *(uint32_t*)0x20000230 = 0; |
| syscall(__NR_sendmsg, r[0], 0x20000200ul, 0ul); |
| *(uint64_t*)0x20000140 = 0; |
| *(uint32_t*)0x20000148 = 0; |
| *(uint64_t*)0x20000150 = 0x20000040; |
| *(uint64_t*)0x20000040 = 0x20000080; |
| memcpy((void*)0x20000080, |
| "\x14\x00\x00\x00\x10\x00\x01\x00\x20\x00\x00\x00\x00\x00\x00\x00\x00" |
| "\x00\x00\x0a\x2c\x00\x00\x00\x03\x0a\x5b\xa6\x00\x00\x00\x00\x00\x00" |
| "\x00\x00\x00\x00\x00\x00\x09\x00\x01\x00\x73\x79\x7a\x30\x00\x00\x00" |
| "\x00\x09\x00\x03\x00\x73\x79\x7a\x30\x00\x00\x00\x00\x14\x00\x00\x00" |
| "\x11\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0a", |
| 84); |
| *(uint64_t*)0x20000048 = 0x54; |
| *(uint64_t*)0x20000158 = 1; |
| *(uint64_t*)0x20000160 = 0; |
| *(uint64_t*)0x20000168 = 0; |
| *(uint32_t*)0x20000170 = 0; |
| syscall(__NR_sendmsg, r[0], 0x20000140ul, 0ul); |
| res = syscall(__NR_socket, 0x10ul, 3ul, 0xcul); |
| if (res != -1) |
| r[1] = res; |
| *(uint64_t*)0x20000240 = 0; |
| *(uint32_t*)0x20000248 = 0; |
| *(uint64_t*)0x20000250 = 0x20000200; |
| *(uint64_t*)0x20000200 = 0x20000140; |
| *(uint32_t*)0x20000140 = 0x14; |
| *(uint16_t*)0x20000144 = 0x10; |
| *(uint16_t*)0x20000146 = 1; |
| *(uint32_t*)0x20000148 = 0; |
| *(uint32_t*)0x2000014c = 0; |
| *(uint8_t*)0x20000150 = 0; |
| *(uint8_t*)0x20000151 = 0; |
| *(uint16_t*)0x20000152 = htobe16(0xa); |
| *(uint32_t*)0x20000154 = 0x58; |
| *(uint8_t*)0x20000158 = 6; |
| *(uint8_t*)0x20000159 = 0xa; |
| *(uint16_t*)0x2000015a = 0x401; |
| *(uint32_t*)0x2000015c = 0; |
| *(uint32_t*)0x20000160 = 0; |
| *(uint8_t*)0x20000164 = 0; |
| *(uint8_t*)0x20000165 = 0; |
| *(uint16_t*)0x20000166 = htobe16(0); |
| *(uint16_t*)0x20000168 = 9; |
| *(uint16_t*)0x2000016a = 2; |
| memcpy((void*)0x2000016c, "syz0\000", 5); |
| *(uint16_t*)0x20000174 = 9; |
| *(uint16_t*)0x20000176 = 1; |
| memcpy((void*)0x20000178, "syz0\000", 5); |
| *(uint16_t*)0x20000180 = 0x2c; |
| STORE_BY_BITMASK(uint16_t, , 0x20000182, 4, 0, 14); |
| STORE_BY_BITMASK(uint16_t, , 0x20000183, 0, 6, 1); |
| STORE_BY_BITMASK(uint16_t, , 0x20000183, 1, 7, 1); |
| *(uint16_t*)0x20000184 = 0x28; |
| STORE_BY_BITMASK(uint16_t, , 0x20000186, 1, 0, 14); |
| STORE_BY_BITMASK(uint16_t, , 0x20000187, 0, 6, 1); |
| STORE_BY_BITMASK(uint16_t, , 0x20000187, 1, 7, 1); |
| *(uint16_t*)0x20000188 = 0xb; |
| *(uint16_t*)0x2000018a = 1; |
| memcpy((void*)0x2000018c, "socket\000", 7); |
| *(uint16_t*)0x20000194 = 0xc; |
| STORE_BY_BITMASK(uint16_t, , 0x20000196, 2, 0, 14); |
| STORE_BY_BITMASK(uint16_t, , 0x20000197, 0, 6, 1); |
| STORE_BY_BITMASK(uint16_t, , 0x20000197, 1, 7, 1); |
| *(uint16_t*)0x20000198 = 8; |
| STORE_BY_BITMASK(uint16_t, , 0x2000019a, 2, 0, 14); |
| STORE_BY_BITMASK(uint16_t, , 0x2000019b, 1, 6, 1); |
| STORE_BY_BITMASK(uint16_t, , 0x2000019b, 0, 7, 1); |
| *(uint32_t*)0x2000019c = htobe32(0xa); |
| *(uint16_t*)0x200001a0 = 0xb; |
| *(uint16_t*)0x200001a2 = 1; |
| memcpy((void*)0x200001a4, "tunnel\000", 7); |
| *(uint32_t*)0x200001ac = 0x14; |
| *(uint16_t*)0x200001b0 = 0x11; |
| *(uint16_t*)0x200001b2 = 1; |
| *(uint32_t*)0x200001b4 = 0; |
| *(uint32_t*)0x200001b8 = 0; |
| *(uint8_t*)0x200001bc = 0; |
| *(uint8_t*)0x200001bd = 0; |
| *(uint16_t*)0x200001be = htobe16(0xa); |
| *(uint64_t*)0x20000208 = 0x80; |
| *(uint64_t*)0x20000258 = 1; |
| *(uint64_t*)0x20000260 = 0; |
| *(uint64_t*)0x20000268 = 0; |
| *(uint32_t*)0x20000270 = 0; |
| syscall(__NR_sendmsg, r[1], 0x20000240ul, 0ul); |
| return 0; |
| } |