Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 164A6606A325 for ; Tue, 1 Dec 2026 20:03:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=uTaMntjY; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=ZmiL8W3X DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Unsubscribe-Post:List-Owner; bh=e1YMqfiJMw60j/lzqHCbN1agfkFN07XOfzS5RsaNAeM=; b=uTaMntjYhI/7hTXPZiVnln3SHR q2WID+DpQHdR84clhbMl7Vf5IejXuPlKXjnq8CILp5yMvAd6G2EHmzQzJcbDJynQkhKuqRNXTXnHW HNPHujQ+/cgNgy6WNHOt+e+urPVg/Z5C3gTg+gRtbucdH/Dh3VyeNt8yDG8IXNUVwRcnmYFo5ig3B dJOthZvk6jtEeCdu8grpB3ZnfFlwzTQSF9yDFg0n+ljLu9pNFfhcsMtriXUwkvatpT7GVLwYzSwo9 5sZ6nhwnW7fSCrY2JUqYI8qZa+jKK3wWx97Uwce1GSZqM4qSmvPFn31U85CxAqR0zbYX32omU2C+H kqP44pjQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xYU4G-00000009IDh-3qVl; Tue, 01 Dec 2026 20:03:12 +0000 Received: from tor.source.kernel.org ([172.105.4.254]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xYU4F-00000009IDb-3f4G for kexec@lists.infradead.org; Tue, 01 Dec 2026 20:03:12 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id 0CAB662299; Tue, 1 Dec 2026 20:03:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2D6931F00898; Tue, 1 Dec 2026 20:03:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796155390; bh=e1YMqfiJMw60j/lzqHCbN1agfkFN07XOfzS5RsaNAeM=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=ZmiL8W3XCd8RJJKYfpxoSypoQ3P+4EeXrti+k36+kLdqrRALq+0Kv8FZaefimkvvf dGXrx430zN3JKO62YzsBBahAzEChhoFibQvHVs0TXG0fK1K/jBaRxPsdNGzAUadME0 HLXy8XYrnF7Z4Ojbo/6pozc5PXrF42f27a3AkcujXVvEgHqVicBe7xYEsu3oLbYWjI JrMfoff7/obP1EGoCRoolxSDCLTENBCOpdZkBvc2Xl3hmIusAab7YDxhFXLPSYrgR9 3ohV9c3Q63Ya6MzD7EplL2XsFddxjfkccmI/9EBW9iZLEm7X55cuWyw409MG4wz+B5 cC5q2oC6O8C8A== Date: Tue, 1 Dec 2026 20:03:08 +0000 From: Simon Horman To: kexec@lists.infradead.org Cc: Tristan Subject: Re: [PATCH kexec-tools 0/3] kexec: bounds and validation fixes for uImage and PE zboot Message-ID: <20261201200308.GA456681@horms.kernel.org> References: <20261110-2x-overflow-v1-0-8f3598b31a43@kernel.org> X-Archived-By: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20261110-2x-overflow-v1-0-8f3598b31a43@kernel.org> X-BeenThere: kexec@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "kexec" X-Spam-Status: No, score=-10.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 On Tue, Nov 10, 2026 at 11:35:15AM +0000, Simon Horman wrote: > Hi, > > This series addresses two bounds validation issues reported by Tristan > when processing untrusted or corrupted kernel images in kexec-tools: > > 1. In uImage_gz_load(), optional gzip header fields (EXTRA_FIELD, > ORIG_NAME, COMMENT, HEAD_CRC) were parsed using unbounded scans and > offset arithmetic without verifying whether the computed offset stayed > within the input buffer. This could lead to out-of-bounds heap reads > or buffer length underflow, crashing kexec. > > Patch 1 first refactors uImage_gz_load() to use a common goto unwind > path for freeing the decompression buffer on error. > Patch 2 adds the necessary bounds and length checks. > > 2. In pez_prepare(), payload_offset and payload_size are 32-bit values > read from untrusted PE zboot headers. Adding them directly could wrap > around, bypassing the bounds check and causing an out-of-bounds read > when staging the payload. > > Patch 3 checks that the buffer is large enough for the header and > avoids wrap-around by using defensive subtraction. > > --- > Simon Horman (3): > uImage: use goto for unwind in uImage_gz_load > uImage: add bounds checks when parsing gzip headers in uImage_gz_load() > pe-zboot: fix integer overflow in payload bounds check in pez_prepare() Applied: - pe-zboot: fix integer overflow in payload bounds check in pez_prepare() https://git.kernel.org/pub/scm/utils/kernel/kexec/kexec-tools.git/commit/?id=0052381b29f3 - uImage: add bounds checks when parsing gzip headers in uImage_gz_load() https://git.kernel.org/pub/scm/utils/kernel/kexec/kexec-tools.git/commit/?id=ea20da8a3db8 - uImage: use goto for unwind in uImage_gz_load https://git.kernel.org/pub/scm/utils/kernel/kexec/kexec-tools.git/commit/?id=a315e6248d5f