From: bot+bpf-ci@kernel.org
To: lgs201920130244@gmail.com,andrii@kernel.org,eddyz87@gmail.com,ast@kernel.org,daniel@iogearbox.net,memxor@gmail.com,martin.lau@linux.dev,song@kernel.org,yonghong.song@linux.dev,jolsa@kernel.org,emil@etsalapatis.com,varunrmallya@gmail.com,bpf@vger.kernel.org,linux-kernel@vger.kernel.org
Cc: lgs201920130244@gmail.com,ast@kernel.org,andrii@kernel.org,daniel@iogearbox.net,martin.lau@kernel.org,eddyz87@gmail.com,yonghong.song@linux.dev,clm@meta.com,ihor.solodrai@linux.dev
Subject: Re: [PATCH] libbpf: Limit bitfield dump reads to checked bytes
Date: Wed, 8 Jul 2026 03:49:01 +0000 (UTC) [thread overview]
Message-ID: <806266240f4dc8a44be70cc8abac6111fb15405c657d706f6045522e05746289@mail.kernel.org> (raw)
In-Reply-To: <20260708025807.702010-1-lgs201920130244@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1500 bytes --]
> diff --git a/tools/lib/bpf/btf_dump.c b/tools/lib/bpf/btf_dump.c
> index 53c6624161d7..d82e8e425203 100644
> --- a/tools/lib/bpf/btf_dump.c
> +++ b/tools/lib/bpf/btf_dump.c
[ ... ]
> @@ -1784,13 +1788,13 @@ static int btf_dump_get_bitfield_value(struct btf_dump *d,
> * stored in num, then we left/right shift num to eliminate irrelevant bits.
> */
> #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
> - for (i = t->size - 1; i >= 0; i--)
> + for (i = nr_bytes - 1; i >= 0; i--)
> num = num * 256 + bytes[i];
> - nr_copy_bits = bit_sz + bits_offset;
> + nr_copy_bits = bit_sz ? bit_sz + bits_offset : nr_bytes * 8;
> #elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
> - for (i = 0; i < t->size; i++)
> + for (i = 0; i < nr_bytes; i++)
> num = num * 256 + bytes[i];
> - nr_copy_bits = t->size * 8 - bits_offset;
> + nr_copy_bits = nr_bytes * 8 - bits_offset;
Varun R Mallya asked in v2 for examples that can break the older
implementation, preferably with an ASAN report to justify the change.
Could you provide a test case or ASAN report demonstrating the issue? Without
demonstrable evidence of the OOB read, it's hard to evaluate whether this
change is necessary.
The previous review is at:
https://lore.kernel.org/bpf/akugPNylTrOa_bNn@computer
---
AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md
CI run summary: https://github.com/kernel-patches/bpf/actions/runs/28914496440
prev parent reply other threads:[~2026-07-08 3:49 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-08 2:58 Guangshuo Li
2026-07-08 3:49 ` bot+bpf-ci [this message]
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=806266240f4dc8a44be70cc8abac6111fb15405c657d706f6045522e05746289@mail.kernel.org \
--to=bot+bpf-ci@kernel.org \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=clm@meta.com \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=emil@etsalapatis.com \
--cc=ihor.solodrai@linux.dev \
--cc=jolsa@kernel.org \
--cc=lgs201920130244@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=martin.lau@kernel.org \
--cc=martin.lau@linux.dev \
--cc=memxor@gmail.com \
--cc=song@kernel.org \
--cc=varunrmallya@gmail.com \
--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®