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
| ||
|
Message-ID: <20220416174330.195496-1-alobakin@pm.me> Date: Sat, 16 Apr 2022 17:50:39 +0000 From: Alexander Lobakin <alobakin@...me> To: Song Liu <song@...nel.org> Cc: Alexander Lobakin <alobakin@...me>, Alexei Starovoitov <ast@...nel.org>, Daniel Borkmann <daniel@...earbox.net>, Andrii Nakryiko <andrii@...nel.org>, Peter Zijlstra <peterz@...radead.org>, Ingo Molnar <mingo@...hat.com>, Arnaldo Carvalho de Melo <acme@...nel.org>, Mark Rutland <mark.rutland@....com>, Alexander Shishkin <alexander.shishkin@...ux.intel.com>, Jiri Olsa <jolsa@...nel.org>, Namhyung Kim <namhyung@...nel.org>, Martin KaFai Lau <kafai@...com>, Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>, John Fastabend <john.fastabend@...il.com>, KP Singh <kpsingh@...nel.org>, "David S. Miller" <davem@...emloft.net>, Jakub Kicinski <kuba@...nel.org>, Jesper Dangaard Brouer <hawk@...nel.org>, Björn Töpel <bjorn@...nel.org>, Magnus Karlsson <magnus.karlsson@...el.com>, Jonathan Lemon <jonathan.lemon@...il.com>, Nathan Chancellor <nathan@...nel.org>, Nick Desaulniers <ndesaulniers@...gle.com>, Dmitrii Dolgov <9erthalion6@...il.com>, Quentin Monnet <quentin@...valent.com>, Tiezhu Yang <yangtiezhu@...ngson.cn>, Kumar Kartikeya Dwivedi <memxor@...il.com>, Chenbo Feng <fengc@...gle.com>, Willem de Bruijn <willemb@...gle.com>, Thomas Graf <tgraf@...g.ch>, Ong Boon Leong <boon.leong.ong@...el.com>, linux-perf-users@...r.kernel.org, open list <linux-kernel@...r.kernel.org>, Networking <netdev@...r.kernel.org>, bpf <bpf@...r.kernel.org>, llvm@...ts.linux.dev Subject: Re: [PATCH bpf-next 02/11] bpf: always emit struct bpf_perf_link BTF From: Song Liu <song@...nel.org> Date: Fri, 15 Apr 2022 16:24:41 -0700 > On Thu, Apr 14, 2022 at 3:45 PM Alexander Lobakin <alobakin@...me> wrote: > > > > When building bpftool with !CONFIG_PERF_EVENTS: > > > > skeleton/pid_iter.bpf.c:47:14: error: incomplete definition of type 'struct bpf_perf_link' > > perf_link = container_of(link, struct bpf_perf_link, link); > > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > tools/bpf/bpftool/bootstrap/libbpf/include/bpf/bpf_helpers.h:74:22: note: expanded from macro 'container_of' > > ((type *)(__mptr - offsetof(type, member))); \ > > ^~~~~~~~~~~~~~~~~~~~~~ > > tools/bpf/bpftool/bootstrap/libbpf/include/bpf/bpf_helpers.h:68:60: note: expanded from macro 'offsetof' > > #define offsetof(TYPE, MEMBER) ((unsigned long)&((TYPE *)0)->MEMBER) > > ~~~~~~~~~~~^ > > skeleton/pid_iter.bpf.c:44:9: note: forward declaration of 'struct bpf_perf_link' > > struct bpf_perf_link *perf_link; > > ^ > > > > &bpf_perf_link is being defined and used only under the ifdef. > > Move it out of the block and explicitly emit a BTF to fix > > compilation. > > > > Fixes: cbdaf71f7e65 ("bpftool: Add bpf_cookie to link output") > > Signed-off-by: Alexander Lobakin <alobakin@...me> > > Similar to v1, this fix is weird to me. I hope we have can fix it in user > space. I've been thinking on this, but userspace is not provided with any autoconf.h definitions (only selftests have them), so its code must be sort of universal. Both this and 01/11 are compile time and due to imcomplete and/or absent BTF struct declarations. I'm not familiar with bpf_core_field_exists(), and it might be that it's able to solve 01/11, but not this one. &bpf_perf_link must be present unconditionally, otherwise it won't be defined in the generated vmlinux.h at all. Thanks, Al
Powered by blists - more mailing lists