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  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAK7-dKYDqV97K+hbw651zbu3-UZ1WSOf2a07uqWWtiRSfJV_zQ@mail.gmail.com>
Date: Mon, 17 Nov 2025 15:37:50 +0900
From: Hoyeon Lee <hoyeon.lee@...e.com>
To: Yonghong Song <yonghong.song@...ux.dev>
Cc: bpf@...r.kernel.org, Andrii Nakryiko <andrii@...nel.org>, 
	Eduard Zingerman <eddyz87@...il.com>, Alexei Starovoitov <ast@...nel.org>, 
	Daniel Borkmann <daniel@...earbox.net>, Martin KaFai Lau <martin.lau@...ux.dev>, Song Liu <song@...nel.org>, 
	John Fastabend <john.fastabend@...il.com>, KP Singh <kpsingh@...nel.org>, 
	Stanislav Fomichev <sdf@...ichev.me>, Hao Luo <haoluo@...gle.com>, Jiri Olsa <jolsa@...nel.org>, 
	Shuah Khan <shuah@...nel.org>, Nathan Chancellor <nathan@...nel.org>, 
	Nick Desaulniers <nick.desaulniers+lkml@...il.com>, Bill Wendling <morbo@...gle.com>, 
	Justin Stitt <justinstitt@...gle.com>, linux-kselftest@...r.kernel.org, 
	linux-kernel@...r.kernel.org, llvm@...ts.linux.dev
Subject: Re: [bpf-next v1 5/5] selftests/bpf: propagate LLVM toolchain to
 runqslower build

On Mon, Nov 17, 2025 at 3:04 PM Yonghong Song <yonghong.song@...ux.dev> wrote:
>
>
>
> On 11/15/25 2:55 PM, Hoyeon Lee wrote:
> > The selftests/bpf invokes a nested make when building runqslower, but
> > LLVM toolchain version (clang/llvm-strip) is not propagated. As a
> > result, runqslower is built with system default clang, not respecting
> > specified LLVM version.
> >
> >      # LLVM=-21 make -C tools/testing/selftests/bpf
> >      ...
> >      make feature_display=0 -C /bpf/tools/bpf/runqslower                        \
> >          OUTPUT=/bpf/tools/testing/selftests/bpf/tools/build/runqslower/        \
> >          BPFOBJ_OUTPUT=/bpf/tools/testing/selftests/bpf/tools/build/libbpf/     \
> >          BPFOBJ=/bpf/tools/testing/selftests/bpf/tools/build/libbpf/libbpf.a    \
> >          BPF_INCLUDE=/bpf/tools/testing/selftests/bpf/tools/include             \
> >          BPFTOOL_OUTPUT=/bpf/tools/testing/selftests/bpf/tools/build/bpftool/   \
> >          VMLINUX_BTF=/sys/kernel/btf/vmlinux BPF_TARGET_ENDIAN=--target=bpfel   \
> >          EXTRA_CFLAGS='-g -O0  ' EXTRA_LDFLAGS=' ' &&                           \
> >          cp  /bpf/tools/testing/selftests/bpf/tools/build/runqslower/runqslower \
> >              /bpf/tools/testing/selftests/bpf/runqslower
> >      clang -g -O2 --target=bpfel -I/bpf/tools/testing/selftests/bpf/tools/build/runqslower/ \
> >            -I/bpf/tools/testing/selftests/bpf/tools/include -I/bpf/tools/include/uapi       \
> >            -c runqslower.bpf.c -o /bpf/tools/testing/selftests/bpf/tools/build/runqslower/runqslower.bpf.o && \
> >            llvm-strip -g /bpf/tools/testing/selftests/bpf/tools/build/runqslower//runqslower.bpf.o
> >      /bin/sh: 1: clang: not found
>
> I tried with LLVM=-20 make -C tools/testing/selftests/bpf in my system and
> there is no build error.
>
> Also could you try with command line
>     make -C tools/testing/selftests/bpf LLVM=1
> for clang build kernel or selftests, LLVM=1 is recommended as it
> encodes a bunch of clang command lines:
>    CC              = $(LLVM_PREFIX)clang$(LLVM_SUFFIX)
>    LD              = $(LLVM_PREFIX)ld.lld$(LLVM_SUFFIX)
>    AR              = $(LLVM_PREFIX)llvm-ar$(LLVM_SUFFIX)
>    NM              = $(LLVM_PREFIX)llvm-nm$(LLVM_SUFFIX)
>    OBJCOPY         = $(LLVM_PREFIX)llvm-objcopy$(LLVM_SUFFIX)
>    OBJDUMP         = $(LLVM_PREFIX)llvm-objdump$(LLVM_SUFFIX)
>    READELF         = $(LLVM_PREFIX)llvm-readelf$(LLVM_SUFFIX)
>    STRIP           = $(LLVM_PREFIX)llvm-strip$(LLVM_SUFFIX)
>
>
Thanks for the review.

Just to clarify, the issue is not the build failure itself. The error
"clang: not found" only appeared because I intentionally did not set
update-alternatives to avoid falling back to the system default compiler.

The real issue is that the runqslower sub-make invokes "clang" instead
of "clang-21" when LLVM=-21 is specified. This shows that the selected
LLVM toolchain version is not being propagated into the nested build.

LLVM=1 works well for general builds, but in this case the intention is
to verify that a specific LLVM version is consistently applied across
all sub-makes. That propagation does not currently happen, and the patch
addresses exactly that.

Thanks again for taking a look.
>
>
> >
> > Explicitly propagate CLANG and LLVM_STRIP to the runqslower sub-make so
> > that the LLVM toolchain selection from lib.mk is preserved.
> >
> > Signed-off-by: Hoyeon Lee <hoyeon.lee@...e.com>
> > ---
> >   tools/testing/selftests/bpf/Makefile | 1 +
> >   tools/testing/selftests/lib.mk       | 1 +
> >   2 files changed, 2 insertions(+)
> >
> > diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
> > index 34ea23c63bd5..79ab69920dca 100644
> > --- a/tools/testing/selftests/bpf/Makefile
> > +++ b/tools/testing/selftests/bpf/Makefile
> > @@ -306,6 +306,7 @@ endif
> >
> >   $(OUTPUT)/runqslower: $(BPFOBJ) | $(DEFAULT_BPFTOOL) $(RUNQSLOWER_OUTPUT)
> >       $(Q)$(MAKE) $(submake_extras) -C $(TOOLSDIR)/bpf/runqslower            \
> > +                 CLANG=$(CLANG) LLVM_STRIP=$(LLVM_STRIP)                    \
> >                   OUTPUT=$(RUNQSLOWER_OUTPUT) VMLINUX_BTF=$(VMLINUX_BTF)     \
> >                   BPFTOOL_OUTPUT=$(HOST_BUILD_DIR)/bpftool/                  \
> >                   BPFOBJ_OUTPUT=$(BUILD_DIR)/libbpf/                         \
> > diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk
> > index a448fae57831..f14255b2afbd 100644
> > --- a/tools/testing/selftests/lib.mk
> > +++ b/tools/testing/selftests/lib.mk
> > @@ -8,6 +8,7 @@ LLVM_SUFFIX := $(LLVM)
> >   endif
> >
> >   CLANG := $(LLVM_PREFIX)clang$(LLVM_SUFFIX)
> > +LLVM_STRIP := $(LLVM_PREFIX)llvm-strip$(LLVM_SUFFIX)
> >
> >   CLANG_TARGET_FLAGS_arm          := arm-linux-gnueabi
> >   CLANG_TARGET_FLAGS_arm64        := aarch64-linux-gnu
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ