Re: [PATCH net v2] bpf: Fix build when CONFIG_BPF_SYSCALL is disabled

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

Kumar Kartikeya Dwivedi <memxor@xxxxxxxxx> 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@xxxxxxxxx>
>
> 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



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux