From: Andi Kleen <ak@linux.intel.com>
To: Andrii Nakryiko <andrii@kernel.org>
Cc: bpf@vger.kernel.org, linux-mm@kvack.org,
akpm@linux-foundation.org, adobriyan@gmail.com,
shakeel.butt@linux.dev, hannes@cmpxchg.org, osandov@osandov.com,
song@kernel.org, jannh@google.com, linux-fsdevel@vger.kernel.org,
willy@infradead.org, stable@vger.kernel.org
Subject: Re: [PATCH v4 bpf-next 01/10] lib/buildid: harden build ID parsing logic
Date: Thu, 8 Aug 2024 15:24:17 -0700 [thread overview]
Message-ID: <ZrVFkWQU5qpP2yUh@tassilo> (raw)
In-Reply-To: <20240807234029.456316-2-andrii@kernel.org>
> + name_sz = READ_ONCE(nhdr->n_namesz);
> + desc_sz = READ_ONCE(nhdr->n_descsz);
> + new_offs = note_offs + sizeof(Elf32_Nhdr) + ALIGN(name_sz, 4) + ALIGN(desc_sz, 4);
Don't you need to check the name_sz and desc_sz overflows separately?
Otherwise name_sz could be ~0 and desc_sz small (or reversed) and the check
below wouldn't trigger, but still bad things could happen.
> + if (new_offs <= note_offs /* overflow */ || new_offs > note_size)
> + break;
-Andi
next prev parent reply other threads:[~2024-08-08 22:24 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20240807234029.456316-1-andrii@kernel.org>
[not found] ` <20240807234029.456316-3-andrii@kernel.org>
2024-08-08 18:33 ` [PATCH v4 bpf-next 02/10] lib/buildid: add single folio-based file reader abstraction Shakeel Butt
[not found] ` <20240807234029.456316-7-andrii@kernel.org>
2024-08-08 18:40 ` [PATCH v4 bpf-next 06/10] lib/buildid: implement sleepable build_id_parse() API Shakeel Butt
2024-08-08 20:15 ` Andrii Nakryiko
2024-08-08 20:57 ` Jann Horn
2024-08-08 21:23 ` Andrii Nakryiko
2024-08-08 21:02 ` Shakeel Butt
2024-08-08 21:21 ` Andrii Nakryiko
[not found] ` <20240807234029.456316-2-andrii@kernel.org>
2024-08-08 22:24 ` Andi Kleen [this message]
2024-08-08 22:44 ` [PATCH v4 bpf-next 01/10] lib/buildid: harden build ID parsing logic Andrii Nakryiko
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=ZrVFkWQU5qpP2yUh@tassilo \
--to=ak@linux.intel.com \
--cc=adobriyan@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=andrii@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=hannes@cmpxchg.org \
--cc=jannh@google.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=osandov@osandov.com \
--cc=shakeel.butt@linux.dev \
--cc=song@kernel.org \
--cc=stable@vger.kernel.org \
--cc=willy@infradead.org \
/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