From: Hungyu Lin <dennylin0707@gmail.com>
To: andrii@kernel.org, bpf@vger.kernel.org
Cc: ast@kernel.org, daniel@iogearbox.net, eddyz87@gmail.com,
memxor@gmail.com, martin.lau@linux.dev, song@kernel.org,
yonghong.song@linux.dev, jolsa@kernel.org, emil@etsalapatis.com,
ihor.solodrai@linux.dev, alan.maguire@oracle.com,
shuah@kernel.org, alexis.lothore@bootlin.com,
luisflavieira@gmail.com, ameryhung@gmail.com,
linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org,
dennylin0707@gmail.com
Subject: [PATCH bpf-next v2 0/2] Fix unaligned enum values in btf_dump
Date: Sun, 15 Nov 2026 08:49:21 +0000 [thread overview]
Message-ID: <20261115084923.53182-1-dennylin0707@gmail.com> (raw)
btf_dump_get_enum_value() reads unaligned enum values through
btf_dump_get_bitfield_value() with a zero bit size, which shifts a
__u64 by 64. Patch 1 copies unaligned enum data into an aligned buffer
instead, as btf_dump_int_data() does. Patch 2 adds the tests Alexei
posted in the v1 review.
Changes in v2:
- Describe the undefined shift in the commit log.
- Drop the data_end check, which broke the dump of struct fs_context
without emit_zeroes.
- Add the selftests from the v1 review.
v1: https://lore.kernel.org/bpf/20261113223449.97604-1-dennylin0707@gmail.com/
Hungyu Lin (2):
libbpf: Fix sign extension of unaligned enums in
btf_dump_get_enum_value()
selftests/bpf: Dump unaligned enums and a zeroed fs_context
tools/lib/bpf/btf_dump.c | 13 ++++---------
tools/testing/selftests/bpf/prog_tests/btf_dump.c | 10 +++++++++-
2 files changed, 13 insertions(+), 10 deletions(-)
base-commit: 0021f17128de5dc0b19f1a523f448df2440d8088
--
2.43.0
next reply other threads:[~2026-11-15 8:49 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-15 8:49 Hungyu Lin [this message]
2026-11-15 8:49 ` [PATCH bpf-next v2 1/2] libbpf: Fix sign extension of unaligned enums in btf_dump_get_enum_value() Hungyu Lin
2026-11-15 8:49 ` [PATCH bpf-next v2 2/2] selftests/bpf: Dump unaligned enums and a zeroed fs_context Hungyu Lin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261115084923.53182-1-dennylin0707@gmail.com \
--to=dennylin0707@gmail.com \
--cc=alan.maguire@oracle.com \
--cc=alexis.lothore@bootlin.com \
--cc=ameryhung@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=emil@etsalapatis.com \
--cc=ihor.solodrai@linux.dev \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=luisflavieira@gmail.com \
--cc=martin.lau@linux.dev \
--cc=memxor@gmail.com \
--cc=shuah@kernel.org \
--cc=song@kernel.org \
--cc=yonghong.song@linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®