This is a note to let you know that I've just added the patch titled bpftool: Fix handling enum64 in btf dump sorting to the 6.11-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: bpftool-fix-handling-enum64-in-btf-dump-sorting.patch and it can be found in the queue-6.11 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. commit b149f7bd5a98c0e0ec10bb9258eb6ddb1c23196c Author: Mykyta Yatsenko <yatsenko@xxxxxxxx> Date: Mon Sep 2 18:17:21 2024 +0100 bpftool: Fix handling enum64 in btf dump sorting [ Upstream commit b0222d1d9e6f8551a056b89b0bff38f515f3c9b5 ] Wrong function is used to access the first enum64 element. Substituting btf_enum(t) with btf_enum64(t) for BTF_KIND_ENUM64. Fixes: 94133cf24bb3 ("bpftool: Introduce btf c dump sorting") Signed-off-by: Mykyta Yatsenko <yatsenko@xxxxxxxx> Signed-off-by: Daniel Borkmann <daniel@xxxxxxxxxxxxx> Acked-by: Quentin Monnet <qmo@xxxxxxxxxx> Link: https://lore.kernel.org/bpf/20240902171721.105253-1-mykyta.yatsenko5@xxxxxxxxx Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx> diff --git a/tools/bpf/bpftool/btf.c b/tools/bpf/bpftool/btf.c index 6789c7a4d5ca1..3b57ba095ab61 100644 --- a/tools/bpf/bpftool/btf.c +++ b/tools/bpf/bpftool/btf.c @@ -561,9 +561,10 @@ static const char *btf_type_sort_name(const struct btf *btf, __u32 index, bool f case BTF_KIND_ENUM64: { int name_off = t->name_off; - /* Use name of the first element for anonymous enums if allowed */ - if (!from_ref && !t->name_off && btf_vlen(t)) - name_off = btf_enum(t)->name_off; + if (!from_ref && !name_off && btf_vlen(t)) + name_off = btf_kind(t) == BTF_KIND_ENUM64 ? + btf_enum64(t)->name_off : + btf_enum(t)->name_off; return btf__name_by_offset(btf, name_off); }