Message ID | 20211007202319.1153540-1-davemarchevsky@fb.com (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | BPF |
Headers | show |
Series | [bpf-next] selftests/bpf: remove SEC("version") from test progs | expand |
On 10/7/21 10:23 PM, Dave Marchevsky wrote: > Since commit 6c4fc209fcf9d ("bpf: remove useless version check for prog > load") these "version" sections, which result in bpf_attr.kern_version > being set, have been unnecessary. > > Remove them so that it's obvious to folks using selftests as a guide that > "modern" BPF progs don't need this section. > > Signed-off-by: Dave Marchevsky <davemarchevsky@fb.com> > --- > tools/testing/selftests/bpf/progs/cgroup_skb_sk_lookup_kern.c | 1 - > tools/testing/selftests/bpf/progs/connect4_prog.c | 1 - > tools/testing/selftests/bpf/progs/connect6_prog.c | 1 - > tools/testing/selftests/bpf/progs/connect_force_port4.c | 1 - > tools/testing/selftests/bpf/progs/connect_force_port6.c | 1 - > tools/testing/selftests/bpf/progs/dev_cgroup.c | 1 - > tools/testing/selftests/bpf/progs/get_cgroup_id_kern.c | 1 - > tools/testing/selftests/bpf/progs/map_ptr_kern.c | 1 - > tools/testing/selftests/bpf/progs/netcnt_prog.c | 1 - > tools/testing/selftests/bpf/progs/sendmsg4_prog.c | 1 - > tools/testing/selftests/bpf/progs/sendmsg6_prog.c | 1 - > tools/testing/selftests/bpf/progs/sockmap_parse_prog.c | 1 - > tools/testing/selftests/bpf/progs/sockmap_tcp_msg_prog.c | 1 - > tools/testing/selftests/bpf/progs/sockmap_verdict_prog.c | 1 - > tools/testing/selftests/bpf/progs/sockopt_inherit.c | 1 - > tools/testing/selftests/bpf/progs/tcp_rtt.c | 1 - > tools/testing/selftests/bpf/progs/test_btf_haskv.c | 1 - > tools/testing/selftests/bpf/progs/test_btf_newkv.c | 1 - > tools/testing/selftests/bpf/progs/test_btf_nokv.c | 1 - > tools/testing/selftests/bpf/progs/test_l4lb.c | 1 - > tools/testing/selftests/bpf/progs/test_map_in_map.c | 1 - > tools/testing/selftests/bpf/progs/test_pinning.c | 1 - > tools/testing/selftests/bpf/progs/test_pinning_invalid.c | 1 - > tools/testing/selftests/bpf/progs/test_pkt_access.c | 1 - > tools/testing/selftests/bpf/progs/test_queue_stack_map.h | 1 - > tools/testing/selftests/bpf/progs/test_select_reuseport_kern.c | 1 - > tools/testing/selftests/bpf/progs/test_sk_lookup.c | 1 - > tools/testing/selftests/bpf/progs/test_skb_cgroup_id_kern.c | 1 - > tools/testing/selftests/bpf/progs/test_skb_ctx.c | 1 - > tools/testing/selftests/bpf/progs/test_sockmap_kern.h | 1 - > tools/testing/selftests/bpf/progs/test_sockmap_listen.c | 1 - > tools/testing/selftests/bpf/progs/test_stacktrace_build_id.c | 1 - > tools/testing/selftests/bpf/progs/test_static_linked1.c | 1 - > tools/testing/selftests/bpf/progs/test_static_linked2.c | 1 - > tools/testing/selftests/bpf/progs/test_tcp_estats.c | 1 - > tools/testing/selftests/bpf/progs/test_tcpbpf_kern.c | 1 - > tools/testing/selftests/bpf/progs/test_tcpnotify_kern.c | 1 - > tools/testing/selftests/bpf/progs/test_tracepoint.c | 1 - > tools/testing/selftests/bpf/progs/test_tunnel_kern.c | 1 - > tools/testing/selftests/bpf/progs/test_xdp.c | 1 - > tools/testing/selftests/bpf/progs/test_xdp_loop.c | 1 - > tools/testing/selftests/bpf/progs/test_xdp_redirect.c | 1 - > 42 files changed, 42 deletions(-) > > diff --git a/tools/testing/selftests/bpf/progs/cgroup_skb_sk_lookup_kern.c b/tools/testing/selftests/bpf/progs/cgroup_skb_sk_lookup_kern.c > index 3f757e30d7a0..88638315c582 100644 > --- a/tools/testing/selftests/bpf/progs/cgroup_skb_sk_lookup_kern.c > +++ b/tools/testing/selftests/bpf/progs/cgroup_skb_sk_lookup_kern.c > @@ -14,7 +14,6 @@ > #include <sys/types.h> > #include <sys/socket.h> > > -int _version SEC("version") = 1; > char _license[] SEC("license") = "GPL"; > > __u16 g_serv_port = 0; > diff --git a/tools/testing/selftests/bpf/progs/connect4_prog.c b/tools/testing/selftests/bpf/progs/connect4_prog.c > index a943d394fd3a..cf432a527d49 100644 > --- a/tools/testing/selftests/bpf/progs/connect4_prog.c > +++ b/tools/testing/selftests/bpf/progs/connect4_prog.c > @@ -31,7 +31,6 @@ > #define IFNAMSIZ 16 > #endif > > -int _version SEC("version") = 1; > Overall looks good, small nit: please don't leave a double newline after the removal (here and in other places). > __attribute__ ((noinline)) > int do_bind(struct bpf_sock_addr *ctx)
On Thu, Oct 7, 2021 at 2:00 PM Daniel Borkmann <daniel@iogearbox.net> wrote: > > On 10/7/21 10:23 PM, Dave Marchevsky wrote: > > Since commit 6c4fc209fcf9d ("bpf: remove useless version check for prog > > load") these "version" sections, which result in bpf_attr.kern_version > > being set, have been unnecessary. > > > > Remove them so that it's obvious to folks using selftests as a guide that > > "modern" BPF progs don't need this section. > > > > Signed-off-by: Dave Marchevsky <davemarchevsky@fb.com> > > --- > > tools/testing/selftests/bpf/progs/cgroup_skb_sk_lookup_kern.c | 1 - > > tools/testing/selftests/bpf/progs/connect4_prog.c | 1 - > > tools/testing/selftests/bpf/progs/connect6_prog.c | 1 - > > tools/testing/selftests/bpf/progs/connect_force_port4.c | 1 - > > tools/testing/selftests/bpf/progs/connect_force_port6.c | 1 - > > tools/testing/selftests/bpf/progs/dev_cgroup.c | 1 - > > tools/testing/selftests/bpf/progs/get_cgroup_id_kern.c | 1 - > > tools/testing/selftests/bpf/progs/map_ptr_kern.c | 1 - > > tools/testing/selftests/bpf/progs/netcnt_prog.c | 1 - > > tools/testing/selftests/bpf/progs/sendmsg4_prog.c | 1 - > > tools/testing/selftests/bpf/progs/sendmsg6_prog.c | 1 - > > tools/testing/selftests/bpf/progs/sockmap_parse_prog.c | 1 - > > tools/testing/selftests/bpf/progs/sockmap_tcp_msg_prog.c | 1 - > > tools/testing/selftests/bpf/progs/sockmap_verdict_prog.c | 1 - > > tools/testing/selftests/bpf/progs/sockopt_inherit.c | 1 - > > tools/testing/selftests/bpf/progs/tcp_rtt.c | 1 - > > tools/testing/selftests/bpf/progs/test_btf_haskv.c | 1 - > > tools/testing/selftests/bpf/progs/test_btf_newkv.c | 1 - > > tools/testing/selftests/bpf/progs/test_btf_nokv.c | 1 - > > tools/testing/selftests/bpf/progs/test_l4lb.c | 1 - > > tools/testing/selftests/bpf/progs/test_map_in_map.c | 1 - > > tools/testing/selftests/bpf/progs/test_pinning.c | 1 - > > tools/testing/selftests/bpf/progs/test_pinning_invalid.c | 1 - > > tools/testing/selftests/bpf/progs/test_pkt_access.c | 1 - > > tools/testing/selftests/bpf/progs/test_queue_stack_map.h | 1 - > > tools/testing/selftests/bpf/progs/test_select_reuseport_kern.c | 1 - > > tools/testing/selftests/bpf/progs/test_sk_lookup.c | 1 - > > tools/testing/selftests/bpf/progs/test_skb_cgroup_id_kern.c | 1 - > > tools/testing/selftests/bpf/progs/test_skb_ctx.c | 1 - > > tools/testing/selftests/bpf/progs/test_sockmap_kern.h | 1 - > > tools/testing/selftests/bpf/progs/test_sockmap_listen.c | 1 - > > tools/testing/selftests/bpf/progs/test_stacktrace_build_id.c | 1 - > > tools/testing/selftests/bpf/progs/test_static_linked1.c | 1 - > > tools/testing/selftests/bpf/progs/test_static_linked2.c | 1 - > > tools/testing/selftests/bpf/progs/test_tcp_estats.c | 1 - > > tools/testing/selftests/bpf/progs/test_tcpbpf_kern.c | 1 - > > tools/testing/selftests/bpf/progs/test_tcpnotify_kern.c | 1 - > > tools/testing/selftests/bpf/progs/test_tracepoint.c | 1 - > > tools/testing/selftests/bpf/progs/test_tunnel_kern.c | 1 - > > tools/testing/selftests/bpf/progs/test_xdp.c | 1 - > > tools/testing/selftests/bpf/progs/test_xdp_loop.c | 1 - > > tools/testing/selftests/bpf/progs/test_xdp_redirect.c | 1 - > > 42 files changed, 42 deletions(-) > > > > diff --git a/tools/testing/selftests/bpf/progs/cgroup_skb_sk_lookup_kern.c b/tools/testing/selftests/bpf/progs/cgroup_skb_sk_lookup_kern.c > > index 3f757e30d7a0..88638315c582 100644 > > --- a/tools/testing/selftests/bpf/progs/cgroup_skb_sk_lookup_kern.c > > +++ b/tools/testing/selftests/bpf/progs/cgroup_skb_sk_lookup_kern.c > > @@ -14,7 +14,6 @@ > > #include <sys/types.h> > > #include <sys/socket.h> > > > > -int _version SEC("version") = 1; > > char _license[] SEC("license") = "GPL"; > > > > __u16 g_serv_port = 0; > > diff --git a/tools/testing/selftests/bpf/progs/connect4_prog.c b/tools/testing/selftests/bpf/progs/connect4_prog.c > > index a943d394fd3a..cf432a527d49 100644 > > --- a/tools/testing/selftests/bpf/progs/connect4_prog.c > > +++ b/tools/testing/selftests/bpf/progs/connect4_prog.c > > @@ -31,7 +31,6 @@ > > #define IFNAMSIZ 16 > > #endif > > > > -int _version SEC("version") = 1; > > > > Overall looks good, small nit: please don't leave a double newline after the > removal (here and in other places). > Also please don't remove version from test_static_linked tests. They are there explicitly to test that static linker handles it properly. > > __attribute__ ((noinline)) > > int do_bind(struct bpf_sock_addr *ctx)
diff --git a/tools/testing/selftests/bpf/progs/cgroup_skb_sk_lookup_kern.c b/tools/testing/selftests/bpf/progs/cgroup_skb_sk_lookup_kern.c index 3f757e30d7a0..88638315c582 100644 --- a/tools/testing/selftests/bpf/progs/cgroup_skb_sk_lookup_kern.c +++ b/tools/testing/selftests/bpf/progs/cgroup_skb_sk_lookup_kern.c @@ -14,7 +14,6 @@ #include <sys/types.h> #include <sys/socket.h> -int _version SEC("version") = 1; char _license[] SEC("license") = "GPL"; __u16 g_serv_port = 0; diff --git a/tools/testing/selftests/bpf/progs/connect4_prog.c b/tools/testing/selftests/bpf/progs/connect4_prog.c index a943d394fd3a..cf432a527d49 100644 --- a/tools/testing/selftests/bpf/progs/connect4_prog.c +++ b/tools/testing/selftests/bpf/progs/connect4_prog.c @@ -31,7 +31,6 @@ #define IFNAMSIZ 16 #endif -int _version SEC("version") = 1; __attribute__ ((noinline)) int do_bind(struct bpf_sock_addr *ctx) diff --git a/tools/testing/selftests/bpf/progs/connect6_prog.c b/tools/testing/selftests/bpf/progs/connect6_prog.c index 506d0f81a375..612aa5d39db0 100644 --- a/tools/testing/selftests/bpf/progs/connect6_prog.c +++ b/tools/testing/selftests/bpf/progs/connect6_prog.c @@ -24,7 +24,6 @@ #define DST_REWRITE_PORT6 6666 -int _version SEC("version") = 1; SEC("cgroup/connect6") int connect_v6_prog(struct bpf_sock_addr *ctx) diff --git a/tools/testing/selftests/bpf/progs/connect_force_port4.c b/tools/testing/selftests/bpf/progs/connect_force_port4.c index a979aaef2a76..27a632dd382e 100644 --- a/tools/testing/selftests/bpf/progs/connect_force_port4.c +++ b/tools/testing/selftests/bpf/progs/connect_force_port4.c @@ -13,7 +13,6 @@ #include <bpf_sockopt_helpers.h> char _license[] SEC("license") = "GPL"; -int _version SEC("version") = 1; struct svc_addr { __be32 addr; diff --git a/tools/testing/selftests/bpf/progs/connect_force_port6.c b/tools/testing/selftests/bpf/progs/connect_force_port6.c index afc8f1c5a9d6..19cad93e612f 100644 --- a/tools/testing/selftests/bpf/progs/connect_force_port6.c +++ b/tools/testing/selftests/bpf/progs/connect_force_port6.c @@ -12,7 +12,6 @@ #include <bpf_sockopt_helpers.h> char _license[] SEC("license") = "GPL"; -int _version SEC("version") = 1; struct svc_addr { __be32 addr[4]; diff --git a/tools/testing/selftests/bpf/progs/dev_cgroup.c b/tools/testing/selftests/bpf/progs/dev_cgroup.c index 8924e06bdef0..79b54a4fa244 100644 --- a/tools/testing/selftests/bpf/progs/dev_cgroup.c +++ b/tools/testing/selftests/bpf/progs/dev_cgroup.c @@ -57,4 +57,3 @@ int bpf_prog1(struct bpf_cgroup_dev_ctx *ctx) } char _license[] SEC("license") = "GPL"; -__u32 _version SEC("version") = LINUX_VERSION_CODE; diff --git a/tools/testing/selftests/bpf/progs/get_cgroup_id_kern.c b/tools/testing/selftests/bpf/progs/get_cgroup_id_kern.c index 6b42db2fe391..68587b1de34e 100644 --- a/tools/testing/selftests/bpf/progs/get_cgroup_id_kern.c +++ b/tools/testing/selftests/bpf/progs/get_cgroup_id_kern.c @@ -37,4 +37,3 @@ int trace(void *ctx) } char _license[] SEC("license") = "GPL"; -__u32 _version SEC("version") = 1; /* ignored by tracepoints, required by libbpf.a */ diff --git a/tools/testing/selftests/bpf/progs/map_ptr_kern.c b/tools/testing/selftests/bpf/progs/map_ptr_kern.c index d1d304c980f0..b1b711d9b214 100644 --- a/tools/testing/selftests/bpf/progs/map_ptr_kern.c +++ b/tools/testing/selftests/bpf/progs/map_ptr_kern.c @@ -683,5 +683,4 @@ int cg_skb(void *ctx) return 1; } -__u32 _version SEC("version") = 1; char _license[] SEC("license") = "GPL"; diff --git a/tools/testing/selftests/bpf/progs/netcnt_prog.c b/tools/testing/selftests/bpf/progs/netcnt_prog.c index 43649bce4c54..f718b2c212dc 100644 --- a/tools/testing/selftests/bpf/progs/netcnt_prog.c +++ b/tools/testing/selftests/bpf/progs/netcnt_prog.c @@ -68,4 +68,3 @@ int bpf_nextcnt(struct __sk_buff *skb) } char _license[] SEC("license") = "GPL"; -__u32 _version SEC("version") = LINUX_VERSION_CODE; diff --git a/tools/testing/selftests/bpf/progs/sendmsg4_prog.c b/tools/testing/selftests/bpf/progs/sendmsg4_prog.c index ac5abc34cde8..2c24e7bb6747 100644 --- a/tools/testing/selftests/bpf/progs/sendmsg4_prog.c +++ b/tools/testing/selftests/bpf/progs/sendmsg4_prog.c @@ -18,7 +18,6 @@ #define DST_PORT 4040 #define DST_REWRITE_PORT4 4444 -int _version SEC("version") = 1; SEC("cgroup/sendmsg4") int sendmsg_v4_prog(struct bpf_sock_addr *ctx) diff --git a/tools/testing/selftests/bpf/progs/sendmsg6_prog.c b/tools/testing/selftests/bpf/progs/sendmsg6_prog.c index 24694b1a8d82..f85a08c996f4 100644 --- a/tools/testing/selftests/bpf/progs/sendmsg6_prog.c +++ b/tools/testing/selftests/bpf/progs/sendmsg6_prog.c @@ -22,7 +22,6 @@ #define DST_REWRITE_PORT6 6666 -int _version SEC("version") = 1; SEC("cgroup/sendmsg6") int sendmsg_v6_prog(struct bpf_sock_addr *ctx) diff --git a/tools/testing/selftests/bpf/progs/sockmap_parse_prog.c b/tools/testing/selftests/bpf/progs/sockmap_parse_prog.c index ca283af80d4e..b82ebc5b2644 100644 --- a/tools/testing/selftests/bpf/progs/sockmap_parse_prog.c +++ b/tools/testing/selftests/bpf/progs/sockmap_parse_prog.c @@ -2,7 +2,6 @@ #include <bpf/bpf_helpers.h> #include <bpf/bpf_endian.h> -int _version SEC("version") = 1; SEC("sk_skb1") int bpf_prog1(struct __sk_buff *skb) diff --git a/tools/testing/selftests/bpf/progs/sockmap_tcp_msg_prog.c b/tools/testing/selftests/bpf/progs/sockmap_tcp_msg_prog.c index eeaf6e75c9a2..20869422d373 100644 --- a/tools/testing/selftests/bpf/progs/sockmap_tcp_msg_prog.c +++ b/tools/testing/selftests/bpf/progs/sockmap_tcp_msg_prog.c @@ -3,7 +3,6 @@ #include <bpf/bpf_helpers.h> #include <bpf/bpf_endian.h> -int _version SEC("version") = 1; SEC("sk_msg1") int bpf_prog1(struct sk_msg_md *msg) diff --git a/tools/testing/selftests/bpf/progs/sockmap_verdict_prog.c b/tools/testing/selftests/bpf/progs/sockmap_verdict_prog.c index 73872c535cbb..f2f4c84a806b 100644 --- a/tools/testing/selftests/bpf/progs/sockmap_verdict_prog.c +++ b/tools/testing/selftests/bpf/progs/sockmap_verdict_prog.c @@ -2,7 +2,6 @@ #include <bpf/bpf_helpers.h> #include <bpf/bpf_endian.h> -int _version SEC("version") = 1; struct { __uint(type, BPF_MAP_TYPE_SOCKMAP); diff --git a/tools/testing/selftests/bpf/progs/sockopt_inherit.c b/tools/testing/selftests/bpf/progs/sockopt_inherit.c index c6d428a8d785..9fb241b97291 100644 --- a/tools/testing/selftests/bpf/progs/sockopt_inherit.c +++ b/tools/testing/selftests/bpf/progs/sockopt_inherit.c @@ -3,7 +3,6 @@ #include <bpf/bpf_helpers.h> char _license[] SEC("license") = "GPL"; -__u32 _version SEC("version") = 1; #define SOL_CUSTOM 0xdeadbeef #define CUSTOM_INHERIT1 0 diff --git a/tools/testing/selftests/bpf/progs/tcp_rtt.c b/tools/testing/selftests/bpf/progs/tcp_rtt.c index 0cb3204ddb18..0988d79f1587 100644 --- a/tools/testing/selftests/bpf/progs/tcp_rtt.c +++ b/tools/testing/selftests/bpf/progs/tcp_rtt.c @@ -3,7 +3,6 @@ #include <bpf/bpf_helpers.h> char _license[] SEC("license") = "GPL"; -__u32 _version SEC("version") = 1; struct tcp_rtt_storage { __u32 invoked; diff --git a/tools/testing/selftests/bpf/progs/test_btf_haskv.c b/tools/testing/selftests/bpf/progs/test_btf_haskv.c index 31538c9ed193..4f91a81480c8 100644 --- a/tools/testing/selftests/bpf/progs/test_btf_haskv.c +++ b/tools/testing/selftests/bpf/progs/test_btf_haskv.c @@ -4,7 +4,6 @@ #include <bpf/bpf_helpers.h> #include "bpf_legacy.h" -int _version SEC("version") = 1; struct ipv_counts { unsigned int v4; diff --git a/tools/testing/selftests/bpf/progs/test_btf_newkv.c b/tools/testing/selftests/bpf/progs/test_btf_newkv.c index 6c5560162746..d0c2dbd811f2 100644 --- a/tools/testing/selftests/bpf/progs/test_btf_newkv.c +++ b/tools/testing/selftests/bpf/progs/test_btf_newkv.c @@ -4,7 +4,6 @@ #include <bpf/bpf_helpers.h> #include "bpf_legacy.h" -int _version SEC("version") = 1; struct ipv_counts { unsigned int v4; diff --git a/tools/testing/selftests/bpf/progs/test_btf_nokv.c b/tools/testing/selftests/bpf/progs/test_btf_nokv.c index 506da7fd2da2..09d55e0efe5e 100644 --- a/tools/testing/selftests/bpf/progs/test_btf_nokv.c +++ b/tools/testing/selftests/bpf/progs/test_btf_nokv.c @@ -3,7 +3,6 @@ #include <linux/bpf.h> #include <bpf/bpf_helpers.h> -int _version SEC("version") = 1; struct ipv_counts { unsigned int v4; diff --git a/tools/testing/selftests/bpf/progs/test_l4lb.c b/tools/testing/selftests/bpf/progs/test_l4lb.c index 33493911d87a..b51621946f2d 100644 --- a/tools/testing/selftests/bpf/progs/test_l4lb.c +++ b/tools/testing/selftests/bpf/progs/test_l4lb.c @@ -21,7 +21,6 @@ #include "test_iptunnel_common.h" #include <bpf/bpf_endian.h> -int _version SEC("version") = 1; static inline __u32 rol32(__u32 word, unsigned int shift) { diff --git a/tools/testing/selftests/bpf/progs/test_map_in_map.c b/tools/testing/selftests/bpf/progs/test_map_in_map.c index a6d91932dcd5..f416032ba858 100644 --- a/tools/testing/selftests/bpf/progs/test_map_in_map.c +++ b/tools/testing/selftests/bpf/progs/test_map_in_map.c @@ -47,5 +47,4 @@ int xdp_mimtest0(struct xdp_md *ctx) return XDP_PASS; } -int _version SEC("version") = 1; char _license[] SEC("license") = "GPL"; diff --git a/tools/testing/selftests/bpf/progs/test_pinning.c b/tools/testing/selftests/bpf/progs/test_pinning.c index 4ef2630292b2..eff949ecc100 100644 --- a/tools/testing/selftests/bpf/progs/test_pinning.c +++ b/tools/testing/selftests/bpf/progs/test_pinning.c @@ -3,7 +3,6 @@ #include <linux/bpf.h> #include <bpf/bpf_helpers.h> -int _version SEC("version") = 1; struct { __uint(type, BPF_MAP_TYPE_ARRAY); diff --git a/tools/testing/selftests/bpf/progs/test_pinning_invalid.c b/tools/testing/selftests/bpf/progs/test_pinning_invalid.c index 5412e0c732c7..248442a06938 100644 --- a/tools/testing/selftests/bpf/progs/test_pinning_invalid.c +++ b/tools/testing/selftests/bpf/progs/test_pinning_invalid.c @@ -3,7 +3,6 @@ #include <linux/bpf.h> #include <bpf/bpf_helpers.h> -int _version SEC("version") = 1; struct { __uint(type, BPF_MAP_TYPE_ARRAY); diff --git a/tools/testing/selftests/bpf/progs/test_pkt_access.c b/tools/testing/selftests/bpf/progs/test_pkt_access.c index 3cfd88141ddc..0558544e1ff0 100644 --- a/tools/testing/selftests/bpf/progs/test_pkt_access.c +++ b/tools/testing/selftests/bpf/progs/test_pkt_access.c @@ -15,7 +15,6 @@ #include <bpf/bpf_endian.h> #define barrier() __asm__ __volatile__("": : :"memory") -int _version SEC("version") = 1; /* llvm will optimize both subprograms into exactly the same BPF assembly * diff --git a/tools/testing/selftests/bpf/progs/test_queue_stack_map.h b/tools/testing/selftests/bpf/progs/test_queue_stack_map.h index 4dd9806ad73b..4fa32369f188 100644 --- a/tools/testing/selftests/bpf/progs/test_queue_stack_map.h +++ b/tools/testing/selftests/bpf/progs/test_queue_stack_map.h @@ -8,7 +8,6 @@ #include <linux/pkt_cls.h> #include <bpf/bpf_helpers.h> -int _version SEC("version") = 1; struct { __uint(type, MAP_TYPE); diff --git a/tools/testing/selftests/bpf/progs/test_select_reuseport_kern.c b/tools/testing/selftests/bpf/progs/test_select_reuseport_kern.c index 0f9bc258225e..bb1f3a2c06b2 100644 --- a/tools/testing/selftests/bpf/progs/test_select_reuseport_kern.c +++ b/tools/testing/selftests/bpf/progs/test_select_reuseport_kern.c @@ -15,7 +15,6 @@ #include <bpf/bpf_helpers.h> #include "test_select_reuseport_common.h" -int _version SEC("version") = 1; #ifndef offsetof #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) diff --git a/tools/testing/selftests/bpf/progs/test_sk_lookup.c b/tools/testing/selftests/bpf/progs/test_sk_lookup.c index 48534d810391..19d2465d9442 100644 --- a/tools/testing/selftests/bpf/progs/test_sk_lookup.c +++ b/tools/testing/selftests/bpf/progs/test_sk_lookup.c @@ -644,4 +644,3 @@ int multi_prog_redir2(struct bpf_sk_lookup *ctx) } char _license[] SEC("license") = "Dual BSD/GPL"; -__u32 _version SEC("version") = 1; diff --git a/tools/testing/selftests/bpf/progs/test_skb_cgroup_id_kern.c b/tools/testing/selftests/bpf/progs/test_skb_cgroup_id_kern.c index 552f2090665c..46d7ce1d568c 100644 --- a/tools/testing/selftests/bpf/progs/test_skb_cgroup_id_kern.c +++ b/tools/testing/selftests/bpf/progs/test_skb_cgroup_id_kern.c @@ -42,6 +42,5 @@ int log_cgroup_id(struct __sk_buff *skb) return TC_ACT_OK; } -int _version SEC("version") = 1; char _license[] SEC("license") = "GPL"; diff --git a/tools/testing/selftests/bpf/progs/test_skb_ctx.c b/tools/testing/selftests/bpf/progs/test_skb_ctx.c index ba4dab09d19c..1d61b36e6067 100644 --- a/tools/testing/selftests/bpf/progs/test_skb_ctx.c +++ b/tools/testing/selftests/bpf/progs/test_skb_ctx.c @@ -3,7 +3,6 @@ #include <linux/bpf.h> #include <bpf/bpf_helpers.h> -int _version SEC("version") = 1; char _license[] SEC("license") = "GPL"; SEC("skb_ctx") diff --git a/tools/testing/selftests/bpf/progs/test_sockmap_kern.h b/tools/testing/selftests/bpf/progs/test_sockmap_kern.h index 1858435de7aa..2966564b8497 100644 --- a/tools/testing/selftests/bpf/progs/test_sockmap_kern.h +++ b/tools/testing/selftests/bpf/progs/test_sockmap_kern.h @@ -361,5 +361,4 @@ int bpf_prog10(struct sk_msg_md *msg) return SK_DROP; } -int _version SEC("version") = 1; char _license[] SEC("license") = "GPL"; diff --git a/tools/testing/selftests/bpf/progs/test_sockmap_listen.c b/tools/testing/selftests/bpf/progs/test_sockmap_listen.c index 00f1456aaeda..325c9f193432 100644 --- a/tools/testing/selftests/bpf/progs/test_sockmap_listen.c +++ b/tools/testing/selftests/bpf/progs/test_sockmap_listen.c @@ -116,5 +116,4 @@ int prog_reuseport(struct sk_reuseport_md *reuse) return verdict; } -int _version SEC("version") = 1; char _license[] SEC("license") = "GPL"; diff --git a/tools/testing/selftests/bpf/progs/test_stacktrace_build_id.c b/tools/testing/selftests/bpf/progs/test_stacktrace_build_id.c index 7449fdb1763b..36a707e7c7a7 100644 --- a/tools/testing/selftests/bpf/progs/test_stacktrace_build_id.c +++ b/tools/testing/selftests/bpf/progs/test_stacktrace_build_id.c @@ -73,4 +73,3 @@ int oncpu(struct random_urandom_args *args) } char _license[] SEC("license") = "GPL"; -__u32 _version SEC("version") = 1; /* ignored by tracepoints, required by libbpf.a */ diff --git a/tools/testing/selftests/bpf/progs/test_static_linked1.c b/tools/testing/selftests/bpf/progs/test_static_linked1.c index 4f0b612e1661..4c3869bb73c4 100644 --- a/tools/testing/selftests/bpf/progs/test_static_linked1.c +++ b/tools/testing/selftests/bpf/progs/test_static_linked1.c @@ -27,4 +27,3 @@ int handler1(const void *ctx) } char LICENSE[] SEC("license") = "GPL"; -int VERSION SEC("version") = 1; diff --git a/tools/testing/selftests/bpf/progs/test_static_linked2.c b/tools/testing/selftests/bpf/progs/test_static_linked2.c index 766ebd502a60..7d15c361cb8c 100644 --- a/tools/testing/selftests/bpf/progs/test_static_linked2.c +++ b/tools/testing/selftests/bpf/progs/test_static_linked2.c @@ -28,4 +28,3 @@ int handler2(const void *ctx) /* different name and/or type of the variable doesn't matter */ char _license[] SEC("license") = "GPL"; -int _version SEC("version") = 1; diff --git a/tools/testing/selftests/bpf/progs/test_tcp_estats.c b/tools/testing/selftests/bpf/progs/test_tcp_estats.c index adc83a54c352..2c5c602c6011 100644 --- a/tools/testing/selftests/bpf/progs/test_tcp_estats.c +++ b/tools/testing/selftests/bpf/progs/test_tcp_estats.c @@ -255,4 +255,3 @@ int _dummy_tracepoint(struct dummy_tracepoint_args *arg) } char _license[] SEC("license") = "GPL"; -__u32 _version SEC("version") = 1; /* ignored by tracepoints, required by libbpf.a */ diff --git a/tools/testing/selftests/bpf/progs/test_tcpbpf_kern.c b/tools/testing/selftests/bpf/progs/test_tcpbpf_kern.c index 94f50f7e94d6..3ded05280757 100644 --- a/tools/testing/selftests/bpf/progs/test_tcpbpf_kern.c +++ b/tools/testing/selftests/bpf/progs/test_tcpbpf_kern.c @@ -16,7 +16,6 @@ #include "test_tcpbpf.h" struct tcpbpf_globals global = {}; -int _version SEC("version") = 1; /** * SOL_TCP is defined in <netinet/tcp.h> while diff --git a/tools/testing/selftests/bpf/progs/test_tcpnotify_kern.c b/tools/testing/selftests/bpf/progs/test_tcpnotify_kern.c index 24e9344994ef..f307deba6332 100644 --- a/tools/testing/selftests/bpf/progs/test_tcpnotify_kern.c +++ b/tools/testing/selftests/bpf/progs/test_tcpnotify_kern.c @@ -28,7 +28,6 @@ struct { __type(value, __u32); } perf_event_map SEC(".maps"); -int _version SEC("version") = 1; SEC("sockops") int bpf_testcb(struct bpf_sock_ops *skops) diff --git a/tools/testing/selftests/bpf/progs/test_tracepoint.c b/tools/testing/selftests/bpf/progs/test_tracepoint.c index 4b825ee122cf..ce6974016f53 100644 --- a/tools/testing/selftests/bpf/progs/test_tracepoint.c +++ b/tools/testing/selftests/bpf/progs/test_tracepoint.c @@ -23,4 +23,3 @@ int oncpu(struct sched_switch_args *ctx) } char _license[] SEC("license") = "GPL"; -__u32 _version SEC("version") = 1; /* ignored by tracepoints, required by libbpf.a */ diff --git a/tools/testing/selftests/bpf/progs/test_tunnel_kern.c b/tools/testing/selftests/bpf/progs/test_tunnel_kern.c index e7b673117436..ee37d8c25205 100644 --- a/tools/testing/selftests/bpf/progs/test_tunnel_kern.c +++ b/tools/testing/selftests/bpf/progs/test_tunnel_kern.c @@ -26,7 +26,6 @@ bpf_trace_printk(fmt, sizeof(fmt), __LINE__, ret); \ } while (0) -int _version SEC("version") = 1; struct geneve_opt { __be16 opt_class; diff --git a/tools/testing/selftests/bpf/progs/test_xdp.c b/tools/testing/selftests/bpf/progs/test_xdp.c index e6aa2fc6ce6b..106710738053 100644 --- a/tools/testing/selftests/bpf/progs/test_xdp.c +++ b/tools/testing/selftests/bpf/progs/test_xdp.c @@ -20,7 +20,6 @@ #include <bpf/bpf_endian.h> #include "test_iptunnel_common.h" -int _version SEC("version") = 1; struct { __uint(type, BPF_MAP_TYPE_PERCPU_ARRAY); diff --git a/tools/testing/selftests/bpf/progs/test_xdp_loop.c b/tools/testing/selftests/bpf/progs/test_xdp_loop.c index 27eb52dda92c..818b8e3911c4 100644 --- a/tools/testing/selftests/bpf/progs/test_xdp_loop.c +++ b/tools/testing/selftests/bpf/progs/test_xdp_loop.c @@ -16,7 +16,6 @@ #include <bpf/bpf_endian.h> #include "test_iptunnel_common.h" -int _version SEC("version") = 1; struct { __uint(type, BPF_MAP_TYPE_PERCPU_ARRAY); diff --git a/tools/testing/selftests/bpf/progs/test_xdp_redirect.c b/tools/testing/selftests/bpf/progs/test_xdp_redirect.c index a5337cd9400b..00fe9c1a15bc 100644 --- a/tools/testing/selftests/bpf/progs/test_xdp_redirect.c +++ b/tools/testing/selftests/bpf/progs/test_xdp_redirect.c @@ -12,7 +12,6 @@ #include <linux/bpf.h> #include <bpf/bpf_helpers.h> -int _version SEC("version") = 1; SEC("redirect_to_111") int xdp_redirect_to_111(struct xdp_md *xdp)
Since commit 6c4fc209fcf9d ("bpf: remove useless version check for prog load") these "version" sections, which result in bpf_attr.kern_version being set, have been unnecessary. Remove them so that it's obvious to folks using selftests as a guide that "modern" BPF progs don't need this section. Signed-off-by: Dave Marchevsky <davemarchevsky@fb.com> --- tools/testing/selftests/bpf/progs/cgroup_skb_sk_lookup_kern.c | 1 - tools/testing/selftests/bpf/progs/connect4_prog.c | 1 - tools/testing/selftests/bpf/progs/connect6_prog.c | 1 - tools/testing/selftests/bpf/progs/connect_force_port4.c | 1 - tools/testing/selftests/bpf/progs/connect_force_port6.c | 1 - tools/testing/selftests/bpf/progs/dev_cgroup.c | 1 - tools/testing/selftests/bpf/progs/get_cgroup_id_kern.c | 1 - tools/testing/selftests/bpf/progs/map_ptr_kern.c | 1 - tools/testing/selftests/bpf/progs/netcnt_prog.c | 1 - tools/testing/selftests/bpf/progs/sendmsg4_prog.c | 1 - tools/testing/selftests/bpf/progs/sendmsg6_prog.c | 1 - tools/testing/selftests/bpf/progs/sockmap_parse_prog.c | 1 - tools/testing/selftests/bpf/progs/sockmap_tcp_msg_prog.c | 1 - tools/testing/selftests/bpf/progs/sockmap_verdict_prog.c | 1 - tools/testing/selftests/bpf/progs/sockopt_inherit.c | 1 - tools/testing/selftests/bpf/progs/tcp_rtt.c | 1 - tools/testing/selftests/bpf/progs/test_btf_haskv.c | 1 - tools/testing/selftests/bpf/progs/test_btf_newkv.c | 1 - tools/testing/selftests/bpf/progs/test_btf_nokv.c | 1 - tools/testing/selftests/bpf/progs/test_l4lb.c | 1 - tools/testing/selftests/bpf/progs/test_map_in_map.c | 1 - tools/testing/selftests/bpf/progs/test_pinning.c | 1 - tools/testing/selftests/bpf/progs/test_pinning_invalid.c | 1 - tools/testing/selftests/bpf/progs/test_pkt_access.c | 1 - tools/testing/selftests/bpf/progs/test_queue_stack_map.h | 1 - tools/testing/selftests/bpf/progs/test_select_reuseport_kern.c | 1 - tools/testing/selftests/bpf/progs/test_sk_lookup.c | 1 - tools/testing/selftests/bpf/progs/test_skb_cgroup_id_kern.c | 1 - tools/testing/selftests/bpf/progs/test_skb_ctx.c | 1 - tools/testing/selftests/bpf/progs/test_sockmap_kern.h | 1 - tools/testing/selftests/bpf/progs/test_sockmap_listen.c | 1 - tools/testing/selftests/bpf/progs/test_stacktrace_build_id.c | 1 - tools/testing/selftests/bpf/progs/test_static_linked1.c | 1 - tools/testing/selftests/bpf/progs/test_static_linked2.c | 1 - tools/testing/selftests/bpf/progs/test_tcp_estats.c | 1 - tools/testing/selftests/bpf/progs/test_tcpbpf_kern.c | 1 - tools/testing/selftests/bpf/progs/test_tcpnotify_kern.c | 1 - tools/testing/selftests/bpf/progs/test_tracepoint.c | 1 - tools/testing/selftests/bpf/progs/test_tunnel_kern.c | 1 - tools/testing/selftests/bpf/progs/test_xdp.c | 1 - tools/testing/selftests/bpf/progs/test_xdp_loop.c | 1 - tools/testing/selftests/bpf/progs/test_xdp_redirect.c | 1 - 42 files changed, 42 deletions(-)