From b9c8ceca9ce879a77a93385102ef7a79f3fff13a Mon Sep 17 00:00:00 2001 From: Mingpei CAO Date: Tue, 8 Sep 2026 16:49:19 +0000 Subject: [PATCH] libbpf: Fix array comparison in BTF dedup btf_dedup_identical_types() reads both array descriptors from t1, skipping comparisons of their referenced types. This can incorrectly merge distinct structs and corrupt CO-RE relocation metadata. Read the second descriptor from t2. Fixes: 62e23f183839 ("libbpf: Improve BTF dedup handling of "identical" BTF types") Closes: https://lore.kernel.org/bpf/CABzjXVz3iBuump-pXFkefZ5v+2uu4fG61zqRyWD4xmz3PuBycw@mail.gmail.com/ Signed-off-by: Mingpei CAO Signed-off-by: Andrii Nakryiko Link: https://lore.kernel.org/bpf/20260908164920.108074-2-caomingpei@gmail.com --- src/btf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/btf.c b/src/btf.c index c783359..908bd34 100644 --- a/src/btf.c +++ b/src/btf.c @@ -4831,7 +4831,7 @@ recur: return false; a1 = btf_array(t1); - a2 = btf_array(t1); + a2 = btf_array(t2); if (a1->index_type != a2->index_type && !btf_dedup_identical_types(d, a1->index_type, a2->index_type, depth - 1))