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: <20211110212553.e2xnltq3dqduhjnj@apollo.localdomain>
Date:   Thu, 11 Nov 2021 02:55:53 +0530
From:   Kumar Kartikeya Dwivedi <memxor@...il.com>
To:     Vinicius Costa Gomes <vinicius.gomes@...el.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

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.

That's just my opinion however, I'll defer to BPF maintainers.

--
Kartikeya

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ