Skip to content

Commit 0f718a5

Browse files
libbpf: Fix incorrect traversal end type ID when marking BTF_IS_EMBEDDED
JIRA: https://issues.redhat.com/browse/RHEL-85486 commit 5ca681a Author: Pu Lehui <[email protected]> Date: Wed Jan 15 10:02:40 2025 +0000 libbpf: Fix incorrect traversal end type ID when marking BTF_IS_EMBEDDED When redirecting the split BTF to the vmlinux base BTF, we need to mark the distilled base struct/union members of split BTF structs/unions in id_map with BTF_IS_EMBEDDED. This indicates that these types must match both name and size later. Therefore, we need to traverse the entire split BTF, which involves traversing type IDs from nr_dist_base_types to nr_types. However, the current implementation uses an incorrect traversal end type ID, so let's correct it. Fixes: 19e00c8 ("libbpf: Split BTF relocation") Signed-off-by: Pu Lehui <[email protected]> Signed-off-by: Andrii Nakryiko <[email protected]> Link: https://lore.kernel.org/bpf/[email protected] Signed-off-by: Jerome Marchand <[email protected]>
1 parent 6f0a78f commit 0f718a5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tools/lib/bpf/btf_relocate.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ static int btf_relocate_map_distilled_base(struct btf_relocate *r)
212212
* need to match both name and size, otherwise embedding the base
213213
* struct/union in the split type is invalid.
214214
*/
215-
for (id = r->nr_dist_base_types; id < r->nr_split_types; id++) {
215+
for (id = r->nr_dist_base_types; id < r->nr_dist_base_types + r->nr_split_types; id++) {
216216
err = btf_mark_embedded_composite_type_ids(r, id);
217217
if (err)
218218
goto done;

0 commit comments

Comments
 (0)