BPF List
 help / color / mirror / Atom feed
* [PATCH v2 bpf-next 0/3] Fix libbpf BPF skeleton forward/backward compat
@ 2024-07-08 20:45 Andrii Nakryiko
  2024-07-08 20:45 ` [PATCH v2 bpf-next 1/3] bpftool: improve skeleton backwards compat with old buggy libbpfs Andrii Nakryiko
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Andrii Nakryiko @ 2024-07-08 20:45 UTC (permalink / raw)
  To: bpf, ast, daniel, martin.lau; +Cc: andrii, kernel-team

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


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2024-07-10  2:10 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-08 20:45 [PATCH v2 bpf-next 0/3] Fix libbpf BPF skeleton forward/backward compat Andrii Nakryiko
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox