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 13:59:43 -0800
From:   Alexei Starovoitov <alexei.starovoitov@...il.com>
To:     Kumar Kartikeya Dwivedi <memxor@...il.com>
Cc:     Vinicius Costa Gomes <vinicius.gomes@...el.com>,
        bpf <bpf@...r.kernel.org>,
        Network Development <netdev@...r.kernel.org>,
        Alexei Starovoitov <ast@...nel.org>,
        Daniel Borkmann <daniel@...earbox.net>,
        Martin KaFai Lau <kafai@...com>,
        Andrii Nakryiko <andrii@...nel.org>,
        Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>
Subject: Re: [PATCH net v2] bpf: Fix build when CONFIG_BPF_SYSCALL is disabled

On Wed, Nov 10, 2021 at 1:25 PM Kumar Kartikeya Dwivedi
<memxor@...il.com> wrote:
>
> 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.

Unlikely. I would just disallow such config instead of sprinkling
the code with ifdefs.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ