Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

libbpf: BTF validation can use layout for unknown kinds

BTF parsing can use layout to navigate unknown kinds, so
btf_validate_type() should take layout information into
account to avoid failure when an unrecognized kind is met.

Signed-off-by: Alan Maguire <alan.maguire@oracle.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20260326145444.2076244-6-alan.maguire@oracle.com

authored by

Alan Maguire and committed by
Andrii Nakryiko
6ad89285 d686d92c

+6 -2
+6 -2
tools/lib/bpf/btf.c
··· 746 746 break; 747 747 } 748 748 default: 749 - pr_warn("btf: type [%u]: unrecognized kind %u\n", id, kind); 750 - return -EINVAL; 749 + /* Kind may be represented in kind layout information. */ 750 + if (btf_type_size_unknown(btf, t) < 0) { 751 + pr_warn("btf: type [%u]: unrecognized kind %u\n", id, kind); 752 + return -EINVAL; 753 + } 754 + break; 751 755 } 752 756 return 0; 753 757 }