Commit 677755d502df uses a PROG_TYPE_TRACEPOINT BPF test program to check whether the running kernel supports large LDIMM64 offsets. The feature gate incorrectly assumes that the program will fail at verification time with one of two messages, depending on whether the feature is supported by the running kernel. However, PROG_TYPE_TRACEPOINT programs may fail to load before verification even starts, e.g., if the shell does not have the appropriate capabilities. Use a BPF_PROG_TYPE_SOCKET_FILTER program for the feature gate instead. Also ensure the log buffer for the test is initialized: Failing program load before verification led to libbpf dumping uninitialized data to stdout. Reported-by: Alexei Starovoitov Fixes: 677755d502df ("libbpf: Add gating for arena globals relocation feature") Signed-off-by: Emil Tsalapatis --- tools/lib/bpf/features.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/lib/bpf/features.c b/tools/lib/bpf/features.c index b65ab109e3ff..0d432072f46e 100644 --- a/tools/lib/bpf/features.c +++ b/tools/lib/bpf/features.c @@ -508,7 +508,7 @@ static int probe_kern_arg_ctx_tag(int token_fd) static int probe_ldimm64_full_range_off(int token_fd) { - char log_buf[1024]; + char log_buf[1024] = {}; int prog_fd, map_fd; int ret; LIBBPF_OPTS(bpf_map_create_opts, map_opts, @@ -536,7 +536,7 @@ static int probe_ldimm64_full_range_off(int token_fd) } insns[0].imm = map_fd; - prog_fd = bpf_prog_load(BPF_PROG_TYPE_TRACEPOINT, "global_reloc", "GPL", insns, insn_cnt, &prog_opts); + prog_fd = bpf_prog_load(BPF_PROG_TYPE_SOCKET_FILTER, "global_reloc", "GPL", insns, insn_cnt, &prog_opts); ret = -errno; close(map_fd); -- 2.49.0