All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH bpf-next 0/2] Deduplicate type compat check
@ 2022-06-22 17:35 Daniel Müller
  2022-06-22 17:35 ` [PATCH bpf-next 1/2] libbpf: Move core "types_are_compat" logic into relo_core.c Daniel Müller
  2022-06-22 17:35 ` [PATCH bpf-next 2/2] bpf: Use bpf_core_types_are_compat functionality from relo_core.c Daniel Müller
  0 siblings, 2 replies; 7+ messages in thread
From: Daniel Müller @ 2022-06-22 17:35 UTC (permalink / raw)
  To: bpf, ast, andrii, daniel, kernel-team

BPF type compatibility checks (bpf_core_types_are_compat()) are currently
duplicated between kernel and user space. That's a historical artifact more than
intentional doing and can lead to subtle bugs where one implementation is
adjusted but another is forgotten.

That happened with the enum64 work, for example, where the libbpf side was
changed (commit 23b2a3a8f63a ("libbpf: Add enum64 relocation support")) to use
the btf_kind_core_compat() helper function but the kernel side was not (commit
6089fb325cf7 ("bpf: Add btf enum64 support")).

This patch set addresses both the duplication issue and fixes the alluded to
kind check.

For discussion of the topic, please refer to:
https://lore.kernel.org/bpf/CAADnVQKbWR7oarBdewgOBZUPzryhRYvEbkhyPJQHHuxq=0K1gw@mail.gmail.com/T/#mcc99f4a33ad9a322afaf1b9276fb1f0b7add9665

Daniel Müller (2):
  libbpf: Move core "types_are_compat" logic into relo_core.c
  bpf: Use bpf_core_types_are_compat functionality from relo_core.c

 kernel/bpf/btf.c          | 86 +--------------------------------------
 tools/lib/bpf/libbpf.c    | 72 +-------------------------------
 tools/lib/bpf/relo_core.c | 78 +++++++++++++++++++++++++++++++++++
 tools/lib/bpf/relo_core.h |  2 +
 4 files changed, 83 insertions(+), 155 deletions(-)

-- 
2.30.2


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

end of thread, other threads:[~2022-06-23 19:08 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-22 17:35 [PATCH bpf-next 0/2] Deduplicate type compat check Daniel Müller
2022-06-22 17:35 ` [PATCH bpf-next 1/2] libbpf: Move core "types_are_compat" logic into relo_core.c Daniel Müller
2022-06-22 22:19   ` Daniel Müller
2022-06-23  4:15     ` Andrii Nakryiko
2022-06-23  4:15   ` Andrii Nakryiko
2022-06-23 18:13     ` Daniel Müller
2022-06-22 17:35 ` [PATCH bpf-next 2/2] bpf: Use bpf_core_types_are_compat functionality from relo_core.c Daniel Müller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.