blob: 9afce7b512c049a567a541bce3ed34946060b193 [file] [log] [blame]
// BUG: corrupted list in nft_obj_del
// https://syzkaller.appspot.com/bug?id=ba1aecb13c60bd02d7370dd3c7c2ff4777f61407
// 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*)0x20000280 = 0;
*(uint32_t*)0x20000288 = 8;
*(uint64_t*)0x20000290 = 0x20000240;
*(uint64_t*)0x20000240 = 0x20000100;
memcpy((void*)0x20000100,
"\x14\x00\x00\x00\x10\x00\x00\x00\x1e\x6c\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x0a\x20\x00\x00\x00\x00\x0a\x01\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x09\x00\x01\x00\x73\x79\x7a\x30\x00\x00\x00"
"\x00\x38\x00\x00\x00\x12\x0a\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x04\x00\x04\x80\x09\x00\x02\x00\x00\x39\x7d\x00\x00"
"\x00\x00\x00\x09\x00\x01\x00\x73\x79\x7a\x30\x00\x00\x00\x00\x08\x00"
"\x03\x40\x00\x00\x00\x01\x14\x00\x00\x00\x11\x00\xdf\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x0a",
128);
*(uint64_t*)0x20000248 = 0x80;
*(uint64_t*)0x20000298 = 1;
*(uint64_t*)0x200002a0 = 0;
*(uint64_t*)0x200002a8 = 0;
*(uint32_t*)0x200002b0 = 0;
syscall(__NR_sendmsg, r[0], 0x20000280ul, 0ul);
res = syscall(__NR_socket, 0x10ul, 3ul, 0xcul);
if (res != -1)
r[1] = res;
*(uint64_t*)0x20000140 = 0;
*(uint32_t*)0x20000148 = 0;
*(uint64_t*)0x20000150 = 0x20000100;
*(uint64_t*)0x20000100 = 0x20000040;
*(uint32_t*)0x20000040 = 0x14;
*(uint16_t*)0x20000044 = 0x10;
*(uint16_t*)0x20000046 = 1;
*(uint32_t*)0x20000048 = 0;
*(uint32_t*)0x2000004c = 0;
*(uint8_t*)0x20000050 = 0;
*(uint8_t*)0x20000051 = 0;
*(uint16_t*)0x20000052 = htobe16(0xa);
*(uint32_t*)0x20000054 = 0x34;
*(uint8_t*)0x20000058 = 0x14;
*(uint8_t*)0x20000059 = 0xa;
*(uint16_t*)0x2000005a = 3;
*(uint32_t*)0x2000005c = 0;
*(uint32_t*)0x20000060 = 0;
*(uint8_t*)0x20000064 = 0;
*(uint8_t*)0x20000065 = 0;
*(uint16_t*)0x20000066 = htobe16(2);
*(uint16_t*)0x20000068 = 8;
STORE_BY_BITMASK(uint16_t, , 0x2000006a, 3, 0, 14);
STORE_BY_BITMASK(uint16_t, , 0x2000006b, 1, 6, 1);
STORE_BY_BITMASK(uint16_t, , 0x2000006b, 0, 7, 1);
*(uint32_t*)0x2000006c = htobe32(1);
*(uint16_t*)0x20000070 = 9;
*(uint16_t*)0x20000072 = 1;
memcpy((void*)0x20000074, "syz0\000", 5);
*(uint16_t*)0x2000007c = 0xc;
STORE_BY_BITMASK(uint16_t, , 0x2000007e, 6, 0, 14);
STORE_BY_BITMASK(uint16_t, , 0x2000007f, 1, 6, 1);
STORE_BY_BITMASK(uint16_t, , 0x2000007f, 0, 7, 1);
*(uint64_t*)0x20000080 = htobe64(1);
*(uint32_t*)0x20000088 = 0x58;
*(uint8_t*)0x2000008c = 2;
*(uint8_t*)0x2000008d = 0xa;
*(uint16_t*)0x2000008e = 0x603;
*(uint32_t*)0x20000090 = 0;
*(uint32_t*)0x20000094 = 0;
*(uint8_t*)0x20000098 = 0;
*(uint8_t*)0x20000099 = 0;
*(uint16_t*)0x2000009a = htobe16(6);
*(uint16_t*)0x2000009c = 9;
*(uint16_t*)0x2000009e = 1;
memcpy((void*)0x200000a0, "syz1\000", 5);
*(uint16_t*)0x200000a8 = 8;
STORE_BY_BITMASK(uint16_t, , 0x200000aa, 2, 0, 14);
STORE_BY_BITMASK(uint16_t, , 0x200000ab, 1, 6, 1);
STORE_BY_BITMASK(uint16_t, , 0x200000ab, 0, 7, 1);
*(uint32_t*)0x200000ac = htobe32(1);
*(uint16_t*)0x200000b0 = 9;
*(uint16_t*)0x200000b2 = 1;
memcpy((void*)0x200000b4, "syz0\000", 5);
*(uint16_t*)0x200000bc = 9;
*(uint16_t*)0x200000be = 1;
memcpy((void*)0x200000c0, "syz1\000", 5);
*(uint16_t*)0x200000c8 = 0xc;
STORE_BY_BITMASK(uint16_t, , 0x200000ca, 4, 0, 14);
STORE_BY_BITMASK(uint16_t, , 0x200000cb, 1, 6, 1);
STORE_BY_BITMASK(uint16_t, , 0x200000cb, 0, 7, 1);
*(uint64_t*)0x200000cc = htobe64(3);
*(uint16_t*)0x200000d4 = 9;
*(uint16_t*)0x200000d6 = 1;
memcpy((void*)0x200000d8, "syz0\000", 5);
*(uint32_t*)0x200000e0 = 0x14;
*(uint16_t*)0x200000e4 = 0x11;
*(uint16_t*)0x200000e6 = 1;
*(uint32_t*)0x200000e8 = 0;
*(uint32_t*)0x200000ec = 0;
*(uint8_t*)0x200000f0 = 0;
*(uint8_t*)0x200000f1 = 0;
*(uint16_t*)0x200000f2 = htobe16(0xa);
*(uint64_t*)0x20000108 = 0xb4;
*(uint64_t*)0x20000158 = 1;
*(uint64_t*)0x20000160 = 0;
*(uint64_t*)0x20000168 = 0;
*(uint32_t*)0x20000170 = 0x4000004;
syscall(__NR_sendmsg, r[1], 0x20000140ul, 0x42000ul);
return 0;
}