From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796478229; b=ozHyI2xgcWozX7lKHfNEiHP696LF7s0o7Pz8Lv5a0J9Zbz4U8wHe6DPQUmDLfvV98iHl RHj1Xsq/UcvovJHqJyaVcDd9sjdc3cXsS2ssM6V41zfNEEFWx68AixiFxB6FcO6L8wV91 e0QJAUEMWiOul0lTJTdGCE0cd37ZhESe3Il/YLi7pCN8shOenyrVQ6n71HXu+wmY0opmi D77wXLdAOb4/ZjYBPeAOfDQvA/3ybv23bkgi5318M22ISeETU3JoLvlzGYou9tJXl6EZ5 hGBIyFpECtwtDEupoWMC51fajIcNxwMClSEcdcPGxla0c8swnSB9oiBN3JVxQwD2xMw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796478229; h=Received:DKIM-Signature:Content-Type:MIME-Version:Message-Id: In-Reply-To:References:Subject:From:To:Cc:Date; bh=kcG6z3NPhpjocrpMyOq4HJtFQkCsMC4TrIfhKHcXPV8=; b=UAJha0kAh1gtaRMiWA0wDQe7D7aY4v5hs+3qsHnB8D2K5u1b+MUtQzlCXRIsOlcQTbgt e4ilAOJ17McYmXekll0kwvY3l0DZJbbxDfIrGmkP0d2N53T9AZw178Jb3ICeKalTzLayt Q/WZBYHn8TG+bYx29XXi6MSNUj69mlqWRdYtwd9+U7dQ+BE9xcdc7gJ2ovVBQoEzDY4LI OqWPFDMmYVHdu7gUPYZ5ANJzLJLAMGmPX2Ph4a9qRA27NFrmWTXvbEKexnuEpHqY05wxt pbr/lJyE8ULenj7SrF5mRuCItutB+9Lrg+8X3mPBOQWkWvyeDhiHSx5ErXjTootdWFA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=TxdDsa7I; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 34A94606A322; Sat, 5 Dec 2026 13:43:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=TxdDsa7I Received: by smtp.kernel.org (Postfix) with ESMTPSA id 044351F00936; Sat, 5 Dec 2026 13:43:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796478228; bh=kcG6z3NPhpjocrpMyOq4HJtFQkCsMC4TrIfhKHcXPV8=; h=In-Reply-To:References:Subject:From:To:Cc:Date; b=TxdDsa7IRyYISrzTcloa6ZP0rcAXH94pXKLMF4tietCfr4i3Fo3FT8J4v79JI48Xz O8mdS3mfZIbyxp7NjeGLxSXbdaWUuTSlisUCSDmLBQuwJJr/nbH14/W2fFVaBRvtMu Q0yQNeoRKj1zNsM7nSsPeK/ecM5UAGqbrIzQCCnIqtdPReBvnDfiMh7O52lpLJapdT o641ALuXL3CKAAYn7n0It+E9OjmXCvsO5r/AuzCjpin8WVMpg/3rbdeMdthkhwHLm8 qx+dApBz9s/cORwXVSo6cMj+5X266kiCi1cPvrh8CLj/4m9qMWkx0h6zKNQ4SpVDBE 5Uxvej/6RdVGQ== Content-Type: multipart/mixed; boundary="===============0484382179714864383==" X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Message-Id: In-Reply-To: <20261205131119.105160-2-blum@kernel.org> References: <20261205131119.105160-2-blum@kernel.org> Subject: Re: [PATCH bpf-next v2] lib/buildid: Avoid wraparound when aligning ELF note sizes From: bot+bpf-ci@kernel.org To: blum@kernel.org,akpm@linux-foundation.org,song@kernel.org,jolsa@kernel.org,ihor.solodrai@linux.dev,ast@kernel.org,daniel@iogearbox.net,andrii@kernel.org,eddyz87@gmail.com,memxor@gmail.com,martin.lau@linux.dev,yonghong.song@linux.dev,emil@etsalapatis.com Cc: blum@kernel.org,bpf@vger.kernel.org,linux-kernel@vger.kernel.org,ast@kernel.org,andrii@kernel.org,daniel@iogearbox.net,martin.lau@kernel.org,eddyz87@gmail.com,yonghong.song@linux.dev,mason@kernel.org,ihor.solodrai@linux.dev Date: Sat, 5 Dec 2026 13:43:46 +0000 (UTC) --===============0484382179714864383== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit > lib/buildid: Avoid wraparound when aligning ELF note sizes TL;DR: Commit message only: it claims note sizes 0xfffffffd-0xffffffff wrapping to 0 is a problem, but the review finds no real behaviour change, and asks what this u64 patch actually fixes. > lib/buildid: Avoid wraparound when aligning ELF note sizes > > For u32 note sizes, ALIGN() wraps the values 0xfffffffd through > 0xffffffff to 0 before check_add_overflow() runs. Parsing can then > continue as if the affected size were 0. > Use u64 for name_sz and desc_sz to avoid alignment wraparound, allowing > check_add_overflow() to reject these malformed notes early. > > Signed-off-by: Thorsten Blum > diff --git a/lib/buildid.c b/lib/buildid.c > --- a/lib/buildid.c > +++ b/lib/buildid.c > @@ -161,7 +161,8 @@ static int parse_build_id(struct freader *r, unsigned char *build_id, __u32 *siz > { > const char note_name[] = "GNU"; > const size_t note_name_sz = sizeof(note_name); > - u32 build_id_off, new_off, note_end, name_sz, desc_sz; > + u32 build_id_off, new_off, note_end; > + u64 name_sz, desc_sz; > const Elf32_Nhdr *nhdr; > const char *data; An earlier version of this patch drew a review comment that only 0xfffffffd, 0xfffffffe and 0xffffffff wrap, that they behave like size 0, and that size 0 is valid in n_namesz and n_descsz and gives the same new_off. The thread is at: https://lore.kernel.org/all/DN8ARGULOD13.2ES34FRWS1M2B@gmail.com/ The commit message still says "Parsing can then continue as if the affected size were 0." Is that an actual problem? In parse_build_id(), new_off still advances by at least sizeof(Elf32_Nhdr) and stays within note_end for such a note. A note with those sizes can never match, since a match needs name_sz == note_name_sz and desc_sz <= BUILD_ID_SIZE_MAX. Could the commit message explain what behavior changes with this patch, given that analysis? --- 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/47525085165 --===============0484382179714864383==--