Re: [PATCH bpf-next v1 03/10] bpf: Verifier support for KF_IMPLICIT_ARGS
From: Ihor Solodrai
Date: Tue Jan 13 2026 - 19:03:16 EST
On 1/13/26 1:59 PM, Eduard Zingerman wrote:
> On Fri, 2026-01-09 at 10:48 -0800, Ihor Solodrai wrote:
>
> [...]
>
>> --- a/kernel/bpf/verifier.c
>> +++ b/kernel/bpf/verifier.c
>> @@ -3271,6 +3271,38 @@ static struct btf *find_kfunc_desc_btf(struct bpf_verifier_env *env, s16 offset)
>> return btf_vmlinux ?: ERR_PTR(-ENOENT);
>> }
>>
>> +#define KF_IMPL_SUFFIX "_impl"
>> +
>> +static const struct btf_type *find_kfunc_impl_proto(struct bpf_verifier_env *env,
>> + struct btf *btf,
>> + const char *func_name)
>> +{
>> + char impl_name[KSYM_SYMBOL_LEN];
>
> Oh, as we discussed already, this should use env->tmp_str_buf.
The env->tmp_str_buf size is smaller:
#define TMP_STR_BUF_LEN 320
*And* there is already a local char buffer of size KSYM_SYMBOL_LEN
already in use in verifier.c:
int bpf_check_attach_target(...) {
bool prog_extension = prog->type == BPF_PROG_TYPE_EXT;
bool prog_tracing = prog->type == BPF_PROG_TYPE_TRACING;
char trace_symbol[KSYM_SYMBOL_LEN];
[...]
Since these are function names, the real limit is KSYM_SYMBOL_LEN,
right?
Sure >320 chars long kfunc name is unlikely, but technically possible.
>
>> + const struct btf_type *func;
>> + s32 impl_id;
>> + int len;
>> +
>> + len = snprintf(impl_name, sizeof(impl_name), "%s%s", func_name, KF_IMPL_SUFFIX);
>> + if (len < 0 || len >= sizeof(impl_name)) {
>> + verbose(env, "function name %s%s is too long\n", func_name, KF_IMPL_SUFFIX);
>> + return NULL;
>> + }
>
> [...]