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=1796049523; b=Ydt1XGIsS6kNK+CFhTobWcp6nyzeHz/1sOIaS1c3yJGaK76LyByYg/sjLiyTPqC9fD9a KJvI0R8nfWBectsUoFsYXc5L06jPu0ppFCAr0ud3YEOoCJT3jUfo4pxJ0M/lyDeTQ49Ma b9aqn/lBlBRNa+3ZF+vjwn+Hr8ZATo2t0kgEu+oNDNLyT3SpV9knhAaThCZNSddyyXRYy YKDrTKAGeob1BPsB0egEkRLV8v3VF3HGfCzH5LLd2HQywfaUF9HCeWEsDwxboMmUKiB9R gb7p2zDOdmHM92skarnM6CIty+rb2G+8pKQ74Mg8r1CDmpOOfsUFZnIW5CIFI/k0oHQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796049523; h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID: References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=z+BdV5Al7keMbkiXtIKOmVGiXNtdY3yhPItaKjiESqo=; b=mU6/MMQXxrRM710fTZ40gzIj3995Ws3iQmZqZliYDQJmeSKs1sJZiI6mA7QunUPX67GU a5VcpI0wX9XHI7GpoyF4/c0crgzJjtyo+stCbxCJi+TM6qVKITVCBteh1eCKlBIkW0m9u iEmUnALElHOvmzUSZVKzFA4pWTHfA2HmDcfn6PZ6JfhoZ0nao9nIgc2qjAWRQhmqMssxC NBSsNs8DMU7Vw2EZ2TzFYPU7a8snrEuiaALsDP9qxVy6dJ971sXaUi7r5FQ27xnG0E+CQ zcbIDPmVppcNfm7fLOoW2wL4AYcYwjKWAjnGyAUWfXlqH6h6tZBFfegGaVkwijCd89g== 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=diAkbAPr; 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 B0D3C606A325; Mon, 30 Nov 2026 14:38:43 +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=diAkbAPr Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2BB9B1F0092F; Mon, 30 Nov 2026 14:38:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796049523; bh=z+BdV5Al7keMbkiXtIKOmVGiXNtdY3yhPItaKjiESqo=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=diAkbAPrNeCHQBatvkfznN38PCsrWV81oCcqJ8y0a3fzBMMsszgxojs4YCl9lqe2r Lw/YOO2OkYaCEI+PursdDJBPgll8N5duQ79KNUAYwZXBeSmFoK9uCwG6bMYELAREy7 sU7KJDn/M5+PztaeUidjGdtXXBbNE+DqxnkvAW7o4ospdjqXvQ/3CqbPqRQwZ/na1y 9J695fqb2uMUC0m+e0Ur+9bgK3wcjSQn5obFw4+hmJDdm1WR28rY3grH3YzcuAtWWe 4FsnDLD7GUSv9OXO2faiC4pr1yAqegm+q7H3xiTLUvF5beyjh/8Za/xJXyhCbgNpti MKzw1RXQrNXAQ== Date: Mon, 30 Nov 2026 14:38:36 +0000 From: Lee Jones To: Sahil Malhotra Cc: herbert@gondor.apana.org.au, horia.geanta@nxp.com, pankaj.gupta@nxp.com, davem@davemloft.net, kernel@pengutronix.de, meenakshi.aggarwal@nxp.com, Keisuke Tsukuda , linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH 01/10] crypto: caam - Fix descriptor buffer overflow in caam_process_blob() Message-ID: <20261130143836.GA90630@joneslee-mac.roam.internal> References: <20261123151055.2533735-1-lee@kernel.org> <20261123151055.2533735-2-lee@kernel.org> <20261130102632.4032882-1-sahil.malhotra@oss.nxp.com> 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 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20261130102632.4032882-1-sahil.malhotra@oss.nxp.com> On Mon, 30 Nov 2026, Sahil Malhotra wrote: > On Mon, Nov 23, 2026 at 03:09:52PM +0000, Lee Jones wrote: > > However, CAAM_BLOB_DESC_BYTES_MAX was not updated and still reserves > > only 44 or 52 bytes (for 32-bit or 64-bit DMA addresses), whereas > > caam_process_blob() now writes up to 60 bytes for standard blobs on > > 64-bit DMA platforms and up to 72 or 88 bytes when encapsulating a > > protected key, overflowing the kzalloc()-allocated job descriptor > > buffer into adjacent slab memory. > > [...] > > > Update CAAM_BLOB_DESC_BYTES_MAX to account for the protected-key > > commands and the extended sequence pointer length words. > > Hi Lee, > > Thanks for the patch. > > The analysis is correct, and the new macro covers the worst case of the > current code. > > Keisuke Tsukuda has posted a fix for the same overflow: > > https://lore.kernel.org/linux-crypto/20261124002830.35444-1-tkdkei@outlook.jp/ > > It drops CAAM_BLOB_DESC_BYTES_MAX and allocates CAAM_DESC_BYTES_MAX, > the hardware limit for a job descriptor. I would prefer that approach. > The overflow came from the hand-written size falling out of sync with > the descriptor code, and a fixed maximum avoids the same problem the > next time a command is added. > > Only one of the two should go in. Unless Herbert prefers this version, > please drop this patch from the series and let Keisuke's go in. No problem. -- Lee Jones