diff options
| author | Alan Maguire <alan.maguire@oracle.com> | 2026-03-26 17:54:40 +0300 |
|---|---|---|
| committer | Andrii Nakryiko <andrii@kernel.org> | 2026-03-26 23:53:56 +0300 |
| commit | 6ad89285996add14b5d69cb302980bff9032ba2c (patch) | |
| tree | 3c066a2c135e9af889f5fa3d90426a55ce8714ce /tools | |
| parent | d686d92c40803f255af162601d0db38db3efa7fb (diff) | |
| download | linux-6ad89285996add14b5d69cb302980bff9032ba2c.tar.xz | |
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
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/lib/bpf/btf.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/tools/lib/bpf/btf.c b/tools/lib/bpf/btf.c index 35b7fb85e1bb..ceb57b46a878 100644 --- a/tools/lib/bpf/btf.c +++ b/tools/lib/bpf/btf.c @@ -746,8 +746,12 @@ static int btf_validate_type(const struct btf *btf, const struct btf_type *t, __ break; } default: - pr_warn("btf: type [%u]: unrecognized kind %u\n", id, kind); - return -EINVAL; + /* Kind may be represented in kind layout information. */ + if (btf_type_size_unknown(btf, t) < 0) { + pr_warn("btf: type [%u]: unrecognized kind %u\n", id, kind); + return -EINVAL; + } + break; } return 0; } |
