From 98889049283a05a1b41093739621b9606e7c3ca3 Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Tue, 7 Nov 2023 10:52:22 +0100 Subject: [PATCH] unix: update BPF constants for Linux kernel 6.6 This re-adds BPF_F_KPROBE_MULTI_RETURN which was removed by CL 538378 because it was changed from a #define to an enum in the upstream bpf.h header, see https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=c5487f8d9186 Fixes golang/go#63969 Change-Id: Icbf180d8fb8d51fd2fa4a29a615f7071abda9a8b Reviewed-on: https://go-review.googlesource.com/c/sys/+/540395 Reviewed-by: Heschi Kreinick Auto-Submit: Tobias Klauser Reviewed-by: Bryan Mills LUCI-TryBot-Result: Go LUCI Reviewed-by: Mauri de Souza Meneguzzo --- unix/linux/types.go | 26 ++++++++++++++++++++++++++ unix/mkerrors.sh | 2 +- unix/zerrors_linux.go | 1 - unix/ztypes_linux.go | 26 ++++++++++++++++++++++++++ 4 files changed, 53 insertions(+), 2 deletions(-) diff --git a/unix/linux/types.go b/unix/linux/types.go index dcf69cd05..47c06ee76 100644 --- a/unix/linux/types.go +++ b/unix/linux/types.go @@ -2707,6 +2707,7 @@ const ( BPF_PROG_TYPE_LSM = C.BPF_PROG_TYPE_LSM BPF_PROG_TYPE_SK_LOOKUP = C.BPF_PROG_TYPE_SK_LOOKUP BPF_PROG_TYPE_SYSCALL = C.BPF_PROG_TYPE_SYSCALL + BPF_PROG_TYPE_NETFILTER = C.BPF_PROG_TYPE_NETFILTER BPF_CGROUP_INET_INGRESS = C.BPF_CGROUP_INET_INGRESS BPF_CGROUP_INET_EGRESS = C.BPF_CGROUP_INET_EGRESS BPF_CGROUP_INET_SOCK_CREATE = C.BPF_CGROUP_INET_SOCK_CREATE @@ -2751,6 +2752,11 @@ const ( BPF_PERF_EVENT = C.BPF_PERF_EVENT BPF_TRACE_KPROBE_MULTI = C.BPF_TRACE_KPROBE_MULTI BPF_LSM_CGROUP = C.BPF_LSM_CGROUP + BPF_STRUCT_OPS = C.BPF_STRUCT_OPS + BPF_NETFILTER = C.BPF_NETFILTER + BPF_TCX_INGRESS = C.BPF_TCX_INGRESS + BPF_TCX_EGRESS = C.BPF_TCX_EGRESS + BPF_TRACE_UPROBE_MULTI = C.BPF_TRACE_UPROBE_MULTI BPF_LINK_TYPE_UNSPEC = C.BPF_LINK_TYPE_UNSPEC BPF_LINK_TYPE_RAW_TRACEPOINT = C.BPF_LINK_TYPE_RAW_TRACEPOINT BPF_LINK_TYPE_TRACING = C.BPF_LINK_TYPE_TRACING @@ -2761,6 +2767,18 @@ const ( BPF_LINK_TYPE_PERF_EVENT = C.BPF_LINK_TYPE_PERF_EVENT BPF_LINK_TYPE_KPROBE_MULTI = C.BPF_LINK_TYPE_KPROBE_MULTI BPF_LINK_TYPE_STRUCT_OPS = C.BPF_LINK_TYPE_STRUCT_OPS + BPF_LINK_TYPE_NETFILTER = C.BPF_LINK_TYPE_NETFILTER + BPF_LINK_TYPE_TCX = C.BPF_LINK_TYPE_TCX + BPF_LINK_TYPE_UPROBE_MULTI = C.BPF_LINK_TYPE_UPROBE_MULTI + BPF_PERF_EVENT_UNSPEC = C.BPF_PERF_EVENT_UNSPEC + BPF_PERF_EVENT_UPROBE = C.BPF_PERF_EVENT_UPROBE + BPF_PERF_EVENT_URETPROBE = C.BPF_PERF_EVENT_URETPROBE + BPF_PERF_EVENT_KPROBE = C.BPF_PERF_EVENT_KPROBE + BPF_PERF_EVENT_KRETPROBE = C.BPF_PERF_EVENT_KRETPROBE + BPF_PERF_EVENT_TRACEPOINT = C.BPF_PERF_EVENT_TRACEPOINT + BPF_PERF_EVENT_EVENT = C.BPF_PERF_EVENT_EVENT + BPF_F_KPROBE_MULTI_RETURN = C.BPF_F_KPROBE_MULTI_RETURN + BPF_F_UPROBE_MULTI_RETURN = C.BPF_F_UPROBE_MULTI_RETURN BPF_ANY = C.BPF_ANY BPF_NOEXIST = C.BPF_NOEXIST BPF_EXIST = C.BPF_EXIST @@ -2778,6 +2796,8 @@ const ( BPF_F_MMAPABLE = C.BPF_F_MMAPABLE BPF_F_PRESERVE_ELEMS = C.BPF_F_PRESERVE_ELEMS BPF_F_INNER_MAP = C.BPF_F_INNER_MAP + BPF_F_LINK = C.BPF_F_LINK + BPF_F_PATH_FD = C.BPF_F_PATH_FD BPF_STATS_RUN_TIME = C.BPF_STATS_RUN_TIME BPF_STACK_BUILD_ID_EMPTY = C.BPF_STACK_BUILD_ID_EMPTY BPF_STACK_BUILD_ID_VALID = C.BPF_STACK_BUILD_ID_VALID @@ -2798,6 +2818,7 @@ const ( BPF_F_ZERO_CSUM_TX = C.BPF_F_ZERO_CSUM_TX BPF_F_DONT_FRAGMENT = C.BPF_F_DONT_FRAGMENT BPF_F_SEQ_NUMBER = C.BPF_F_SEQ_NUMBER + BPF_F_NO_TUNNEL_KEY = C.BPF_F_NO_TUNNEL_KEY BPF_F_TUNINFO_FLAGS = C.BPF_F_TUNINFO_FLAGS BPF_F_INDEX_MASK = C.BPF_F_INDEX_MASK BPF_F_CURRENT_CPU = C.BPF_F_CURRENT_CPU @@ -2814,6 +2835,8 @@ const ( BPF_F_ADJ_ROOM_ENCAP_L4_UDP = C.BPF_F_ADJ_ROOM_ENCAP_L4_UDP BPF_F_ADJ_ROOM_NO_CSUM_RESET = C.BPF_F_ADJ_ROOM_NO_CSUM_RESET BPF_F_ADJ_ROOM_ENCAP_L2_ETH = C.BPF_F_ADJ_ROOM_ENCAP_L2_ETH + BPF_F_ADJ_ROOM_DECAP_L3_IPV4 = C.BPF_F_ADJ_ROOM_DECAP_L3_IPV4 + BPF_F_ADJ_ROOM_DECAP_L3_IPV6 = C.BPF_F_ADJ_ROOM_DECAP_L3_IPV6 BPF_ADJ_ROOM_ENCAP_L2_MASK = C.BPF_ADJ_ROOM_ENCAP_L2_MASK BPF_ADJ_ROOM_ENCAP_L2_SHIFT = C.BPF_ADJ_ROOM_ENCAP_L2_SHIFT BPF_F_SYSCTL_BASE_NAME = C.BPF_F_SYSCTL_BASE_NAME @@ -2902,6 +2925,8 @@ const ( BPF_DEVCG_DEV_CHAR = C.BPF_DEVCG_DEV_CHAR BPF_FIB_LOOKUP_DIRECT = C.BPF_FIB_LOOKUP_DIRECT BPF_FIB_LOOKUP_OUTPUT = C.BPF_FIB_LOOKUP_OUTPUT + BPF_FIB_LOOKUP_SKIP_NEIGH = C.BPF_FIB_LOOKUP_SKIP_NEIGH + BPF_FIB_LOOKUP_TBID = C.BPF_FIB_LOOKUP_TBID BPF_FIB_LKUP_RET_SUCCESS = C.BPF_FIB_LKUP_RET_SUCCESS BPF_FIB_LKUP_RET_BLACKHOLE = C.BPF_FIB_LKUP_RET_BLACKHOLE BPF_FIB_LKUP_RET_UNREACHABLE = C.BPF_FIB_LKUP_RET_UNREACHABLE @@ -2937,6 +2962,7 @@ const ( BPF_CORE_ENUMVAL_EXISTS = C.BPF_CORE_ENUMVAL_EXISTS BPF_CORE_ENUMVAL_VALUE = C.BPF_CORE_ENUMVAL_VALUE BPF_CORE_TYPE_MATCHES = C.BPF_CORE_TYPE_MATCHES + BPF_F_TIMER_ABS = C.BPF_F_TIMER_ABS ) // generated by: diff --git a/unix/mkerrors.sh b/unix/mkerrors.sh index cbe24150a..5dda44503 100755 --- a/unix/mkerrors.sh +++ b/unix/mkerrors.sh @@ -560,7 +560,7 @@ ccflags="$@" $2 ~ /^RLIMIT_(AS|CORE|CPU|DATA|FSIZE|LOCKS|MEMLOCK|MSGQUEUE|NICE|NOFILE|NPROC|RSS|RTPRIO|RTTIME|SIGPENDING|STACK)|RLIM_INFINITY/ || $2 ~ /^PRIO_(PROCESS|PGRP|USER)/ || $2 ~ /^CLONE_[A-Z_]+/ || - $2 !~ /^(BPF_TIMEVAL|BPF_FIB_LOOKUP_[A-Z]+)$/ && + $2 !~ /^(BPF_TIMEVAL|BPF_FIB_LOOKUP_[A-Z]+|BPF_F_LINK)$/ && $2 ~ /^(BPF|DLT)_/ || $2 ~ /^AUDIT_/ || $2 ~ /^(CLOCK|TIMER)_/ || diff --git a/unix/zerrors_linux.go b/unix/zerrors_linux.go index 9c00cbf51..1781cfca3 100644 --- a/unix/zerrors_linux.go +++ b/unix/zerrors_linux.go @@ -486,7 +486,6 @@ const ( BPF_F_ANY_ALIGNMENT = 0x2 BPF_F_BEFORE = 0x8 BPF_F_ID = 0x20 - BPF_F_LINK = 0x2000 BPF_F_NETFILTER_IP_DEFRAG = 0x1 BPF_F_QUERY_EFFECTIVE = 0x1 BPF_F_REPLACE = 0x4 diff --git a/unix/ztypes_linux.go b/unix/ztypes_linux.go index 997bcd55a..b07276a1b 100644 --- a/unix/ztypes_linux.go +++ b/unix/ztypes_linux.go @@ -2671,6 +2671,7 @@ const ( BPF_PROG_TYPE_LSM = 0x1d BPF_PROG_TYPE_SK_LOOKUP = 0x1e BPF_PROG_TYPE_SYSCALL = 0x1f + BPF_PROG_TYPE_NETFILTER = 0x20 BPF_CGROUP_INET_INGRESS = 0x0 BPF_CGROUP_INET_EGRESS = 0x1 BPF_CGROUP_INET_SOCK_CREATE = 0x2 @@ -2715,6 +2716,11 @@ const ( BPF_PERF_EVENT = 0x29 BPF_TRACE_KPROBE_MULTI = 0x2a BPF_LSM_CGROUP = 0x2b + BPF_STRUCT_OPS = 0x2c + BPF_NETFILTER = 0x2d + BPF_TCX_INGRESS = 0x2e + BPF_TCX_EGRESS = 0x2f + BPF_TRACE_UPROBE_MULTI = 0x30 BPF_LINK_TYPE_UNSPEC = 0x0 BPF_LINK_TYPE_RAW_TRACEPOINT = 0x1 BPF_LINK_TYPE_TRACING = 0x2 @@ -2725,6 +2731,18 @@ const ( BPF_LINK_TYPE_PERF_EVENT = 0x7 BPF_LINK_TYPE_KPROBE_MULTI = 0x8 BPF_LINK_TYPE_STRUCT_OPS = 0x9 + BPF_LINK_TYPE_NETFILTER = 0xa + BPF_LINK_TYPE_TCX = 0xb + BPF_LINK_TYPE_UPROBE_MULTI = 0xc + BPF_PERF_EVENT_UNSPEC = 0x0 + BPF_PERF_EVENT_UPROBE = 0x1 + BPF_PERF_EVENT_URETPROBE = 0x2 + BPF_PERF_EVENT_KPROBE = 0x3 + BPF_PERF_EVENT_KRETPROBE = 0x4 + BPF_PERF_EVENT_TRACEPOINT = 0x5 + BPF_PERF_EVENT_EVENT = 0x6 + BPF_F_KPROBE_MULTI_RETURN = 0x1 + BPF_F_UPROBE_MULTI_RETURN = 0x1 BPF_ANY = 0x0 BPF_NOEXIST = 0x1 BPF_EXIST = 0x2 @@ -2742,6 +2760,8 @@ const ( BPF_F_MMAPABLE = 0x400 BPF_F_PRESERVE_ELEMS = 0x800 BPF_F_INNER_MAP = 0x1000 + BPF_F_LINK = 0x2000 + BPF_F_PATH_FD = 0x4000 BPF_STATS_RUN_TIME = 0x0 BPF_STACK_BUILD_ID_EMPTY = 0x0 BPF_STACK_BUILD_ID_VALID = 0x1 @@ -2762,6 +2782,7 @@ const ( BPF_F_ZERO_CSUM_TX = 0x2 BPF_F_DONT_FRAGMENT = 0x4 BPF_F_SEQ_NUMBER = 0x8 + BPF_F_NO_TUNNEL_KEY = 0x10 BPF_F_TUNINFO_FLAGS = 0x10 BPF_F_INDEX_MASK = 0xffffffff BPF_F_CURRENT_CPU = 0xffffffff @@ -2778,6 +2799,8 @@ const ( BPF_F_ADJ_ROOM_ENCAP_L4_UDP = 0x10 BPF_F_ADJ_ROOM_NO_CSUM_RESET = 0x20 BPF_F_ADJ_ROOM_ENCAP_L2_ETH = 0x40 + BPF_F_ADJ_ROOM_DECAP_L3_IPV4 = 0x80 + BPF_F_ADJ_ROOM_DECAP_L3_IPV6 = 0x100 BPF_ADJ_ROOM_ENCAP_L2_MASK = 0xff BPF_ADJ_ROOM_ENCAP_L2_SHIFT = 0x38 BPF_F_SYSCTL_BASE_NAME = 0x1 @@ -2866,6 +2889,8 @@ const ( BPF_DEVCG_DEV_CHAR = 0x2 BPF_FIB_LOOKUP_DIRECT = 0x1 BPF_FIB_LOOKUP_OUTPUT = 0x2 + BPF_FIB_LOOKUP_SKIP_NEIGH = 0x4 + BPF_FIB_LOOKUP_TBID = 0x8 BPF_FIB_LKUP_RET_SUCCESS = 0x0 BPF_FIB_LKUP_RET_BLACKHOLE = 0x1 BPF_FIB_LKUP_RET_UNREACHABLE = 0x2 @@ -2901,6 +2926,7 @@ const ( BPF_CORE_ENUMVAL_EXISTS = 0xa BPF_CORE_ENUMVAL_VALUE = 0xb BPF_CORE_TYPE_MATCHES = 0xc + BPF_F_TIMER_ABS = 0x1 ) const (