# Copyright 2015 syzkaller project authors. All rights reserved.
# Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.

# Note these sysctls have radical effect on code paths inside of kernel:
# net.core.bpf_jit_enable  = { 0, 1, 2 }
# net.core.bpf_jit_harden  = { 0, 1, 2 }

include <uapi/linux/bpf.h>
include <uapi/linux/btf.h>
include <uapi/linux/if_link.h>
include <uapi/linux/netfilter.h>

resource fd_bpf_map[fd]: BPF_PSEUDO_MAP_FD
resource fd_bpf_prog[fd]
resource fd_btf[fd]
resource fd_bpf_token[fd]
resource bpf_prog_id[int32]: 0, -1
resource bpf_map_id[int32]: 0, -1
resource bpf_btf_id[int32]: 0, -1
resource bpf_link_id[int32]: 0, -1
resource fd_bpf_link[fd]
resource bpf_revision[int64]
resource fd_bpf_const_str_map[fd_bpf_map]
resource fd_bpf_const_str[fd_bpf_const_str_map]
resource bpf_frozen_const_str[fd_bpf_const_str]
resource tail_call_map_fd[fd_bpf_map]
resource tail_call_map[tail_call_map_fd]
resource ringbuf_map_fd[fd_bpf_map]

# NEED: this is a random index in btf_header:types. We can't express this, so we just use a small index.
type btf_type_id int32[1:5]
# NEED: opt modified on typedefs, this could be btf_type_id[opt]
type btf_opt_type_id int32[0:5]

# NEED: offset in bpf_btf_program:strings. We can't express this, so we just use a small index.
type btf_name_off int32[1:16]
type btf_opt_name_off int32[0:16]

# NEED: offset in bpf_prog_t:fd_array. We can't express this, so we just use a small index.
type map_fd_id int32[0:16]

bpf$MAP_CREATE(cmd const[BPF_MAP_CREATE], arg ptr[in, bpf_map_create_arg], size len[arg]) fd_bpf_map
bpf$MAP_CREATE_RINGBUF(cmd const[BPF_MAP_CREATE], arg ptr[in, bpf_map_create_arg_ringbuf], size len[arg]) ringbuf_map_fd
bpf$MAP_CREATE_CONST_STR(cmd const[BPF_MAP_CREATE], arg ptr[in, bpf_map_create_arg_const_str], size len[arg]) fd_bpf_const_str_map
bpf$MAP_CREATE_TAIL_CALL(cmd const[BPF_MAP_CREATE], arg ptr[in, bpf_map_create_arg_tail_call], size len[arg]) tail_call_map_fd
bpf$MAP_LOOKUP_ELEM(cmd const[BPF_MAP_LOOKUP_ELEM], arg ptr[in, bpf_map_lookup_arg], size len[arg])
bpf$MAP_UPDATE_ELEM(cmd const[BPF_MAP_UPDATE_ELEM], arg ptr[in, bpf_map_update_arg], size len[arg])
bpf$MAP_UPDATE_CONST_STR(cmd const[BPF_MAP_UPDATE_ELEM], arg ptr[inout, bpf_map_update_const_str_arg], size len[arg])
bpf$MAP_UPDATE_ELEM_TAIL_CALL(cmd const[BPF_MAP_UPDATE_ELEM], arg ptr[inout, bpf_map_update_tail_call_arg], size len[arg])
bpf$MAP_DELETE_ELEM(cmd const[BPF_MAP_DELETE_ELEM], arg ptr[in, bpf_map_delete_arg], size len[arg])
bpf$MAP_GET_NEXT_KEY(cmd const[BPF_MAP_GET_NEXT_KEY], arg ptr[in, bpf_map_get_next_arg], size len[arg])
bpf$PROG_LOAD(cmd const[BPF_PROG_LOAD], arg ptr[in, bpf_prog], size len[arg]) fd_bpf_prog
bpf$OBJ_PIN_MAP(cmd const[BPF_OBJ_PIN], arg ptr[in, bpf_obj_pin_map], size len[arg])
bpf$OBJ_PIN_PROG(cmd const[BPF_OBJ_PIN], arg ptr[in, bpf_obj_pin_prog], size len[arg])
bpf$OBJ_GET_MAP(cmd const[BPF_OBJ_GET], arg ptr[in, bpf_obj_get], size len[arg]) fd_bpf_map
bpf$OBJ_GET_PROG(cmd const[BPF_OBJ_GET], arg ptr[in, bpf_obj_get], size len[arg]) fd_bpf_prog
bpf$BPF_PROG_ATTACH(cmd const[BPF_PROG_ATTACH], arg ptr[in, bpf_attach_arg], size len[arg])
bpf$BPF_PROG_DETACH(cmd const[BPF_PROG_DETACH], arg ptr[in, bpf_detach_arg], size len[arg])
bpf$BPF_PROG_TEST_RUN(cmd const[BPF_PROG_TEST_RUN], arg ptr[in, bpf_test_prog_arg], size len[arg])
bpf$BPF_PROG_GET_NEXT_ID(cmd const[BPF_PROG_GET_NEXT_ID], arg ptr[inout, bpf_prog_get_next_id_arg], size len[arg])
bpf$BPF_MAP_GET_NEXT_ID(cmd const[BPF_MAP_GET_NEXT_ID], arg ptr[inout, bpf_map_get_next_id_arg], size len[arg])
bpf$BPF_BTF_GET_NEXT_ID(cmd const[BPF_BTF_GET_NEXT_ID], arg ptr[inout, bpf_btf_get_next_id_arg], size len[arg])
bpf$BPF_PROG_GET_FD_BY_ID(cmd const[BPF_PROG_GET_FD_BY_ID], arg ptr[in, bpf_prog_get_fd_by_id_arg], size len[arg]) fd_bpf_prog
bpf$BPF_MAP_GET_FD_BY_ID(cmd const[BPF_MAP_GET_FD_BY_ID], arg ptr[in, bpf_map_get_fd_by_id_arg], size len[arg]) fd_bpf_map
bpf$BPF_GET_PROG_INFO(cmd const[BPF_OBJ_GET_INFO_BY_FD], arg ptr[in, bpf_get_prog_info_arg], size len[arg])
bpf$BPF_GET_MAP_INFO(cmd const[BPF_OBJ_GET_INFO_BY_FD], arg ptr[in, bpf_get_map_info_arg], size len[arg])
bpf$BPF_GET_BTF_INFO(cmd const[BPF_OBJ_GET_INFO_BY_FD], arg ptr[in, bpf_get_btf_info_arg], size len[arg])
bpf$BPF_PROG_QUERY(cmd const[BPF_PROG_QUERY], arg ptr[inout, bpf_prog_query], size len[arg])
bpf$BPF_BTF_LOAD(cmd const[BPF_BTF_LOAD], arg ptr[in, bpf_btf_load], size len[arg]) fd_btf
bpf$BPF_BTF_GET_FD_BY_ID(cmd const[BPF_BTF_GET_FD_BY_ID], arg ptr[in, bpf_btf_id], size len[arg]) fd_btf
bpf$BPF_TASK_FD_QUERY(cmd const[BPF_TASK_FD_QUERY], arg ptr[inout, bpf_task_fd_query], size len[arg])
bpf$BPF_MAP_LOOKUP_AND_DELETE_ELEM(cmd const[BPF_MAP_LOOKUP_AND_DELETE_ELEM], arg ptr[in, bpf_map_lookup_arg], size len[arg])
bpf$BPF_MAP_FREEZE(cmd const[BPF_MAP_FREEZE], arg ptr[in, fd_bpf_map], size len[arg])
bpf$BPF_MAP_CONST_STR_FREEZE(cmd const[BPF_MAP_FREEZE], arg ptr[inout, bpf_map_const_str_freeze], size len[arg])
bpf$MAP_LOOKUP_BATCH(cmd const[BPF_MAP_LOOKUP_BATCH], arg ptr[in, bpf_map_batch_arg], size len[arg])
bpf$MAP_UPDATE_BATCH(cmd const[BPF_MAP_UPDATE_BATCH], arg ptr[in, bpf_map_batch_arg], size len[arg])
bpf$MAP_DELETE_BATCH(cmd const[BPF_MAP_DELETE_BATCH], arg ptr[in, bpf_map_batch_arg], size len[arg])
bpf$BPF_MAP_LOOKUP_AND_DELETE_BATCH(cmd const[BPF_MAP_LOOKUP_AND_DELETE_BATCH], arg ptr[in, bpf_map_batch_arg], size len[arg])
bpf$BPF_LINK_CREATE(cmd const[BPF_LINK_CREATE], arg ptr[in, bpf_link_create_arg], size len[arg]) fd_bpf_link
bpf$BPF_LINK_UPDATE(cmd const[BPF_LINK_UPDATE], arg ptr[in, bpf_link_update_arg], size len[arg])
bpf$ENABLE_STATS(cmd const[BPF_ENABLE_STATS], arg ptr[in, bpf_enable_stats_arg], size len[arg])
bpf$ITER_CREATE(cmd const[BPF_ITER_CREATE], arg ptr[in, bpf_iter_create_arg], size len[arg]) fd
bpf$LINK_GET_FD_BY_ID(cmd const[BPF_LINK_GET_FD_BY_ID], arg ptr[in, bpf_link_id], size len[arg]) fd_bpf_link
bpf$LINK_GET_NEXT_ID(cmd const[BPF_LINK_GET_NEXT_ID], arg ptr[inout, bpf_link_get_next_id_arg], size len[arg])
bpf$LINK_DETACH(cmd const[BPF_LINK_DETACH], arg ptr[in, fd_bpf_link], size len[arg])
bpf$PROG_BIND_MAP(cmd const[BPF_PROG_BIND_MAP], arg ptr[in, bpf_prog_bind_map_arg], size len[arg])
bpf$TOKEN_CREATE(cmd const[BPF_TOKEN_CREATE], arg ptr[in, bpf_token_create_arg], size len[arg]) fd_bpf_token

resource fd_bpf_prog_xdp[fd_bpf_prog]
bpf$PROG_LOAD_XDP(cmd const[BPF_PROG_LOAD], arg ptr[in, bpf_prog_xdp], size len[arg]) fd_bpf_prog_xdp
bpf$BPF_LINK_CREATE_XDP(cmd const[BPF_LINK_CREATE], arg ptr[in, bpf_link_create_xdp], size len[arg]) fd_bpf_link
bpf$BPF_PROG_TEST_RUN_LIVE(cmd const[BPF_PROG_TEST_RUN], arg ptr[in, bpf_test_prog_live_arg], size len[arg])
type bpf_prog_xdp bpf_prog_t[const[BPF_PROG_TYPE_XDP, int32], const[BPF_XDP, int32], const[0, int32], const[0, int32]]
type bpf_link_create_xdp bpf_link_create_arg_t[fd_bpf_prog_xdp, ifindex, const[BPF_XDP, int32], flags[xdp_flags, int32]]
xdp_flags = XDP_FLAGS_UPDATE_IF_NOEXIST, XDP_FLAGS_SKB_MODE, XDP_FLAGS_DRV_MODE, XDP_FLAGS_HW_MODE, XDP_FLAGS_REPLACE

bpf_map_const_str_freeze {
	in	fd_bpf_const_str
	out	bpf_frozen_const_str	(out_overlay)
}

bpf_map_create_arg [
	base		bpf_map_create_arg_base
	bloom_filter	bpf_map_create_arg_bf
	arena		bpf_map_create_arg_arena
] [varlen]

type bpf_map_create_arg_t[TYPE, KSIZE, VSIZE, MAX, FLAGS, MAP_EXTRA] {
	type			TYPE
	ksize			KSIZE
	vsize			VSIZE
	max			MAX
	flags			FLAGS
	inner			fd_bpf_map[opt]
	node			int32
	map_name		array[const[0, int8], BPF_OBJ_NAME_LEN]
	map_ifindex		ifindex[opt]
	btf_fd			fd_btf[opt]
	btf_key_type_id		btf_opt_type_id
	btf_value_type_id	btf_opt_type_id
	btf_vmlinux_type_id	btf_opt_type_id
	map_extra		MAP_EXTRA
# NEED: value_type_btf_obj_fd should also depend on the map type but AND operators are not yet supported in conditional fields.
	value_type_btf_obj_fd	fd_btf	(if[value[flags] & BPF_F_VTYPE_BTF_OBJ_FD != 0])
	pad1			const[0, int32]	(if[value[flags] & BPF_F_VTYPE_BTF_OBJ_FD == 0])
	map_token_fd		fd_bpf_token	(if[value[flags] & BPF_F_TOKEN_FD != 0])
	pad2			const[0, int32]	(if[value[flags] & BPF_F_TOKEN_FD == 0])
} [packed]

type bpf_map_create_arg_base bpf_map_create_arg_t[flags[bpf_map_type, int32], int32, int32, int32, flags[map_flags, int32], const[0, int64]]
type bpf_map_create_arg_bf bpf_map_create_arg_t[const[BPF_MAP_TYPE_BLOOM_FILTER, int32], int32, int32, int32, flags[map_flags, int32], int64[0:15]]
type bpf_map_create_arg_arena bpf_map_create_arg_t[const[BPF_MAP_TYPE_ARENA, int32], const[0, int32], const[0, int32], int32[1:64], flags[arena_map_flags, int32], const[0, int64]]
type bpf_map_create_arg_ringbuf bpf_map_create_arg_t[const[BPF_MAP_TYPE_RINGBUF, int32], const[0, int32], const[0, int32], int32, const[0, int32], const[0, int64]]
type bpf_map_create_arg_const_str bpf_map_create_arg_t[const[BPF_MAP_TYPE_ARRAY, int32], const[4, int32], const[8, int32], const[1, int32], const[BPF_F_RDONLY_PROG, int32], const[0, int64]]
type bpf_map_create_arg_tail_call bpf_map_create_arg_t[const[BPF_MAP_TYPE_PROG_ARRAY, int32], const[4, int32], const[4, int32], const[10, int32], const[0, int32], const[0, int64]]

bpf_map_get_fd_by_id_arg {
	map_id		bpf_map_id
	next_id		int32
	open_flags	flags[bpf_open_flags, int32]
}

bpf_map_lookup_arg {
	map	fd_bpf_map
	key	ptr64[in, array[int8]]
	val	ptr64[out, array[int8]]
	flags	flags[bpf_lookup_flags, int64]
}

bpf_map_update_val [
	buf	array[int8]
	udp	sock_udp
	udp6	sock_udp6
	tcp	sock_tcp
	tcp6	sock_tcp6
] [varlen]

bpf_map_update_arg {
	map	fd_bpf_map
	key	ptr64[in, array[int8]]
	val	ptr64[in, bpf_map_update_val]
	flags	flags[bpf_map_flags, int64]
}

map_bpf_const_str {
	in	fd_bpf_const_str_map
	out	fd_bpf_const_str	(out_overlay)
}

bpf_printf_str = "%-010d ", "%pK    ", "%+9llu ", "%pS    ", "%ps    ", "%pB    ", "%pI4   ", "%pi6   ", "%-5lx  "

bpf_map_update_const_str_arg {
	map	map_bpf_const_str
	key	ptr64[in, const[0, int32]]
	val	ptr64[in, string[bpf_printf_str]]
	flags	const[0, int64]
}

tail_call_map_update {
	in	tail_call_map_fd
	out	tail_call_map	(out_overlay)
}

bpf_map_update_tail_call_arg {
	map	tail_call_map_update
	key	ptr64[in, const[0, int32]]
	val	ptr64[in, fd_bpf_prog]
	flags	const[0, int64]
}

bpf_map_delete_arg {
	map	fd_bpf_map
	key	ptr64[in, array[int8]]
	value	const[0, int64]
	flags	const[0, int64]
}

bpf_map_get_next_arg {
	map	fd_bpf_map
	key	ptr64[in, array[int8]]
	next	ptr64[out, array[int8]]
	flags	const[0, int64]
}

bpf_map_batch_arg {
	in_batch	ptr64[in, array[int8]]
	out_batch	ptr64[out, array[int8]]
	key		ptr64[in, array[int8]]
	val		ptr64[in, array[int8]]
	count		int32
	map_fd		fd_bpf_map
	elem_flags	flags[bpf_batch_flags, int64]
	flags		const[0, int64]
}

bpf_iter_link_cgroup {
	order		flags[bpf_cgroup_iter_order, int32]
	cgroup_fd	fd_cgroup
	cgroup_id	int64
}

bpf_iter_link_task {
	tid	pid
	pid	pid
	pid_fd	fd_pidfd
}

bpf_iter_link_info [
	map_fd	fd_bpf_map
	cgroup	bpf_iter_link_cgroup
	task	bpf_iter_link_task
]

link_create_iter {
	iter_info	ptr[in, bpf_iter_link_info]
	iter_info_len	bytesize[iter_info, int32]
}

link_create_perf_event {
	bpf_cookie	int64
}

link_create_kprobe_multi_addrs {
	flags	flags[bpf_link_create_kprobe_multi_flags, int32]
	cnt	len[addrs, int32]
	syms	const[0, int64]
	addrs	ptr64[in, array[int64]]
	cookies	int64
}

link_create_kprobe_multi_symbols {
	flags	flags[bpf_link_create_kprobe_multi_flags, int32]
	cnt	len[syms, int32]
	syms	ptr64[in, array[ptr[in, string]]]
	addrs	const[0, int64]
	cookies	int64
}

link_create_kprobe_multi [
	addrs	link_create_kprobe_multi_addrs
	syms	link_create_kprobe_multi_symbols
]

link_create_tracing {
	target_btf_id	bpf_btf_id
	cookie		int64
}

link_create_netfilter {
	pf		flags[nfproto, int32]
	hooknum		flags[nf_dev_hooks, int32]
	priority	int32
	flags		flags[bpf_link_create_netfilter_flags, int32]
}

link_create_tcx {
	relative_link_fd	fd_bpf_link	(if[value[bpf_link_create_arg_t:flags] & BPF_F_LINK_OR_ID == BPF_F_LINK])
	relative_prog_fd	fd_bpf_prog	(if[value[bpf_link_create_arg_t:flags] & BPF_F_LINK_OR_ID == 0])
	relative_link_id	bpf_link_id	(if[value[bpf_link_create_arg_t:flags] & BPF_F_LINK_OR_ID == BPF_F_LINK_OR_ID])
	relative_prog_id	bpf_prog_id	(if[value[bpf_link_create_arg_t:flags] & BPF_F_LINK_OR_ID == BPF_F_ID])
	exp_revision		bpf_revision
} [packed]

link_create_uprobe_multi {
	path		ptr64[in, filename]
	offsets		ptr64[in, array[int64]]
	ref_ctr_offsets	ptr64[in, array[int64[0:5]], opt]
	cookies		int64
	cnt		len[offsets, int32]
	flags		flags[bpf_link_create_uprobe_multi_flags, int32]
	pid		pid
}

link_create_netkit {
	relative_link_fd	fd_bpf_link	(if[value[bpf_link_create_arg_t:flags] & BPF_F_LINK_OR_ID == BPF_F_LINK])
	relative_prog_fd	fd_bpf_prog	(if[value[bpf_link_create_arg_t:flags] & BPF_F_LINK_OR_ID == 0])
	relative_link_id	bpf_link_id	(if[value[bpf_link_create_arg_t:flags] & BPF_F_LINK_OR_ID == BPF_F_LINK_OR_ID])
	relative_prog_id	bpf_prog_id	(if[value[bpf_link_create_arg_t:flags] & BPF_F_LINK_OR_ID == BPF_F_ID])
	exp_revision		bpf_revision
} [packed]

link_create_arg_extra [
	target_btf_id	bpf_btf_id
	iter		link_create_iter
	perf_event	link_create_perf_event
	kprobe_multi	link_create_kprobe_multi
	tracing		link_create_tracing
	netfilter	link_create_netfilter
	tcx		link_create_tcx
	uprobe_multi	link_create_uprobe_multi
	netkit		link_create_netkit
] [varlen]

type bpf_link_create_arg_t[PROG_FD, TARGET_FD, ATTACH_TYPE, FLAGS] {
	prog_fd		PROG_FD
	target_fd	TARGET_FD
	attach_type	ATTACH_TYPE
	flags		FLAGS
	extra		optional[link_create_arg_extra]
}

type bpf_link_create_arg bpf_link_create_arg_t[fd_bpf_prog, fd_cgroup, flags[bpf_attach_types_link_create, int32], const[0, int32]]

bpf_link_update_arg {
	link_fd		fd_bpf_link
	new_prog_fd	fd_bpf_prog
	flags		flags[bpf_link_update_flags, int32]
	old_prog_fd	fd_bpf_prog
}

bpf_enable_stats_arg {
	type	flags[bpf_stat_types, int32]
}

bpf_iter_create_arg {
	link_fd	fd_bpf_link
	flags	const[0, int32]
}

bpf_batch_flags = BPF_F_LOCK

bpf_obj_pin_map [
	generic	bpf_obj_pin_map_generic
	o_path	bpf_obj_pin_map_o_path
]

bpf_obj_pin_prog [
	generic	bpf_obj_pin_prog_generic
	o_path	bpf_obj_pin_prog_o_path
]

bpf_obj_get [
	generic	bpf_obj_get_generic
	o_path	bpf_obj_get_o_path
]

# NEED: these filenames must be on bpf filesystem, can we do it somehow?
bpf_obj_pin_map_generic {
	path	ptr64[in, filename]
	fd	fd_bpf_map
	flags	const[0, int32]
	path_fd	const[0, int32]
}

bpf_obj_pin_prog_generic {
	path	ptr64[in, filename]
	fd	fd_bpf_prog
	flags	const[0, int32]
	path_fd	const[0, int32]
}

bpf_obj_get_generic {
	path		ptr64[in, filename]
	fd		const[0, int32]
	file_flags	flags[bpf_open_flags, int32]
	path_fd		const[0, int32]
}

# NEED: Specific type for O_PATH fds (for path_fd).
bpf_obj_pin_map_o_path {
	path	ptr64[in, filename]
	fd	fd_bpf_map
	flags	const[BPF_F_PATH_FD, int32]
	path_fd	fd
}

bpf_obj_pin_prog_o_path {
	path	ptr64[in, filename]
	fd	fd_bpf_prog
	flags	const[BPF_F_PATH_FD, int32]
	path_fd	fd
}

bpf_obj_get_o_path {
	path		ptr64[in, filename]
	fd		const[0, int32]
	file_flags	flags[bpf_obj_get_flags, int32]
	path_fd		fd
}

# These defines should match the mapping implemented by attach_type_to_prog_type in the kernel.
define EXP_TYPE_CGROUP_SKB	BPF_CGROUP_INET_INGRESS | BPF_CGROUP_INET_EGRESS
define EXP_TYPE_CGROUP_SOCK	BPF_CGROUP_INET_SOCK_CREATE | BPF_CGROUP_INET_SOCK_RELEASE | BPF_CGROUP_INET4_POST_BIND | BPF_CGROUP_INET6_POST_BIND
define EXP_TYPE_CGROUP_SOCK_ADDR	BPF_CGROUP_INET4_BIND | BPF_CGROUP_INET6_BIND | BPF_CGROUP_INET4_CONNECT | BPF_CGROUP_INET6_CONNECT | BPF_CGROUP_UNIX_CONNECT | BPF_CGROUP_INET4_GETPEERNAME | BPF_CGROUP_INET6_GETPEERNAME | BPF_CGROUP_UNIX_GETPEERNAME | BPF_CGROUP_INET4_GETSOCKNAME | BPF_CGROUP_INET6_GETSOCKNAME | BPF_CGROUP_UNIX_GETSOCKNAME | BPF_CGROUP_UDP4_SENDMSG | BPF_CGROUP_UDP6_SENDMSG | BPF_CGROUP_UNIX_SENDMSG | BPF_CGROUP_UDP4_RECVMSG | BPF_CGROUP_UDP6_RECVMSG | BPF_CGROUP_UNIX_RECVMSG
define EXP_TYPE_SOCK_OPS	BPF_CGROUP_SOCK_OPS
define EXP_TYPE_CGROUP_DEVICE	BPF_CGROUP_DEVICE
define EXP_TYPE_SK_MSG	BPF_SK_MSG_VERDICT
define EXP_TYPE_SK_SKB	BPF_SK_SKB_STREAM_PARSER | BPF_SK_SKB_STREAM_VERDICT | BPF_SK_SKB_VERDICT
define EXP_TYPE_LIRC_MODE2	BPF_LIRC_MODE2
define EXP_TYPE_FLOW_DISSECTOR	BPF_FLOW_DISSECTOR
define EXP_TYPE_CGROUP_SYSCTL	BPF_CGROUP_SYSCTL
define EXP_TYPE_CGROUP_SOCKOPT	BPF_CGROUP_GETSOCKOPT | BPF_CGROUP_SETSOCKOPT
define EXP_TYPE_TRACING	BPF_TRACE_ITER | BPF_TRACE_RAW_TP | BPF_TRACE_FENTRY | BPF_TRACE_FEXIT | BPF_MODIFY_RETURN
define EXP_TYPE_LSM	BPF_LSM_MAC | BPF_LSM_CGROUP
define EXP_TYPE_SK_LOOKUP	BPF_SK_LOOKUP
define EXP_TYPE_XDP	BPF_XDP
define EXP_TYPE_SCHED_CLS	BPF_TCX_INGRESS | BPF_TCX_EGRESS | BPF_NETKIT_PRIMARY | BPF_NETKIT_PEER

define EXP_MAP	EXP_TYPE_SK_MSG | EXP_TYPE_SK_SKB
define EXP_CGROUP	EXP_TYPE_CGROUP_DEVICE | EXP_TYPE_CGROUP_SKB | EXP_TYPE_CGROUP_SOCK | EXP_TYPE_CGROUP_SOCK_ADDR | EXP_TYPE_CGROUP_SOCKOPT | EXP_TYPE_CGROUP_SYSCTL | EXP_TYPE_SOCK_OPS | EXP_TYPE_LSM

bpf_attach_targets [
	cgroup		fd_cgroup	(if[value[parent:parent:type] & EXP_CGROUP != 0])
	map		fd_bpf_map	(if[value[parent:parent:type] & EXP_MAP != 0])
	ifindex		ifindex	(if[value[parent:parent:type] & BPF_PROG_TYPE_SCHED_CLS != 0])
	fallback	fd
]

define BPF_F_LINK_OR_ID	BPF_F_LINK | BPF_F_ID

bpf_attach_arg {
	target			bpf_attach_targets
	attach_bpf_fd		fd_bpf_prog
	type			flags[bpf_attach_types, int32]
	flags			flags[bpf_attach_flags, int32]
	replace_bpf_fd		fd_bpf_prog
	relative_link_fd	fd_bpf_link	(if[value[flags] & BPF_F_LINK_OR_ID == BPF_F_LINK])
	relative_prog_fd	fd_bpf_prog	(if[value[flags] & BPF_F_LINK_OR_ID == 0])
	relative_link_id	bpf_link_id	(if[value[flags] & BPF_F_LINK_OR_ID == BPF_F_LINK_OR_ID])
	relative_prog_id	bpf_prog_id	(if[value[flags] & BPF_F_LINK_OR_ID == BPF_F_ID])
	exp_revision		bpf_revision
} [packed]

bpf_detach_arg {
	target			bpf_attach_targets
	prog			fd_bpf_prog
	type			flags[bpf_attach_types, int32]
	flags			flags[bpf_mprog_attach_flags, int32]
	replace_bpf_fd		const[0, int32]
	relative_link_fd	fd_bpf_link	(if[value[flags] & BPF_F_LINK_OR_ID == BPF_F_LINK])
	relative_prog_fd	fd_bpf_prog	(if[value[flags] & BPF_F_LINK_OR_ID == 0])
	relative_link_id	bpf_link_id	(if[value[flags] & BPF_F_LINK_OR_ID == BPF_F_LINK_OR_ID])
	relative_prog_id	bpf_prog_id	(if[value[flags] & BPF_F_LINK_OR_ID == BPF_F_ID])
	exp_revision		bpf_revision
} [packed]

bpf_test_prog_arg {
	prog		fd_bpf_prog
	retval		const[0, int32]
	insizedata	len[indata, int32]
	outsizedata	len[outdata, int32]
	indata		ptr64[in, array[int8]]
	outdata		ptr64[out, array[int8]]
	repeat		int32
	dur		const[0, int32]
	insizectx	len[inctx, int32]
	outsizectx	len[outctx, int32]
	inctx		ptr64[in, array[int8]]
	outctx		ptr64[in, array[int8]]
	flags		flags[bpf_prog_test_run_flags, int32]
	cpu		const[0, int32]
	batch_size	int32
}

bpf_test_prog_live_arg {
	prog		fd_bpf_prog_xdp
	retval		const[0, int32]
	insizedata	len[indata, int32]
	outsizedata	const[0, int32]
	indata		ptr64[in, array[int8]]
	outdata		const[0, int64]
	repeat		int32
	dur		const[0, int32]
	insizectx	len[inctx, int32]
	outsizectx	const[0, int32]
	inctx		ptr64[in, array[int8]]
	outctx		const[0, int64]
	flags		const[BPF_F_TEST_XDP_LIVE_FRAMES, int32]
	cpu		const[0, int32]
	batch_size	int32
}

bpf_prog_get_next_id_arg {
	start	int32	(in)
	next_id	bpf_prog_id	(out)
}

bpf_map_get_next_id_arg {
	start	int32	(in)
	next_id	bpf_map_id	(out)
}

bpf_btf_get_next_id_arg {
	start	int32	(in)
	next_id	bpf_btf_id	(out)
}

bpf_link_get_next_id_arg {
	start	int32	(in)
	next_id	bpf_link_id	(out)
}

bpf_prog_get_fd_by_id_arg {
	prog	bpf_prog_id
}

bpf_prog_bind_map_arg {
	prog_fd	fd_bpf_prog
	map_fd	fd_bpf_map
	flags	const[0, int32]
}

bpf_token_create_arg {
	flags		const[0, int32]
	bpffs_id	fd
}

bpf_get_prog_info_arg {
	prog	fd_bpf_prog
	len	len[info, int32]
	info	ptr64[out, bpf_prog_info]
}

# These are defined in bpf/verifier.c.
define MIN_BPF_FUNCINFO_SIZE	8
define MAX_FUNCINFO_REC_SIZE	252

bpf_prog_info {
	type				int32
	id				bpf_prog_id
	tag				int64
	jited_prog_len			int32
	xlated_prog_len			int32
	jited_prog_insns		int64
	xlated_prog_insns		int64
	load_time			int64
	created_by_uid			int32
	nr_map_ids			len[map_ids, int32]	(in)
# We could declare these as bpf_map_id, but this is not the best way to obtain these resources.
	map_ids				ptr64[out, array[int32]]
	name				array[int8, BPF_OBJ_NAME_LEN]
	ifindex				ifindex
	gpl_compatible			int32:1
	netns_dev			int64
	netns_ino			int64
	nr_jited_ksyms			len[jited_ksyms, int32]	(in)
	nr_jited_func_lens		len[jited_func_lens, int32]	(in)
	jited_ksyms			ptr64[out, array[int64]]
	jited_func_lens			ptr64[out, array[int32]]
	btf_id				bpf_btf_id
	func_info_rec_size		int32[MIN_BPF_FUNCINFO_SIZE:MAX_FUNCINFO_REC_SIZE]	(in)
	func_info			ptr64[out, array[bpf_func_info]]
	nr_func_info			bytesize[func_info, int32]	(in)
	nr_line_info			len[line_info, int32]	(in)
	line_info			ptr64[out, bpf_line_info]
	jited_line_info			ptr64[out, int64]
	nr_jited_line_info		len[jited_line_info, int32]	(in)
	line_info_rec_size		int32[MIN_BPF_FUNCINFO_SIZE:MAX_FUNCINFO_REC_SIZE]	(in)
	jited_line_info_rec_size	const[8, int32]	(in)
	nr_prog_tags			len[prog_tags, int32]	(in)
	prog_tags			ptr64[out, int64]
	run_time_ns			int64
	run_cnt				int64
	recursion_misses		int64
	verified_insns			int32
} [align[8]]

bpf_get_map_info_arg {
	prog	fd_bpf_map
	len	len[info, int32]
	info	ptr64[out, bpf_map_info]
}

bpf_map_info {
	type				int32
	id				bpf_map_id
	key_size			int32
	value_size			int32
	max_entries			int32
	map_flags			int32
	name				array[int8, BPF_OBJ_NAME_LEN]
	ifindex				ifindex
	btf_vmlinux_value_type_id	int32
	netns_dev			int64
	netns_ino			int64
	btf_id				int32
	btf_key_type_id			int32
	btf_value_type_id		int32
	map_extra			align64[int64]
} [align[8]]

bpf_get_btf_info_arg {
	btf	fd_btf	(in)
	len	len[info, int32]	(in)
	info	ptr64[out, bpf_btf_info]
}

bpf_btf_info {
	btf		ptr64[out, array[int8]]
	btf_size	bytesize[btf, int32]	(in)
	id		bpf_btf_id
	name		ptr64[out, array[int8]]
	name_len	bytesize[name, int32]
	kernel_btf	int32
} [align[8]]

bpf_prog_query {
	target_fd		bpf_attach_targets
	type			flags[bpf_prog_query_attach_type, int32]
	query_flags		flags[bpf_prog_query_flags, int32]
	attach_flags		int32
	prog_ids		ptr64[out, array[int32]]
	prog_cnt		len[prog_ids, int32]
	pad			const[0, int32]
	prog_attach_flags	ptr64[out, array[int32]]
	link_ids		ptr64[out, array[int32]]
	link_attach_flags	ptr64[out, array[int32]]
	revision		bpf_revision	(out)
} [packed, align[8]]

bpf_btf_load {
	btf			ptr64[in, bpf_btf_program]
	btf_log_buf		ptr64[out, array[int8]]
	btf_size		bytesize[btf, int32]
	btf_log_size		bytesize[btf_log_buf, int32]
	btf_log_level		bool32
	btf_log_true_size	int32
	btf_flags		flags[btf_load_flags, int32]
	btf_token_fd		fd_bpf_token	(if[value[btf_flags] & BPF_F_TOKEN_FD != 0])
	pad			const[0, int32]	(if[value[btf_flags] & BPF_F_TOKEN_FD == 0])
} [packed, align[8]]

bpf_btf_program {
	header	btf_header
	strings	bpf_btf_strings
} [packed]

btf_header {
	magic		const[BTF_MAGIC, int16]
	version		const[BTF_VERSION, int8]
	flags		const[0, int8]
	hdr_len		const[0x18, int32]
	type_off	const[0, int32]
	type_len	bytesize[types, int32]
	str_off		bytesize[types, int32]
	str_len		bytesize[bpf_btf_program:strings, int32]
	types		array[btf_type]
} [align[4]]

btf_type [
	int		btf_type_int
	ptr		btf_type_ref_t[BTF_KIND_PTR]
	array		btf_type_array
	struct		btf_type_struct_t[BTF_KIND_STRUCT]
	union		btf_type_struct_t[BTF_KIND_UNION]
	enum		btf_type_enum
	fwd		btf_type_fwd
	typedef		btf_type_ref_t[BTF_KIND_TYPEDEF]
	volatile	btf_type_ref_t[BTF_KIND_VOLATILE]
	const		btf_type_ref_t[BTF_KIND_CONST]
	restrict	btf_type_ref_t[BTF_KIND_RESTRICT]
	func		btf_type_func
	func_proto	btf_type_func_proto
	var		btf_type_var
	datasec		btf_type_datasec
	float		btf_type_float
	decl_tag	btf_type_decl_tag
	type_tag	btf_type_type_tag
	enum64		btf_type_enum64
] [varlen]

btf_int_size = 1, 2, 4, 8, 16

btf_type_int {
# Note: this is an offset in bpf_btf_program:strings
	name_off	btf_opt_name_off
	info_vlen	const[0, int16]
	info_pad	const[0, int8]
	info_typ	const[BTF_KIND_INT, int8]
	size		flags[btf_int_size, int32]
	bits		int8[0:128]
	pad		const[0, int8]
	offset		int8[0:8]
	encoding	flags[btf_type_int_encoding, int8]
}

btf_type_int_encoding = BTF_INT_SIGNED, BTF_INT_CHAR, BTF_INT_BOOL

type btf_type_ref_t[TYP] {
	name_off	btf_opt_name_off
	info_vlen	const[0, int16]
	info_pad	const[0, int8]
	info_typ	const[TYP, int8]
	type		btf_opt_type_id
}

btf_type_array {
	name_off	const[0, int32]
	info_vlen	const[0, int16]
	info_pad	const[0, int8]
	info_typ	const[BTF_KIND_ARRAY, int8]
	size		const[0, int32]
	data		btf_array
}

btf_array {
	type		btf_type_id
	index_type	btf_type_id
	nelems		int32
}

type btf_type_struct_t[TYP] {
	name_off	btf_opt_name_off
	info_vlen	len[fields, int16]
	info_pad	const[0, int8]
	info_typ	const[TYP, int8:7]
	info_kflag	int8:1
	size		int32
	fields		array[btf_member]
}

btf_member {
	name_off	btf_opt_name_off
	type		btf_opt_type_id
	offset		int32
}

btf_type_enum {
	name_off	btf_opt_name_off
	info_vlen	len[values, int16]
	info_pad	const[0, int8]
	info_typ	const[BTF_KIND_ENUM, int8]
	size		const[4, int32]
	values		array[btf_enum]
}

btf_enum {
	name_off	btf_opt_name_off
	val		int32
}

btf_type_fwd {
	name_off	btf_name_off
	info_vlen	const[0, int16]
	info_pad	const[0, int8]
	info_typ	const[BTF_KIND_FWD, int8]
	size		const[0, int32]
}

btf_type_func {
	name_off	btf_name_off
	info_vlen	const[0, int16]
	info_pad	const[0, int8]
	info_typ	const[BTF_KIND_FUNC, int8]
	type		btf_type_id
}

btf_type_func_proto {
	name_off	const[0, int32]
	info_vlen	len[params, int16]
	info_pad	const[0, int8]
	info_typ	const[BTF_KIND_FUNC_PROTO, int8]
	size		const[0, int32]
	params		array[btf_param]
}

btf_param {
	name_off	btf_opt_name_off
	type		btf_opt_type_id
}

btf_type_var {
	name_off	btf_name_off
	info_vlen	const[0, int16]
	info_pad	const[0, int8]
	info_typ	const[BTF_KIND_VAR, int8]
	type		btf_type_id
	linkage		flags[btf_linkage_values, int32]
}

btf_type_datasec {
	name_off	btf_name_off
	info_vlen	len[secinfo, int16]
	info_pad	const[0, int8]
	info_typ	const[BTF_KIND_DATASEC, int8]
	size		bytesize[data, int32]
	secinfo		array[btf_var_secinfo]
	data		array[int8, 1:3]
} [packed]

btf_var_secinfo {
	type	btf_type_id
# NEED: offset/size are for btf_type_datasec:data and must be increasing and within bounds (see btf_datasec_check_meta)
	offset	int32
	size	int32
}

btf_float_size = 2, 4, 8, 12, 16

btf_type_float {
	name_off	btf_name_off
	info_vlen	const[0, int16]
	info_pad	const[0, int8]
	info_typ	const[BTF_KIND_FLOAT, int8]
	size		flags[btf_float_size, int32]
}

btf_type_decl_tag {
	name_off	btf_name_off
	info_vlen	const[0, int16]
	info_pad	const[0, int8]
	info_typ	const[BTF_KIND_DECL_TAG, int8]
	type		btf_type_id
# -1 or the index of a struct field or function argument.
	component_idx	int32[-1:10]
}

btf_type_type_tag {
	name_off	btf_name_off
	info_vlen	const[0, int16]
	info_pad	const[0, int8]
	info_typ	const[BTF_KIND_TYPE_TAG, int8]
	type		btf_type_id
}

btf_enum64_sizes = 1, 2, 4, 8

btf_type_enum64 {
	name_off	btf_name_off
	info_vlen	len[enum64, int16]
	info_pad	const[0, int8]
	info_typ	const[BTF_KIND_ENUM64, int8:7]
	info_kflag	int8:1
	size		flags[btf_enum64_sizes, int32]
	enum64		array[btf_enum64]
}

btf_enum64 {
	name_off	btf_name_off
	val_lo32	int32
	val_hi32	int32
}

bpf_btf_strings {
	z0	const[0, int8]
	data	array[flags[bpf_btf_strings_elem, int8]]
	z1	const[0, int8]
} [packed]

bpf_btf_strings_elem = 'a', '0', '_', '.', 0

bpf_task_fd_query {
	pid		pid	(in)
	fd		fd_perf_base	(in)
	flags		const[0, int32]	(in)
	buf_len		bytesize[buf, int32]	(in)
	buf		ptr64[in, string]	(in)
	prog_id		bpf_prog_id	(out)
	fd_type		int32	(out)
	probe_offset	int64	(out)
	probe_addr	int64	(out)
}

bpf_map_type = BPF_MAP_TYPE_HASH, BPF_MAP_TYPE_ARRAY, BPF_MAP_TYPE_PROG_ARRAY, BPF_MAP_TYPE_PERF_EVENT_ARRAY, BPF_MAP_TYPE_STACK_TRACE, BPF_MAP_TYPE_CGROUP_ARRAY, BPF_MAP_TYPE_PERCPU_HASH, BPF_MAP_TYPE_PERCPU_ARRAY, BPF_MAP_TYPE_LRU_HASH, BPF_MAP_TYPE_LRU_PERCPU_HASH, BPF_MAP_TYPE_LPM_TRIE, BPF_MAP_TYPE_ARRAY_OF_MAPS, BPF_MAP_TYPE_HASH_OF_MAPS, BPF_MAP_TYPE_DEVMAP, BPF_MAP_TYPE_SOCKMAP, BPF_MAP_TYPE_CPUMAP, BPF_MAP_TYPE_XSKMAP, BPF_MAP_TYPE_SOCKHASH, BPF_MAP_TYPE_CGROUP_STORAGE, BPF_MAP_TYPE_REUSEPORT_SOCKARRAY, BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE, BPF_MAP_TYPE_QUEUE, BPF_MAP_TYPE_STACK, BPF_MAP_TYPE_SK_STORAGE, BPF_MAP_TYPE_DEVMAP_HASH, BPF_MAP_TYPE_STRUCT_OPS, BPF_MAP_TYPE_RINGBUF, BPF_MAP_TYPE_INODE_STORAGE, BPF_MAP_TYPE_TASK_STORAGE, BPF_MAP_TYPE_BLOOM_FILTER, BPF_MAP_TYPE_CGRP_STORAGE, BPF_MAP_TYPE_USER_RINGBUF, BPF_MAP_TYPE_ARENA
bpf_map_flags = BPF_ANY, BPF_NOEXIST, BPF_EXIST, BPF_F_LOCK
bpf_lookup_flags = BPF_F_LOCK
bpf_prog_type = BPF_PROG_TYPE_SOCKET_FILTER, BPF_PROG_TYPE_KPROBE, BPF_PROG_TYPE_SCHED_CLS, BPF_PROG_TYPE_SCHED_ACT, BPF_PROG_TYPE_TRACEPOINT, BPF_PROG_TYPE_XDP, BPF_PROG_TYPE_PERF_EVENT, BPF_PROG_TYPE_CGROUP_SKB, BPF_PROG_TYPE_CGROUP_SOCK, BPF_PROG_TYPE_LWT_IN, BPF_PROG_TYPE_LWT_OUT, BPF_PROG_TYPE_LWT_XMIT, BPF_PROG_TYPE_SOCK_OPS, BPF_PROG_TYPE_SK_SKB, BPF_PROG_TYPE_CGROUP_DEVICE, BPF_PROG_TYPE_SK_MSG, BPF_PROG_TYPE_RAW_TRACEPOINT, BPF_PROG_TYPE_CGROUP_SOCK_ADDR, BPF_PROG_TYPE_LWT_SEG6LOCAL, BPF_PROG_TYPE_LIRC_MODE2, BPF_PROG_TYPE_SK_REUSEPORT, BPF_PROG_TYPE_FLOW_DISSECTOR, BPF_PROG_TYPE_CGROUP_SYSCTL, BPF_PROG_TYPE_RAW_TRACEPOINT_WRITABLE, BPF_PROG_TYPE_CGROUP_SOCKOPT, BPF_PROG_TYPE_TRACING, BPF_PROG_TYPE_EXT, BPF_PROG_TYPE_STRUCT_OPS, BPF_PROG_TYPE_LSM, BPF_PROG_TYPE_SK_LOOKUP, BPF_PROG_TYPE_SYSCALL, BPF_PROG_TYPE_NETFILTER
map_flags = BPF_F_NO_PREALLOC, BPF_F_NO_COMMON_LRU, BPF_F_NUMA_NODE, BPF_F_RDONLY, BPF_F_WRONLY, BPF_F_STACK_BUILD_ID, BPF_F_ZERO_SEED, BPF_F_RDONLY_PROG, BPF_F_WRONLY_PROG, BPF_F_CLONE, BPF_F_MMAPABLE, BPF_F_INNER_MAP, BPF_F_PRESERVE_ELEMS, BPF_F_LINK, BPF_F_PATH_FD, BPF_F_VTYPE_BTF_OBJ_FD, BPF_F_TOKEN_FD, BPF_F_SEGV_ON_FAULT, BPF_F_NO_USER_CONV
arena_map_flags = BPF_F_MMAPABLE, BPF_F_SEGV_ON_FAULT, BPF_F_NO_USER_CONV
bpf_attach_types = BPF_XDP_DEVMAP, BPF_XDP_CPUMAP, BPF_SK_REUSEPORT_SELECT, BPF_SK_REUSEPORT_SELECT_OR_MIGRATE, BPF_PERF_EVENT, BPF_TRACE_KPROBE_MULTI, BPF_STRUCT_OPS, BPF_NETFILTER, BPF_TRACE_UPROBE_MULTI, BPF_TRACE_KPROBE_SESSION, bpf_attach_types_link_create
bpf_attach_types_link_create = BPF_CGROUP_INET_INGRESS, BPF_CGROUP_INET_EGRESS, BPF_CGROUP_INET_SOCK_CREATE, BPF_CGROUP_INET4_POST_BIND, BPF_CGROUP_INET6_POST_BIND, BPF_CGROUP_INET4_BIND, BPF_CGROUP_INET6_BIND, BPF_CGROUP_INET4_CONNECT, BPF_CGROUP_INET6_CONNECT, BPF_CGROUP_UDP4_SENDMSG, BPF_CGROUP_UDP6_SENDMSG, BPF_CGROUP_UDP4_RECVMSG, BPF_CGROUP_UDP6_RECVMSG, BPF_CGROUP_SOCK_OPS, BPF_CGROUP_DEVICE, BPF_SK_MSG_VERDICT, BPF_SK_SKB_STREAM_PARSER, BPF_SK_SKB_STREAM_VERDICT, BPF_LIRC_MODE2, BPF_FLOW_DISSECTOR, BPF_CGROUP_SYSCTL, BPF_CGROUP_GETSOCKOPT, BPF_CGROUP_SETSOCKOPT, BPF_CGROUP_INET4_GETPEERNAME, BPF_CGROUP_INET4_GETSOCKNAME, BPF_CGROUP_INET6_GETPEERNAME, BPF_CGROUP_INET6_GETSOCKNAME, BPF_TRACE_ITER, BPF_CGROUP_INET_SOCK_RELEASE, BPF_SK_LOOKUP, BPF_XDP, BPF_SK_SKB_VERDICT, BPF_LSM_CGROUP, BPF_LSM_MAC, BPF_MODIFY_RETURN, BPF_TRACE_FENTRY, BPF_TRACE_FEXIT, BPF_TRACE_RAW_TP, BPF_TCX_EGRESS, BPF_TCX_INGRESS, BPF_NETKIT_PRIMARY, BPF_NETKIT_PEER, BPF_CGROUP_UNIX_CONNECT, BPF_CGROUP_UNIX_SENDMSG, BPF_CGROUP_UNIX_RECVMSG, BPF_CGROUP_UNIX_GETPEERNAME, BPF_CGROUP_UNIX_GETSOCKNAME
bpf_prog_load_flags = BPF_F_STRICT_ALIGNMENT, BPF_F_ANY_ALIGNMENT, BPF_F_TEST_RND_HI32, BPF_F_TEST_STATE_FREQ, BPF_F_SLEEPABLE, BPF_F_XDP_DEV_BOUND_ONLY, BPF_F_XDP_HAS_FRAGS
bpf_mprog_attach_flags = BPF_F_REPLACE, BPF_F_BEFORE, BPF_F_AFTER, BPF_F_ID, BPF_F_LINK
bpf_attach_flags = BPF_F_ALLOW_OVERRIDE, BPF_F_ALLOW_MULTI, bpf_mprog_attach_flags
bpf_link_update_flags = BPF_F_REPLACE
bpf_prog_query_flags = BPF_F_QUERY_EFFECTIVE
bpf_prog_test_run_flags = BPF_F_TEST_RUN_ON_CPU, BPF_F_TEST_XDP_LIVE_FRAMES, BPF_F_TEST_SKB_CHECKSUM_COMPLETE
bpf_prog_query_attach_type = BPF_CGROUP_INET_INGRESS, BPF_CGROUP_INET_EGRESS, BPF_CGROUP_INET_SOCK_CREATE, BPF_CGROUP_SOCK_OPS, BPF_CGROUP_DEVICE, BPF_CGROUP_INET4_BIND, BPF_CGROUP_INET4_CONNECT, BPF_CGROUP_INET4_POST_BIND, BPF_CGROUP_INET6_BIND, BPF_CGROUP_INET6_CONNECT, BPF_CGROUP_INET6_POST_BIND, BPF_CGROUP_UDP4_SENDMSG, BPF_CGROUP_UDP6_SENDMSG, BPF_LIRC_MODE2, BPF_CGROUP_SYSCTL, BPF_FLOW_DISSECTOR, BPF_CGROUP_UDP4_RECVMSG, BPF_CGROUP_UDP6_RECVMSG, BPF_CGROUP_GETSOCKOPT, BPF_CGROUP_SETSOCKOPT, BPF_CGROUP_INET4_GETPEERNAME, BPF_CGROUP_INET4_GETSOCKNAME, BPF_CGROUP_INET6_GETPEERNAME, BPF_CGROUP_INET6_GETSOCKNAME, BPF_CGROUP_INET_SOCK_RELEASE, BPF_SK_LOOKUP, BPF_LSM_CGROUP, BPF_SK_MSG_VERDICT, BPF_SK_SKB_STREAM_PARSER, BPF_SK_SKB_STREAM_VERDICT, BPF_SK_SKB_VERDICT, BPF_TCX_INGRESS, BPF_TCX_EGRESS, BPF_NETKIT_PRIMARY, BPF_NETKIT_PEER, BPF_CGROUP_UNIX_CONNECT, BPF_CGROUP_UNIX_SENDMSG, BPF_CGROUP_UNIX_RECVMSG, BPF_CGROUP_UNIX_GETPEERNAME, BPF_CGROUP_UNIX_GETSOCKNAME
bpf_open_flags = BPF_F_RDONLY, BPF_F_WRONLY
bpf_stat_types = BPF_STATS_RUN_TIME
bpf_core_relo_kind = BPF_CORE_FIELD_BYTE_OFFSET, BPF_CORE_FIELD_BYTE_SIZE, BPF_CORE_FIELD_EXISTS, BPF_CORE_FIELD_SIGNED, BPF_CORE_FIELD_LSHIFT_U64, BPF_CORE_FIELD_RSHIFT_U64, BPF_CORE_TYPE_ID_LOCAL, BPF_CORE_TYPE_ID_TARGET, BPF_CORE_TYPE_EXISTS, BPF_CORE_TYPE_SIZE, BPF_CORE_ENUMVAL_EXISTS, BPF_CORE_ENUMVAL_VALUE, BPF_CORE_TYPE_MATCHES
bpf_obj_get_flags = BPF_F_PATH_FD, BPF_F_RDONLY, BPF_F_WRONLY
bpf_cgroup_iter_order = BPF_CGROUP_ITER_SELF_ONLY, BPF_CGROUP_ITER_DESCENDANTS_PRE, BPF_CGROUP_ITER_DESCENDANTS_POST, BPF_CGROUP_ITER_ANCESTORS_UP
bpf_link_create_kprobe_multi_flags = BPF_F_KPROBE_MULTI_RETURN
nf_dev_hooks = NF_NETDEV_INGRESS, NF_NETDEV_EGRESS
bpf_link_create_netfilter_flags = BPF_F_NETFILTER_IP_DEFRAG
bpf_link_create_uprobe_multi_flags = BPF_F_UPROBE_MULTI_RETURN
btf_load_flags = BPF_F_TOKEN_FD
btf_linkage_values = BTF_VAR_STATIC, BTF_VAR_GLOBAL_ALLOCATED, BTF_VAR_GLOBAL_EXTERN
