From: Andrii Nakryiko <andrii@kernel.org>
To: bpf@vger.kernel.org, ast@kernel.org, daniel@iogearbox.net,
martin.lau@kernel.org
Cc: andrii@kernel.org, kernel-team@meta.com
Subject: [PATCH v2 bpf-next 0/3] Fix libbpf BPF skeleton forward/backward compat
Date: Mon, 8 Jul 2024 13:45:37 -0700 [thread overview]
Message-ID: <20240708204540.4188946-1-andrii@kernel.org> (raw)
Fix recently identified (but long standing) bug with handling BPF skeleton
forward and backward compatibility. On libbpf side, even though BPF skeleton
was always designed to be forward and backwards compatible through recording
actual size of constrituents of BPF skeleton itself (map/prog/var skeleton
definitions), libbpf implementation did implicitly hard-code those sizes by
virtue of using a trivial array access syntax.
This issue will only affect libbpf used as a shared library. Statically
compiled libbpfs will always be in sync with BPF skeleton, bypassing this
problem altogether.
This patch set fixes libbpf, but also mitigates the problem for old libbpf
versions by teaching bpftool to generate more conservative BPF skeleton,
if possible (i.e., if there are no struct_ops maps defined).
v1->v2:
- fix SOB, add acks, typo fixes (Quentin, Eduard);
- improve reporting of skipped map auto-attachment (Alan, Eduard).
Andrii Nakryiko (3):
bpftool: improve skeleton backwards compat with old buggy libbpfs
libbpf: fix BPF skeleton forward/backward compat handling
libbpf: improve old BPF skeleton handling for map auto-attach
tools/bpf/bpftool/gen.c | 46 ++++++++++++++++++--------
tools/lib/bpf/libbpf.c | 71 +++++++++++++++++++++++------------------
2 files changed, 72 insertions(+), 45 deletions(-)
--
2.43.0
next reply other threads:[~2024-07-08 20:45 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-08 20:45 Andrii Nakryiko [this message]
2024-07-08 20:45 ` [PATCH v2 bpf-next 1/3] bpftool: improve skeleton backwards compat with old buggy libbpfs Andrii Nakryiko
2024-07-08 22:16 ` Eduard Zingerman
2024-07-08 22:54 ` Eduard Zingerman
2024-07-08 23:20 ` Andrii Nakryiko
2024-07-08 20:45 ` [PATCH v2 bpf-next 2/3] libbpf: fix BPF skeleton forward/backward compat handling Andrii Nakryiko
2024-07-08 20:45 ` [PATCH v2 bpf-next 3/3] libbpf: improve old BPF skeleton handling for map auto-attach Andrii Nakryiko
2024-07-08 23:09 ` Eduard Zingerman
2024-07-10 2:10 ` [PATCH v2 bpf-next 0/3] Fix libbpf BPF skeleton forward/backward compat patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240708204540.4188946-1-andrii@kernel.org \
--to=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=kernel-team@meta.com \
--cc=martin.lau@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox