public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Matthieu Baerts <matttbe@kernel.org>
To: Eduard Zingerman <eddyz87@gmail.com>,
	ihor.solodrai@linux.dev, alan.maguire@oracle.com
Cc: bpf@vger.kernel.org, linux-kselftest@vger.kernel.org,
	linux-kernel@vger.kernel.org, llvm@lists.linux.dev,
	Andrii Nakryiko <andrii@kernel.org>,
	Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Martin KaFai Lau <martin.lau@linux.dev>,
	Song Liu <song@kernel.org>,
	Yonghong Song <yonghong.song@linux.dev>,
	John Fastabend <john.fastabend@gmail.com>,
	KP Singh <kpsingh@kernel.org>,
	Stanislav Fomichev <sdf@fomichev.me>, Hao Luo <haoluo@google.com>,
	Jiri Olsa <jolsa@kernel.org>, Shuah Khan <shuah@kernel.org>,
	Nathan Chancellor <nathan@kernel.org>,
	Nick Desaulniers <nick.desaulniers+lkml@gmail.com>,
	Bill Wendling <morbo@google.com>,
	Justin Stitt <justinstitt@google.com>
Subject: Re: [PATCH bpf] selftests/bpf: fix implicit-function-declaration errors
Date: Sat, 4 Oct 2025 10:51:36 +0200	[thread overview]
Message-ID: <8b49ca48-ff6b-40ed-8322-e0c9791d1d17@kernel.org> (raw)
In-Reply-To: <d108d59be611a63c73303347d07fe0ba5f2b74b7.camel@gmail.com>

Hi Eduard,

On 04/10/2025 01:37, Eduard Zingerman wrote:
> On Fri, 2025-10-03 at 17:24 +0200, Matthieu Baerts (NGI0) wrote:
>> When trying to build the latest BPF selftests, with a debug kernel
>> config, Pahole 1.30 and CLang 20.1.8 (and GCC 15.2), I got these errors:
>>
>>   progs/dynptr_success.c:579:9: error: call to undeclared function 'bpf_dynptr_slice'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
>>     579 |         data = bpf_dynptr_slice(&ptr, 0, NULL, 1);
>>         |                ^
>>   progs/dynptr_success.c:579:9: note: did you mean 'bpf_dynptr_size'?
>>   .virtme/build-debug-btf//tools/include/vmlinux.h:120280:14: note: 'bpf_dynptr_size' declared here
>>    120280 | extern __u32 bpf_dynptr_size(const struct bpf_dynptr *p) __weak __ksym;
>>           |              ^
>>   progs/dynptr_success.c:579:7: error: incompatible integer to pointer conversion assigning to '__u64 *' (aka 'unsigned long long *') from 'int' [-Wint-conversion]
>>     579 |         data = bpf_dynptr_slice(&ptr, 0, NULL, 1);
>>         |              ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>   progs/dynptr_success.c:596:9: error: call to undeclared function 'bpf_dynptr_slice'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
>>     596 |         data = bpf_dynptr_slice(&ptr, 0, NULL, 10);
>>         |                ^
>>   progs/dynptr_success.c:596:7: error: incompatible integer to pointer conversion assigning to 'char *' from 'int' [-Wint-conversion]
>>     596 |         data = bpf_dynptr_slice(&ptr, 0, NULL, 10);
>>         |              ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>
>> I don't have these errors without the debug kernel config from
>> kernel/configs/debug.config. With the debug kernel, bpf_dynptr_slice()
>> is not declared in vmlinux.h. It is declared there without debug.config.
>>
>> The fix is similar to what is done in dynptr_fail.c which is also using
>> bpf_dynptr_slice(): bpf_kfuncs.h is now included.
>>
>> Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
>> ---
> 
> I can reproduce similar issue when including
> kernel/configs/debug.config with my regular dev config, but for
> different functions: bpf_rcu_read_{un,}lock().

Thank you for having checked! I also had issues with these functions on
my side, when testing on top of 'net'.

> However, this is not a way to fix this.
> Kfuncs are not supposed to just disappear from DWARF.

Indeed. But strange it was fine before. Or fine without debug.config.

Cheers,
Matt
-- 
Sponsored by the NGI0 Core fund.


      parent reply	other threads:[~2025-10-04  8:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-03 15:24 [PATCH bpf] selftests/bpf: fix implicit-function-declaration errors Matthieu Baerts (NGI0)
2025-10-03 23:37 ` Eduard Zingerman
2025-10-04  3:08   ` Ihor Solodrai
2025-10-04  3:19     ` Ihor Solodrai
2025-10-04  8:52       ` Matthieu Baerts
2025-10-04  8:51   ` Matthieu Baerts [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8b49ca48-ff6b-40ed-8322-e0c9791d1d17@kernel.org \
    --to=matttbe@kernel.org \
    --cc=alan.maguire@oracle.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=haoluo@google.com \
    --cc=ihor.solodrai@linux.dev \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=justinstitt@google.com \
    --cc=kpsingh@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=martin.lau@linux.dev \
    --cc=morbo@google.com \
    --cc=nathan@kernel.org \
    --cc=nick.desaulniers+lkml@gmail.com \
    --cc=sdf@fomichev.me \
    --cc=shuah@kernel.org \
    --cc=song@kernel.org \
    --cc=yonghong.song@linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox