// https://syzkaller.appspot.com/bug?id=df9f178c21f9bad386dc070c4207dca7f52d12f1 // autogenerated by syzkaller (https://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include static void sleep_ms(uint64_t ms) { usleep(ms * 1000); } static uint64_t current_time_ms(void) { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts)) exit(1); return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; } #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)))) struct csum_inet { uint32_t acc; }; static void csum_inet_init(struct csum_inet* csum) { csum->acc = 0; } static void csum_inet_update(struct csum_inet* csum, const uint8_t* data, size_t length) { if (length == 0) return; size_t i = 0; for (; i < length - 1; i += 2) csum->acc += *(uint16_t*)&data[i]; if (length & 1) csum->acc += le16toh((uint16_t)data[length - 1]); while (csum->acc > 0xffff) csum->acc = (csum->acc & 0xffff) + (csum->acc >> 16); } static uint16_t csum_inet_digest(struct csum_inet* csum) { return ~csum->acc; } static bool write_file(const char* file, const char* what, ...) { char buf[1024]; va_list args; va_start(args, what); vsnprintf(buf, sizeof(buf), what, args); va_end(args); buf[sizeof(buf) - 1] = 0; int len = strlen(buf); int fd = open(file, O_WRONLY | O_CLOEXEC); if (fd == -1) return false; if (write(fd, buf, len) != len) { int err = errno; close(fd); errno = err; return false; } close(fd); return true; } static void kill_and_wait(int pid, int* status) { kill(-pid, SIGKILL); kill(pid, SIGKILL); for (int i = 0; i < 100; i++) { if (waitpid(-1, status, WNOHANG | __WALL) == pid) return; usleep(1000); } DIR* dir = opendir("/sys/fs/fuse/connections"); if (dir) { for (;;) { struct dirent* ent = readdir(dir); if (!ent) break; if (strcmp(ent->d_name, ".") == 0 || strcmp(ent->d_name, "..") == 0) continue; char abort[300]; snprintf(abort, sizeof(abort), "/sys/fs/fuse/connections/%s/abort", ent->d_name); int fd = open(abort, O_WRONLY); if (fd == -1) { continue; } if (write(fd, abort, 1) < 0) { } close(fd); } closedir(dir); } else { } while (waitpid(-1, status, __WALL) != pid) { } } static void setup_test() { prctl(PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0); setpgrp(); write_file("/proc/self/oom_score_adj", "1000"); } static void execute_one(void); #define WAIT_FLAGS __WALL static void loop(void) { int iter = 0; for (;; iter++) { int pid = fork(); if (pid < 0) exit(1); if (pid == 0) { setup_test(); execute_one(); exit(0); } int status = 0; uint64_t start = current_time_ms(); for (;;) { sleep_ms(10); if (waitpid(-1, &status, WNOHANG | WAIT_FLAGS) == pid) break; if (current_time_ms() - start < 5000) continue; kill_and_wait(pid, &status); break; } } } uint64_t r[5] = {0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x0}; void execute_one(void) { intptr_t res = 0; if (write(1, "executing program\n", sizeof("executing program\n") - 1)) { } // openat$tun arguments: [ // fd: const = 0xffffffffffffff9c (8 bytes) // file: ptr[in, buffer] { // buffer: {2f 64 65 76 2f 6e 65 74 2f 74 75 6e 00} (length 0xd) // } // flags: open_flags = 0x48241 (4 bytes) // mode: const = 0x0 (2 bytes) // ] // returns fd_tun memcpy((void*)0x200000000040, "/dev/net/tun\000", 13); res = syscall( __NR_openat, /*fd=*/0xffffffffffffff9cul, /*file=*/0x200000000040ul, /*flags=O_TRUNC|O_NOATIME|O_LARGEFILE|O_CREAT|O_WRONLY*/ 0x48241, /*mode=*/0); if (res != -1) r[0] = res; // ioctl$TUNSETIFF arguments: [ // fd: fd_tun (resource) // cmd: const = 0x400454ca (4 bytes) // arg: ptr[in, ifreq_dev_t[devnames, flags[tun_setiff_flags, int16]]] { // ifreq_dev_t[devnames, flags[tun_setiff_flags, int16]] { // ifr_ifrn: buffer: {73 79 7a 6b 61 6c 6c 65 72 31 00 00 00 00 00 00} // (length 0x10) elem: tun_setiff_flags = 0x6bf1c2d5adba8c32 (2 bytes) // pad = 0x0 (22 bytes) // } // } // ] memcpy((void*)0x200000000080, "syzkaller1\000\000\000\000\000\000", 16); *(uint16_t*)0x200000000090 = 0x8c32; syscall(__NR_ioctl, /*fd=*/r[0], /*cmd=*/0x400454ca, /*arg=*/0x200000000080ul); // socket$kcm arguments: [ // domain: const = 0x2 (8 bytes) // type: kcm_socket_type = 0xa (8 bytes) // proto: const = 0x2 (4 bytes) // ] // returns sock_kcm res = syscall(__NR_socket, /*domain=*/2ul, /*type=SOCK_DGRAM|0x8*/ 0xaul, /*proto=*/2); if (res != -1) r[1] = res; // ioctl$SIOCSIFHWADDR arguments: [ // fd: fd_tun (resource) // cmd: const = 0x8914 (4 bytes) // arg: ptr[in, ifreq_dev_t[devnames, mac_addr]] { // ifreq_dev_t[devnames, mac_addr] { // ifr_ifrn: buffer: {73 79 7a 6b 61 6c 6c 65 72 31 00 00 00 00 00 00} // (length 0x10) elem: union mac_addr { // link_local: mac_addr_link_local { // a0: const = 0x1 (1 bytes) // a1: const = 0x80 (1 bytes) // a2: const = 0xc2 (1 bytes) // a3: const = 0x0 (1 bytes) // a4: const = 0x0 (1 bytes) // a5: mac_addr_link_local_values = 0x0 (1 bytes) // } // } // pad = 0x0 (18 bytes) // } // } // ] memcpy((void*)0x2000000000c0, "syzkaller1\000\000\000\000\000\000", 16); *(uint8_t*)0x2000000000d0 = 1; *(uint8_t*)0x2000000000d1 = 0x80; *(uint8_t*)0x2000000000d2 = 0xc2; *(uint8_t*)0x2000000000d3 = 0; *(uint8_t*)0x2000000000d4 = 0; *(uint8_t*)0x2000000000d5 = 0; syscall(__NR_ioctl, /*fd=*/r[1], /*cmd=*/0x8914, /*arg=*/0x2000000000c0ul); // socket$nl_route arguments: [ // domain: const = 0x10 (8 bytes) // type: const = 0x3 (8 bytes) // proto: const = 0x0 (4 bytes) // ] // returns sock_nl_route res = syscall(__NR_socket, /*domain=*/0x10ul, /*type=*/3ul, /*proto=*/0); if (res != -1) r[2] = res; // socket$unix arguments: [ // domain: const = 0x1 (8 bytes) // type: unix_socket_type = 0x3 (8 bytes) // proto: const = 0x0 (4 bytes) // ] // returns sock_unix res = syscall(__NR_socket, /*domain=*/1ul, /*type=SOCK_DGRAM|SOCK_STREAM*/ 3ul, /*proto=*/0); if (res != -1) r[3] = res; // ioctl$sock_SIOCGIFINDEX arguments: [ // fd: sock (resource) // cmd: const = 0x8933 (4 bytes) // arg: ptr[out, ifreq_dev_t[devnames, ifindex]] { // ifreq_dev_t[devnames, ifindex] { // ifr_ifrn: buffer: {73 79 7a 6b 61 6c 6c 65 72 31 00 00 00 00 00 00} // (length 0x10) elem: ifindex (resource) pad = 0x0 (20 bytes) // } // } // ] memcpy((void*)0x200000000180, "syzkaller1\000\000\000\000\000\000", 16); res = syscall(__NR_ioctl, /*fd=*/r[3], /*cmd=*/0x8933, /*arg=*/0x200000000180ul); if (res != -1) r[4] = *(uint32_t*)0x200000000190; // sendmsg$nl_route_sched arguments: [ // fd: sock_nl_route (resource) // msg: ptr[in, msghdr_netlink[netlink_msg_route_sched]] { // msghdr_netlink[netlink_msg_route_sched] { // addr: nil // addrlen: len = 0x0 (4 bytes) // pad = 0x0 (4 bytes) // vec: ptr[in, iovec[in, netlink_msg_route_sched]] { // iovec[in, netlink_msg_route_sched] { // addr: ptr[in, netlink_msg_route_sched] { // union netlink_msg_route_sched { // newqdisc: netlink_msg_t[const[RTM_NEWQDISC, int16], // tcmsg[AF_UNSPEC], rtm_tca_policy] { // len: len = 0x30 (4 bytes) // type: const = 0x24 (2 bytes) // flags: netlink_msg_flags = 0x601 (2 bytes) // seq: int32 = 0x0 (4 bytes) // pid: int32 = 0x0 (4 bytes) // payload: tcmsg[AF_UNSPEC] { // family: const = 0x0 (1 bytes) // tcm__pad1: const = 0x0 (1 bytes) // tcm__pad2: const = 0x0 (2 bytes) // ifindex: ifindex (resource) // tcm_handle: tcm_handle { // minor: tcm_handle_offsets = 0x0 (2 bytes) // major: tcm_handle_offsets = 0x0 (2 bytes) // } // tcm_parent: tcm_handle { // minor: tcm_handle_offsets = 0xfff1 (2 bytes) // major: tcm_handle_offsets = 0xffff (2 bytes) // } // tcm_info: tcm_handle { // minor: tcm_handle_offsets = 0x0 (2 bytes) // major: tcm_handle_offsets = 0x0 (2 bytes) // } // } // attrs: array[rtm_tca_policy] { // union rtm_tca_policy { // qdisc_kind_options: union qdisc_kind_options { // q_ingress: nlattr_t[const[TCA_KIND, int16], // string["ingress"]] { // nla_len: offsetof = 0xc (2 bytes) // nla_type: const = 0x1 (2 bytes) // payload: buffer: {69 6e 67 72 65 73 73 00} (length // 0x8) size: buffer: {} (length 0x0) // } // } // } // } // } // } // } // len: len = 0x30 (8 bytes) // } // } // vlen: const = 0x1 (8 bytes) // ctrl: const = 0x0 (8 bytes) // ctrllen: const = 0x0 (8 bytes) // f: send_flags = 0x0 (4 bytes) // pad = 0x0 (4 bytes) // } // } // f: send_flags = 0x0 (8 bytes) // ] *(uint64_t*)0x2000000001c0 = 0; *(uint32_t*)0x2000000001c8 = 0; *(uint64_t*)0x2000000001d0 = 0x200000000200; *(uint64_t*)0x200000000200 = 0x200000000240; *(uint32_t*)0x200000000240 = 0x30; *(uint16_t*)0x200000000244 = 0x24; *(uint16_t*)0x200000000246 = 0x601; *(uint32_t*)0x200000000248 = 0; *(uint32_t*)0x20000000024c = 0; *(uint8_t*)0x200000000250 = 0; *(uint8_t*)0x200000000251 = 0; *(uint16_t*)0x200000000252 = 0; *(uint32_t*)0x200000000254 = r[4]; *(uint16_t*)0x200000000258 = 0; *(uint16_t*)0x20000000025a = 0; *(uint16_t*)0x20000000025c = 0xfff1; *(uint16_t*)0x20000000025e = -1; *(uint16_t*)0x200000000260 = 0; *(uint16_t*)0x200000000262 = 0; *(uint16_t*)0x200000000264 = 0xc; *(uint16_t*)0x200000000266 = 1; memcpy((void*)0x200000000268, "ingress\000", 8); *(uint64_t*)0x200000000208 = 0x30; *(uint64_t*)0x2000000001d8 = 1; *(uint64_t*)0x2000000001e0 = 0; *(uint64_t*)0x2000000001e8 = 0; *(uint32_t*)0x2000000001f0 = 0; syscall(__NR_sendmsg, /*fd=*/r[2], /*msg=*/0x2000000001c0ul, /*f=*/0ul); // sendmsg$nl_route_sched arguments: [ // fd: sock_nl_route (resource) // msg: ptr[in, msghdr_netlink[netlink_msg_route_sched]] { // msghdr_netlink[netlink_msg_route_sched] { // addr: nil // addrlen: len = 0x0 (4 bytes) // pad = 0x0 (4 bytes) // vec: ptr[in, iovec[in, netlink_msg_route_sched]] { // iovec[in, netlink_msg_route_sched] { // addr: ptr[in, netlink_msg_route_sched] { // union netlink_msg_route_sched { // newtfilter: netlink_msg_t[const[RTM_NEWTFILTER, int16], // tcmsg[AF_UNSPEC], filter_policy] { // len: len = 0x88 (4 bytes) // type: const = 0x2c (2 bytes) // flags: netlink_msg_flags = 0x601 (2 bytes) // seq: int32 = 0x0 (4 bytes) // pid: int32 = 0x0 (4 bytes) // payload: tcmsg[AF_UNSPEC] { // family: const = 0x0 (1 bytes) // tcm__pad1: const = 0x0 (1 bytes) // tcm__pad2: const = 0x0 (2 bytes) // ifindex: ifindex (resource) // tcm_handle: tcm_handle { // minor: tcm_handle_offsets = 0xb (2 bytes) // major: tcm_handle_offsets = 0x7 (2 bytes) // } // tcm_parent: tcm_handle { // minor: tcm_handle_offsets = 0xfff1 (2 bytes) // major: tcm_handle_offsets = 0xffff (2 bytes) // } // tcm_info: tcm_handle { // minor: tcm_handle_offsets = 0x300 (2 bytes) // major: tcm_handle_offsets = 0x0 (2 bytes) // } // } // attrs: array[filter_policy] { // union filter_policy { // filter_kind_options: union filter_kind_options { // f_matchall: tca_kind_options_t["matchall", // array[mall_policy]] { // TCA_KIND: nlattr_t[const[TCA_KIND, int16], // string["matchall"]] { // nla_len: offsetof = 0xd (2 bytes) // nla_type: const = 0x1 (2 bytes) // payload: buffer: {6d 61 74 63 68 61 6c 6c 00} // (length 0x9) size: buffer: {} (length 0x0) pad = // 0x0 (3 bytes) // } // TCA_OPTIONS: nlattr_t[const[TCA_OPTIONS, int16], // array[mall_policy]] { // nla_len: offsetof = 0x54 (2 bytes) // nla_type: const = 0x2 (2 bytes) // payload: array[mall_policy] { // union mall_policy { // TCA_MATCHALL_ACT: // nlattr_t[const[TCA_MATCHALL_ACT, int16], // array[tca_actions]] { // nla_len: offsetof = 0x50 (2 bytes) // nla_type: const = 0x2 (2 bytes) // payload: array[tca_actions] { // union tca_actions { // m_ct: // nlattr_tt[int16:14[0:TCA_ACT_MAX_PRIO], // 0, 0, tcf_action_policy["ct", // ct_policy]] { // nla_len: offsetof = 0x4c (2 bytes) // nla_type: int16 = 0x1 (1 bytes) // NLA_F_NET_BYTEORDER: const = 0x0 (0 // bytes) NLA_F_NESTED: const = 0x0 (1 // bytes) payload: // tcf_action_policy["ct", ct_policy] { // TCA_ACT_KIND: // nlattr_t[const[TCA_ACT_KIND, // int16], string["ct"]] { // nla_len: offsetof = 0x7 (2 // bytes) nla_type: const = 0x1 (2 // bytes) payload: buffer: {63 74 // 00} (length 0x3) size: buffer: // {} (length 0x0) pad = 0x0 (1 // bytes) // } // TCA_ACT_OPTIONS: // nlattr_tt[const[TCA_ACT_OPTIONS, // int16:14], 0, 1, array[ct_policy]] // { // nla_len: offsetof = 0x24 (2 // bytes) nla_type: const = 0x2 (1 // bytes) NLA_F_NET_BYTEORDER: // const = 0x0 (0 bytes) // NLA_F_NESTED: const = 0x1 (1 // bytes) payload: array[ct_policy] // { // union ct_policy { // TCA_CT_PARMS: // nlattr_t[const[TCA_CT_PARMS, // int16], tc_gen] { // nla_len: offsetof = 0x18 // (2 bytes) nla_type: const // = 0x1 (2 bytes) payload: // tc_gen { // index: int32 = 0x0 (4 // bytes) capab: int32 = // 0x0 (4 bytes) action: // tc_actions = 0x3 (4 // bytes) refcnt: int32 = // 0x0 (4 bytes) bindcnt: // int32 = 0x0 (4 bytes) // } // size: buffer: {} (length // 0x0) // } // } // union ct_policy { // TCA_CT_ACTION: // nlattr_t[const[TCA_CT_ACTION, // int16], // flags[tca_ct_actions, // int16]] { // nla_len: offsetof = 0x6 (2 // bytes) nla_type: const = // 0x3 (2 bytes) payload: // tca_ct_actions = 0x19 (2 // bytes) size: buffer: {} // (length 0x0) pad = 0x0 (2 // bytes) // } // } // } // size: buffer: {} (length 0x0) // } // TCA_ACT_COOKIE: // nlattr_t[const[TCA_ACT_COOKIE, // int16], array[int8]] { // nla_len: offsetof = 0x4 (2 // bytes) nla_type: const = 0x6 (2 // bytes) payload: buffer: {} // (length 0x0) size: buffer: {} // (length 0x0) // } // TCA_ACT_FLAGS: // nlattr_t[const[TCA_ACT_FLAGS, // int16], // nla_bitfield32[tcf_action_policy_flags]] // { // nla_len: offsetof = 0xc (2 // bytes) nla_type: const = 0x7 (2 // bytes) payload: // nla_bitfield32[tcf_action_policy_flags] // { // value: tcf_action_policy_flags // = 0x0 (4 bytes) selector: // tcf_action_policy_flags = 0x0 // (4 bytes) // } // size: buffer: {} (length 0x0) // } // TCA_ACT_HW_STATS: // nlattr_t[const[TCA_ACT_HW_STATS, // int16], // nla_bitfield32[tcf_action_policy_hw_stats]] // { // nla_len: offsetof = 0xc (2 // bytes) nla_type: const = 0x8 (2 // bytes) payload: // nla_bitfield32[tcf_action_policy_hw_stats] // { // value: // tcf_action_policy_hw_stats = // 0x0 (4 bytes) selector: // tcf_action_policy_hw_stats = // 0x3 (4 bytes) // } // size: buffer: {} (length 0x0) // } // } // size: buffer: {} (length 0x0) // } // } // } // size: buffer: {} (length 0x0) // } // } // } // size: buffer: {} (length 0x0) // } // } // } // } // } // } // } // } // len: len = 0x88 (8 bytes) // } // } // vlen: const = 0x1 (8 bytes) // ctrl: const = 0x0 (8 bytes) // ctrllen: const = 0x0 (8 bytes) // f: send_flags = 0x0 (4 bytes) // pad = 0x0 (4 bytes) // } // } // f: send_flags = 0x0 (8 bytes) // ] *(uint64_t*)0x200000000280 = 0; *(uint32_t*)0x200000000288 = 0; *(uint64_t*)0x200000000290 = 0x200000000300; *(uint64_t*)0x200000000300 = 0x200000000480; *(uint32_t*)0x200000000480 = 0x88; *(uint16_t*)0x200000000484 = 0x2c; *(uint16_t*)0x200000000486 = 0x601; *(uint32_t*)0x200000000488 = 0; *(uint32_t*)0x20000000048c = 0; *(uint8_t*)0x200000000490 = 0; *(uint8_t*)0x200000000491 = 0; *(uint16_t*)0x200000000492 = 0; *(uint32_t*)0x200000000494 = r[4]; *(uint16_t*)0x200000000498 = 0xb; *(uint16_t*)0x20000000049a = 7; *(uint16_t*)0x20000000049c = 0xfff1; *(uint16_t*)0x20000000049e = -1; *(uint16_t*)0x2000000004a0 = 0x300; *(uint16_t*)0x2000000004a2 = 0; *(uint16_t*)0x2000000004a4 = 0xd; *(uint16_t*)0x2000000004a6 = 1; memcpy((void*)0x2000000004a8, "matchall\000", 9); *(uint16_t*)0x2000000004b4 = 0x54; *(uint16_t*)0x2000000004b6 = 2; *(uint16_t*)0x2000000004b8 = 0x50; *(uint16_t*)0x2000000004ba = 2; *(uint16_t*)0x2000000004bc = 0x4c; STORE_BY_BITMASK(uint16_t, , 0x2000000004be, 1, 0, 14); STORE_BY_BITMASK(uint16_t, , 0x2000000004bf, 0, 6, 1); STORE_BY_BITMASK(uint16_t, , 0x2000000004bf, 0, 7, 1); *(uint16_t*)0x2000000004c0 = 7; *(uint16_t*)0x2000000004c2 = 1; memcpy((void*)0x2000000004c4, "ct\000", 3); *(uint16_t*)0x2000000004c8 = 0x24; STORE_BY_BITMASK(uint16_t, , 0x2000000004ca, 2, 0, 14); STORE_BY_BITMASK(uint16_t, , 0x2000000004cb, 0, 6, 1); STORE_BY_BITMASK(uint16_t, , 0x2000000004cb, 1, 7, 1); *(uint16_t*)0x2000000004cc = 0x18; *(uint16_t*)0x2000000004ce = 1; *(uint32_t*)0x2000000004d0 = 0; *(uint32_t*)0x2000000004d4 = 0; *(uint32_t*)0x2000000004d8 = 3; *(uint32_t*)0x2000000004dc = 0; *(uint32_t*)0x2000000004e0 = 0; *(uint16_t*)0x2000000004e4 = 6; *(uint16_t*)0x2000000004e6 = 3; *(uint16_t*)0x2000000004e8 = 0x19; *(uint16_t*)0x2000000004ec = 4; *(uint16_t*)0x2000000004ee = 6; *(uint16_t*)0x2000000004f0 = 0xc; *(uint16_t*)0x2000000004f2 = 7; *(uint32_t*)0x2000000004f4 = 0; *(uint32_t*)0x2000000004f8 = 0; *(uint16_t*)0x2000000004fc = 0xc; *(uint16_t*)0x2000000004fe = 8; *(uint32_t*)0x200000000500 = 0; *(uint32_t*)0x200000000504 = 3; *(uint64_t*)0x200000000308 = 0x88; *(uint64_t*)0x200000000298 = 1; *(uint64_t*)0x2000000002a0 = 0; *(uint64_t*)0x2000000002a8 = 0; *(uint32_t*)0x2000000002b0 = 0; syscall(__NR_sendmsg, /*fd=*/r[2], /*msg=*/0x200000000280ul, /*f=*/0ul); // write$tun arguments: [ // fd: fd_tun (resource) // buf: ptr[in, tun_buffer] { // tun_buffer { // pi: union optional[tun_pi] { // val: tun_pi { // flags: const = 0x70 (2 bytes) // proto: ether_types = 0x0 (2 bytes) // } // } // hdr: union optional[virtio_net_hdr] { // void: buffer: {} (length 0x0) // } // data: union tun_payload { // eth: eth_packet { // dst_mac: union mac_addr { // broadcast: buffer: {ff ff ff ff ff ff} (length 0x6) // } // src_mac: union mac_addr { // remote: mac_addr_t[const[0xbb, int8]] { // a0: buffer: {aa aa aa aa aa} (length 0x5) // a1: const = 0xbb (1 bytes) // } // } // vtag: union optional[vlan_tag] { // void: buffer: {} (length 0x0) // } // payload: eth_payload { // eth2: union eth2_packet { // ipv4: eth2_packet_t[ETH_P_IP, ipv4_packet] { // etype: const = 0x800 (2 bytes) // payload: union ipv4_packet { // udp: ipv4_packet_t[const[IPPROTO_UDP, int8], udp_packet] // { // header: ipv4_header[const[IPPROTO_UDP, int8]] { // ihl: bytesize4 = 0x5 (0 bytes) // version: const = 0x4 (1 bytes) // ecn: int8 = 0x0 (0 bytes) // dscp: int8 = 0x3c (1 bytes) // total_len: len = 0x24 (2 bytes) // id: int16be = 0x0 (2 bytes) // frag_off: int16be = 0x0 (2 bytes) // ttl: int8 = 0x0 (1 bytes) // protocol: const = 0x2f (1 bytes) // csum: csum = 0x0 (2 bytes) // src_ip: union ipv4_addr { // multicast1: const = 0xe0000001 (4 bytes) // } // dst_ip: union ipv4_addr { // multicast1: const = 0xe0000001 (4 bytes) // } // options: ipv4_options { // options: array[ipv4_option] { // } // } // } // payload: udp_packet { // src_port: int16be = 0x0 (2 bytes) // dst_port: int16be = 0x6558 (2 bytes) // length: len = 0x10 (2 bytes) // csum: csum = 0x0 (2 bytes) // payload: union udp_payload { // gue: gue_packet { // hdr: guehdr { // hlen: bytesize4 = 0x2 (0 bytes) // control: int8 = 0x0 (0 bytes) // version: int8 = 0x2 (1 bytes) // proto_ctype: int8 = 0xff (1 bytes) // flags: guehdr_flags = 0x100 (2 bytes) // priv: union optional[flags[guehdr_prov_flags, // int32]] { // val: guehdr_prov_flags = 0x0 (4 bytes) // } // } // opaque: buffer: {} (length 0x0) // } // } // } // } // } // } // } // } // } // } // } // } // count: len = 0x36 (8 bytes) // ] *(uint16_t*)0x200000000540 = 0x70; *(uint16_t*)0x200000000542 = htobe16(0); memset((void*)0x200000000544, 255, 6); memset((void*)0x20000000054a, 170, 5); *(uint8_t*)0x20000000054f = 0xbb; *(uint16_t*)0x200000000550 = htobe16(0x800); STORE_BY_BITMASK(uint8_t, , 0x200000000552, 5, 0, 4); STORE_BY_BITMASK(uint8_t, , 0x200000000552, 4, 4, 4); STORE_BY_BITMASK(uint8_t, , 0x200000000553, 0, 0, 2); STORE_BY_BITMASK(uint8_t, , 0x200000000553, 0x3c, 2, 6); *(uint16_t*)0x200000000554 = htobe16(0x24); *(uint16_t*)0x200000000556 = htobe16(0); *(uint16_t*)0x200000000558 = htobe16(0); *(uint8_t*)0x20000000055a = 0; *(uint8_t*)0x20000000055b = 0x2f; *(uint16_t*)0x20000000055c = htobe16(0); *(uint32_t*)0x20000000055e = htobe32(0xe0000001); *(uint32_t*)0x200000000562 = htobe32(0xe0000001); *(uint16_t*)0x200000000566 = htobe16(0); *(uint16_t*)0x200000000568 = htobe16(0x6558); *(uint16_t*)0x20000000056a = htobe16(0x10); *(uint16_t*)0x20000000056c = htobe16(0); STORE_BY_BITMASK(uint8_t, , 0x20000000056e, 2, 0, 5); STORE_BY_BITMASK(uint8_t, , 0x20000000056e, 0, 5, 1); STORE_BY_BITMASK(uint8_t, , 0x20000000056e, 2, 6, 2); *(uint8_t*)0x20000000056f = -1; *(uint16_t*)0x200000000570 = 0x100; *(uint32_t*)0x200000000572 = 0; struct csum_inet csum_1; csum_inet_init(&csum_1); csum_inet_update(&csum_1, (const uint8_t*)0x20000000055e, 4); csum_inet_update(&csum_1, (const uint8_t*)0x200000000562, 4); uint16_t csum_1_chunk_2 = 0x1100; csum_inet_update(&csum_1, (const uint8_t*)&csum_1_chunk_2, 2); uint16_t csum_1_chunk_3 = 0x1000; csum_inet_update(&csum_1, (const uint8_t*)&csum_1_chunk_3, 2); csum_inet_update(&csum_1, (const uint8_t*)0x200000000566, 16); *(uint16_t*)0x20000000056c = csum_inet_digest(&csum_1); struct csum_inet csum_2; csum_inet_init(&csum_2); csum_inet_update(&csum_2, (const uint8_t*)0x200000000552, 20); *(uint16_t*)0x20000000055c = csum_inet_digest(&csum_2); syscall(__NR_write, /*fd=*/r[0], /*buf=*/0x200000000540ul, /*count=*/0x36ul); } int main(void) { syscall(__NR_mmap, /*addr=*/0x1ffffffff000ul, /*len=*/0x1000, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul); syscall(__NR_mmap, /*addr=*/0x200000000000ul, /*len=*/0x1000000, /*prot=PROT_WRITE|PROT_READ|PROT_EXEC*/ 7ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul); syscall(__NR_mmap, /*addr=*/0x200001000000ul, /*len=*/0x1000, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul); const char* reason; (void)reason; loop(); return 0; }