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]
Date:   Wed, 10 Nov 2021 15:10:38 -0800
From:   Vinicius Costa Gomes <vinicius.gomes@...el.com>
To:     Kumar Kartikeya Dwivedi <memxor@...il.com>
Cc:     bpf@...r.kernel.org, netdev@...r.kernel.org, ast@...nel.org,
        daniel@...earbox.net, kafai@...com, andrii@...nel.org,
        songliubraving@...com, yhs@...com
Subject: Re: [PATCH net v2] bpf: Fix build when CONFIG_BPF_SYSCALL is disabled

Hi,

Kumar Kartikeya Dwivedi <memxor@...il.com> writes:

> On Thu, Nov 11, 2021 at 02:24:18AM IST, Vinicius Costa Gomes wrote:
>> When CONFIG_DEBUG_INFO_BTF is enabled and CONFIG_BPF_SYSCALL is
>> disabled, the following compilation error can be seen:
>>
>>   GEN     .version
>>   CHK     include/generated/compile.h
>>   UPD     include/generated/compile.h
>>   CC      init/version.o
>>   AR      init/built-in.a
>>   LD      vmlinux.o
>>   MODPOST vmlinux.symvers
>>   MODINFO modules.builtin.modinfo
>>   GEN     modules.builtin
>>   LD      .tmp_vmlinux.btf
>> ld: net/ipv4/tcp_cubic.o: in function `cubictcp_unregister':
>> net/ipv4/tcp_cubic.c:545: undefined reference to `bpf_tcp_ca_kfunc_list'
>> ld: net/ipv4/tcp_cubic.c:545: undefined reference to `unregister_kfunc_btf_id_set'
>> ld: net/ipv4/tcp_cubic.o: in function `cubictcp_register':
>> net/ipv4/tcp_cubic.c:539: undefined reference to `bpf_tcp_ca_kfunc_list'
>> ld: net/ipv4/tcp_cubic.c:539: undefined reference to `register_kfunc_btf_id_set'
>>   BTF     .btf.vmlinux.bin.o
>> pahole: .tmp_vmlinux.btf: No such file or directory
>>   LD      .tmp_vmlinux.kallsyms1
>> .btf.vmlinux.bin.o: file not recognized: file format not recognized
>> make: *** [Makefile:1187: vmlinux] Error 1
>>
>> 'bpf_tcp_ca_kfunc_list', 'register_kfunc_btf_id_set()' and
>> 'unregister_kfunc_btf_id_set()' are only defined when
>> CONFIG_BPF_SYSCALL is enabled.
>>
>> Fix that by moving those definitions somewhere that doesn't depend on
>> the bpf() syscall.
>>
>> Fixes: 14f267d95fe4 ("bpf: btf: Introduce helpers for dynamic BTF set registration")
>> Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@...el.com>
>
> Thanks for the fix.
>
> But instead of moving this to core.c, you can probably make the btf.h
> declaration conditional on CONFIG_BPF_SYSCALL, since this is not useful in
> isolation (only used by verifier for module kfunc support). For the case of
> kfunc_btf_id_list variables, just define it as an empty struct and static
> variables, since the definition is still inside btf.c. So it becomes a noop for
> !CONFIG_BPF_SYSCALL.
>
> I am also not sure whether BTF is useful without BPF support, but maybe I'm
> missing some usecase.

>From my side, you are not missing anything, it was just random chance
that I had a 'x86_64_defconfig + debug + BTF' .config laying around and
the build broke with it. I don't have any real usecases for this
combination.


Cheers,
-- 
Vinicius

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ