BPF List
 help / color / mirror / Atom feed
From: Mingpei CAO <caomingpei@gmail.com>
To: bpf@vger.kernel.org
Cc: Mingpei CAO <caomingpei@gmail.com>,
	alexei.starovoitov@gmail.com, andrii@kernel.org,
	eddyz87@gmail.com, alan.maguire@oracle.com
Subject: [PATCH bpf v2 0/2] libbpf: Fix array comparison in BTF dedup
Date: Tue,  8 Sep 2026 16:49:18 +0000	[thread overview]
Message-ID: <20260908164920.108074-1-caomingpei@gmail.com> (raw)

The recursive array comparison in BTF dedup reads both descriptors from
the first type. This can merge distinct structures and corrupt CO-RE
relocation metadata. Fix the comparison and add three regression cases to
the existing BTF dedup tests.

Changes in v2:
- Move the tests into prog_tests/btf.c using Alan Maguire's two cases.
- Add a separate negative case with the same index type to isolate
  element-type comparison.
- Keep patch 1 unchanged.

v1: https://lore.kernel.org/bpf/20260907131021.34343-1-caomingpei@gmail.com/
Report: https://lore.kernel.org/bpf/CABzjXVz3iBuump-pXFkefZ5v+2uu4fG61zqRyWD4xmz3PuBycw@mail.gmail.com/

Validation with a focused runner using the existing selftest sources and
assertions:
- 52 existing BTF cases passed before and after the fix.
- Both negative cases failed before the fix and passed afterwards.
- The positive case passed before and after the fix.

Mingpei CAO (2):
  libbpf: Fix array comparison in BTF dedup
  selftests/bpf: Test array element comparison in BTF dedup

 tools/lib/bpf/btf.c                          |   2 +-
 tools/testing/selftests/bpf/prog_tests/btf.c | 126 +++++++++++++++++++
 2 files changed, 127 insertions(+), 1 deletion(-)


base-commit: df2908090cda368b01ff43709f51890076c56157
-- 
2.43.0

             reply	other threads:[~2026-09-08 16:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-08 16:49 Mingpei CAO [this message]
2026-09-08 16:49 ` [PATCH bpf v2 1/2] libbpf: Fix array comparison in BTF dedup Mingpei CAO
2026-09-08 17:01   ` sashiko-bot
2026-09-08 16:49 ` [PATCH bpf v2 2/2] selftests/bpf: Test array element " Mingpei CAO
2026-09-08 23:40 ` [PATCH bpf v2 0/2] libbpf: Fix array " 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=20260908164920.108074-1-caomingpei@gmail.com \
    --to=caomingpei@gmail.com \
    --cc=alan.maguire@oracle.com \
    --cc=alexei.starovoitov@gmail.com \
    --cc=andrii@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=eddyz87@gmail.com \
    /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