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] [thread-next>] [day] [month] [year] [list]
Message-ID: <872b0c40-651e-6989-cd4c-8ca7f655dc79@oracle.com>
Date:   Fri, 26 May 2023 15:39:22 +0100
From:   Alan Maguire <alan.maguire@...cle.com>
To:     Arnd Bergmann <arnd@...db.de>,
        Luis Chamberlain <mcgrof@...nel.org>,
        Song Liu <song@...nel.org>
Cc:     Arnd Bergmann <arnd@...nel.org>, Andy Lutomirski <luto@...nel.org>,
        Borislav Petkov <bp@...e.de>, linux-modules@...r.kernel.org,
        Zhen Lei <thunder.leizhen@...wei.com>,
        Peter Zijlstra <peterz@...radead.org>,
        Kees Cook <keescook@...omium.org>,
        linux-kernel@...r.kernel.org,
        Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH] kallsyms: remove unused arch_get_kallsym() helper

On 26/05/2023 07:41, Arnd Bergmann wrote:
> 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@...nel.org> 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.
>

Thanks for the fix! The change above works ; maybe having
anything less than iter->pos_mod_end marked as a "CORE/MOD " symbol
might be worth tweaking, but that's a minor thing.

before:

  CLNG-BPF [test_maps] bpf_iter_ksym.bpf.o
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)
                                   ~~~~  ^
2 errors generated.

after the above is applied, bpf selftests build and iter ksym test
passes:

$ sudo ./test_progs -t bpf_iter
...
#12/37   bpf_iter/ksym:OK
...
Summary: 3/39 PASSED, 0 SKIPPED, 0 FAILED

Feel free to add a

Tested-by: Alan Maguire <alan.maguire@...cle.com>

...if needed.

Thanks!

Alan

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ