lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Mon, 14 Dec 2020 17:37:59 -0800 From: Andrii Nakryiko <andrii.nakryiko@...il.com> To: Kamal Mostafa <kamal@...onical.com> Cc: Shuah Khan <shuah@...nel.org>, Alexei Starovoitov <ast@...nel.org>, Daniel Borkmann <daniel@...earbox.net>, Andrii Nakryiko <andrii@...nel.org>, Martin KaFai Lau <kafai@...com>, Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>, John Fastabend <john.fastabend@...il.com>, KP Singh <kpsingh@...nel.org>, Toke Høiland-Jørgensen <toke@...hat.com>, "open list:KERNEL SELFTEST FRAMEWORK" <linux-kselftest@...r.kernel.org>, Networking <netdev@...r.kernel.org>, bpf <bpf@...r.kernel.org>, open list <linux-kernel@...r.kernel.org>, linux- stable <stable@...r.kernel.org> Subject: Re: [PATCH] selftests/bpf: clarify build error if no vmlinux On Mon, Dec 14, 2020 at 12:21 PM Kamal Mostafa <kamal@...onical.com> wrote: > > If Makefile cannot find any of the vmlinux's in its VMLINUX_BTF_PATHS list, > it tries to run btftool incorrectly, with VMLINUX_BTF unset: > > bpftool btf dump file $(VMLINUX_BTF) format c > > Such that the keyword 'format' is misinterpreted as the path to vmlinux. > The resulting build error message is fairly cryptic: > > GEN vmlinux.h > Error: failed to load BTF from format: No such file or directory > > This patch makes the failure reason clearer by yielding this instead: > > Makefile:...: *** cannot find a vmlinux for VMLINUX_BTF at any of > "{paths}". Stop. > > Fixes: acbd06206bbb ("selftests/bpf: Add vmlinux.h selftest exercising tracing of syscalls") > Cc: stable@...r.kernel.org # 5.7+ > Signed-off-by: Kamal Mostafa <kamal@...onical.com> > --- > tools/testing/selftests/bpf/Makefile | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile > index 542768f5195b..93ed34ef6e3f 100644 > --- a/tools/testing/selftests/bpf/Makefile > +++ b/tools/testing/selftests/bpf/Makefile > @@ -196,6 +196,9 @@ $(BUILD_DIR)/libbpf $(BUILD_DIR)/bpftool $(BUILD_DIR)/resolve_btfids $(INCLUDE_D > $(INCLUDE_DIR)/vmlinux.h: $(VMLINUX_BTF) | $(BPFTOOL) $(INCLUDE_DIR) > ifeq ($(VMLINUX_H),) > $(call msg,GEN,,$@) > +ifeq ($(VMLINUX_BTF),) > +$(error cannot find a vmlinux for VMLINUX_BTF at any of "$(VMLINUX_BTF_PATHS)") > +endif > $(Q)$(BPFTOOL) btf dump file $(VMLINUX_BTF) format c > $@ > else > $(call msg,CP,,$@) This handles only one possible case where $(VMLINUX_BTF) is expected. Given $(VMLINUX_BTF) is now almost mandatory to have (bpf_testmod.ko is dependent on it, for instance), I think it's acceptable to just add such a check right after VMLINUX_BTF definition, outside of any specific rule. The downside is that some unrelated targets (e.g., non-test_progs tests) will fail if VMLINUX_BTF is not found, even if they don't need it, but the most common use case us to build test_progs, as well as bpf_testmod.ko and runqslower, so I think it's an OK trade off. Worst case, one can work around such with VMLINUX_BTF=whatever command-line overload. > -- > 2.17.1 >
Powered by blists - more mailing lists