The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: "Alexei Starovoitov" <alexei.starovoitov@gmail.com>
To: "Thorsten Blum" <blum@kernel.org>,
	"Daniel Borkmann" <daniel@iogearbox.net>,
	"Andrii Nakryiko" <andrii@kernel.org>,
	"Eduard Zingerman" <eddyz87@gmail.com>,
	"Kumar Kartikeya Dwivedi" <memxor@gmail.com>,
	"Martin KaFai Lau" <martin.lau@linux.dev>,
	"Song Liu" <song@kernel.org>,
	"Yonghong Song" <yonghong.song@linux.dev>,
	"Jiri Olsa" <jolsa@kernel.org>,
	"Emil Tsalapatis" <emil@etsalapatis.com>,
	"Ihor Solodrai" <ihor.solodrai@linux.dev>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	"Shakeel Butt" <shakeel.butt@linux.dev>
Cc: <bpf@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] lib/buildid: Prevent overflow when aligning ELF note sizes
Date: Mon, 30 Nov 2026 05:30:37 +0000	[thread overview]
Message-ID: <DN8ARGULOD13.2ES34FRWS1M2B@gmail.com> (raw)
In-Reply-To: <20261123142510.51241-2-blum@kernel.org>

On Mon, Nov 23, 2026 at 06:25 AM Thorsten Blum <blum@kernel.org> wrote:
> Commit de3ec364c3c3 ("lib/buildid: add single folio-based file reader
> abstraction") changed name_sz and desc_sz from u64 to u32. As a result,
> ALIGN() could wrap malformed sizes near U32_MAX to 0, which would allow
> such values to bypass the overflow checks and parsing to continue with
> an incorrect note offset.

That's not a fix. Nothing is broken.
Only 0xfffffffd, 0xfffffffe and 0xffffffff wrap. They act like size 0.
Size 0 is valid in n_namesz and n_descsz and gives the same new_off.
new_off still moves by 12 bytes or more and stays within note_end.
Such a note never matches: that needs name_sz == 4 and desc_sz <= 20.

pw-bot: cr

      reply	other threads:[~2026-11-30  5:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-23 14:25 [PATCH] lib/buildid: Prevent overflow when aligning ELF note sizes Thorsten Blum
2026-11-30  5:30 ` Alexei Starovoitov [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=DN8ARGULOD13.2ES34FRWS1M2B@gmail.com \
    --to=alexei.starovoitov@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=andrii@kernel.org \
    --cc=blum@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=martin.lau@linux.dev \
    --cc=memxor@gmail.com \
    --cc=shakeel.butt@linux.dev \
    --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