Re: [PATCH] kallsyms: remove unused arch_get_kallsym() helper

From: Arnd Bergmann
Date: Fri May 26 2023 - 02:42:17 EST


On Fri, May 26, 2023, at 05:24, Luis Chamberlain wrote:
> On Thu, May 25, 2023 at 06:45:35PM -0700, Song Liu wrote:
>> On Wed, May 24, 2023 at 12:24 AM Luis Chamberlain <mcgrof@xxxxxxxxxx> wrote:
>>
>> This change broke compilation of BPF selftests in modules-next
>> branch:
>>
>> progs/bpf_iter_ksym.c:62:13: error: no member named 'pos_arch_end' in
>> 'struct kallsym_iter'
>> if (!iter->pos_arch_end || iter->pos_arch_end > iter->pos)
>> ~~~~ ^
>> progs/bpf_iter_ksym.c:62:35: error: no member named 'pos_arch_end' in
>> 'struct kallsym_iter'
>> if (!iter->pos_arch_end || iter->pos_arch_end > iter->pos)
>> ~~~~ ^
>>
>> I haven't looked into the proper fix for it yet.
>
> A quick attempt:
>
> Arnd, can you verify?
>
> diff --git a/tools/testing/selftests/bpf/progs/bpf_iter_ksym.c
> b/tools/testing/selftests/bpf/progs/bpf_iter_ksym.c
> index 5ddcc46fd886..521267818f4d 100644
> --- a/tools/testing/selftests/bpf/progs/bpf_iter_ksym.c
> +++ b/tools/testing/selftests/bpf/progs/bpf_iter_ksym.c
> @@ -59,9 +59,7 @@ int dump_ksym(struct bpf_iter__ksym *ctx)
> } else {
> BPF_SEQ_PRINTF(seq, "0x%llx %c %s ", value, type, iter->name);
> }
> - if (!iter->pos_arch_end || iter->pos_arch_end > iter->pos)
> - BPF_SEQ_PRINTF(seq, "CORE ");
> - else if (!iter->pos_mod_end || iter->pos_mod_end > iter->pos)
> + if (!iter->pos_mod_end || iter->pos_mod_end > iter->pos)
> BPF_SEQ_PRINTF(seq, "MOD ");
> else if (!iter->pos_ftrace_mod_end || iter->pos_ftrace_mod_end >
> iter->pos)
> BPF_SEQ_PRINTF(seq, "FTRACE_MOD ");

This looks correct to me, but I'm still failing to cross-build
the selftests on my randconfig build setup, so I can't confirm that
this avoids the build failure, and I don't understand the code well
enough to be sure.

Arnd