diff options
Diffstat (limited to 'net/ipv4/tcp.c')
| -rw-r--r-- | net/ipv4/tcp.c | 12 | 
1 files changed, 12 insertions, 0 deletions
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index de7cc8445ac0..e14fd0c50c10 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -267,6 +267,7 @@  #include <linux/slab.h>  #include <linux/errqueue.h>  #include <linux/static_key.h> +#include <linux/btf.h>  #include <net/icmp.h>  #include <net/inet_common.h> @@ -2587,6 +2588,17 @@ void tcp_set_state(struct sock *sk, int state)  	BUILD_BUG_ON((int)BPF_TCP_NEW_SYN_RECV != (int)TCP_NEW_SYN_RECV);  	BUILD_BUG_ON((int)BPF_TCP_MAX_STATES != (int)TCP_MAX_STATES); +	/* bpf uapi header bpf.h defines an anonymous enum with values +	 * BPF_TCP_* used by bpf programs. Currently gcc built vmlinux +	 * is able to emit this enum in DWARF due to the above BUILD_BUG_ON. +	 * But clang built vmlinux does not have this enum in DWARF +	 * since clang removes the above code before generating IR/debuginfo. +	 * Let us explicitly emit the type debuginfo to ensure the +	 * above-mentioned anonymous enum in the vmlinux DWARF and hence BTF +	 * regardless of which compiler is used. +	 */ +	BTF_TYPE_EMIT_ENUM(BPF_TCP_ESTABLISHED); +  	if (BPF_SOCK_OPS_TEST_FLAG(tcp_sk(sk), BPF_SOCK_OPS_STATE_CB_FLAG))  		tcp_call_bpf_2arg(sk, BPF_SOCK_OPS_STATE_CB, oldstate, state);  |