[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAADnVQL7RtTFsr36hbT331X6XQHat4XKRcun=0e5jPohX+TF0Q@mail.gmail.com>
Date: Wed, 22 Oct 2025 09:48:29 -0700
From: Alexei Starovoitov <alexei.starovoitov@...il.com>
To: Yonghong Song <yonghong.song@...ux.dev>
Cc: Jiayuan Chen <jiayuan.chen@...ux.dev>, bpf <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>, Puranjay Mohan <puranjay@...nel.org>,
"open list:KERNEL SELFTEST FRAMEWORK" <linux-kselftest@...r.kernel.org>, LKML <linux-kernel@...r.kernel.org>,
clang-built-linux <llvm@...ts.linux.dev>
Subject: Re: [PATCH bpf-next v1] selftests/bpf: Guard addr_space_cast code
with __BPF_FEATURE_ADDR_SPACE_CAST
On Wed, Oct 22, 2025 at 8:33 AM Yonghong Song <yonghong.song@...ux.dev> wrote:
>
>
>
> On 10/22/25 12:18 AM, Jiayuan Chen wrote:
> > When compiling the BPF selftests with Clang versions that do not support
> > the addr_space_cast builtin, the build fails with assembly errors in
> > "verifier_ldsx.c" [1].
> >
> > The root cause is that the inline assembly using addr_space_cast is
> > being processed by a compiler that lacks this feature. To resolve this,
> > wrap the affected code sections (specifically the arena_ldsx_* test
> > functions) with #if defined(__BPF_FEATURE_ADDR_SPACE_CAST). This
> > ensures the code is only compiled when the Clang supports the necessary
> > feature, preventing build failures on older or incompatible compiler
> > versions.
> >
> > This change maintains test coverage for systems with support while
> > allowing the tests to build successfully in all environments.
> >
> > [1]:
> > root:tools/testing/selftests/bpf$ make
> >
> > CLNG-BPF [test_progs] verifier_ldsx.bpf.o
> > progs/verifier_ldsx.c:322:2: error: invalid operand for instruction
> > 322 | "r1 = %[arena] ll;"
> > | ^
> > <inline asm>:1:52: note: instantiated into assembly here
> > 1 | r1 = arena ll;r0 = 0xdeadbeef;r0 = addr_space_cast(r0,...
> > | ^
>
> I think you are using llvm18 and earlier. Why can you upgrade to llvm19 and later
> which should solve the problem?
>
> > Fixes: f61654912404 ("selftests: bpf: Add tests for signed loads from arena")
>
> We do not need to have Fixes. compiler is also moving forward, we cannot support
> really old compiler and it is no point to have __BPF_FEATURE_ADDR_SPACE_CAST
> for really old compilers. So at some point, __BPF_FEATURE_ADDR_SPACE_CAST will
> become default.
+1
and this is not the first time we're seeing this type of patches.
Upgrade your compiler. That's the only way.
pw-bot: cr
Powered by blists - more mailing lists