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=1796386239; b=cva5K63HitBgvhmh1ZrahLyVYfLdkT9iQtZaspNhen7yp5GA6Ju5dRprPJLqtAp13gl9 7KB0qwNjNZY9KlF/s9f7uoxD09ACwvQbngoJpJVl3XNkU0uvyWpDEoU9I9U3hk6PJZFTN pfIcuvV4AMFMpbdq8nG0XWXiBrnql+dgWJrEI/pDyfYJcV0mJBFfBCiUyqQKxRVEPRzaz 1rJbt78aKT4u0RbIBjC3UvGgNVa7KVrN1ZJIVipNABGHpwknVZPNF4LsGmGxh+urx8o51 BDtP5GCkDzMqFkDt2DDkp2wIWl45Ox4jJSHcNnn3UvpFpHk3KTL2i0RkkveoVacaRYQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796386239; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=ie+imlXOL5bepdFoTjnjJJ6L35GUXm/NhzkPRGE2WZg=; b=g1d6Pw9zVGmad5IbFdUCOWy1LjjQphB1k5xlX3PrNK5J/dDVcNk6mgQI6yYAIBCn4o+w vURP6hGlRsQedVSG3s6OjBhli0yqbWIxXASxfR4/iBPb/Mq9SMIyXqY0T1pIPRO/iilAK EARNf+4K9i7TM18N2Y7pe8XnDVfWw+yYTG/Lv7BALwdIfMjE36kVz0f3/ddO6AOhHoXt4 D/MgnTRN18kUdWd1FW96T3nuctEuQ+32c5A6a0y6q6voE1RCDaKM4hK0+R+x2pAVZjLFZ ZfuzSanOsZyoUQfCM5wtvV5Ieih1cVQEbNVwwFvJo5Oamhsa5D6peKP6z7fWUEzwggA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=zqNAvfEZ; 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 07B6D606A322; Fri, 4 Dec 2026 12:10:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=zqNAvfEZ Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0F7941F00931; Fri, 4 Dec 2026 12:10:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796386238; bh=ie+imlXOL5bepdFoTjnjJJ6L35GUXm/NhzkPRGE2WZg=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=zqNAvfEZL5yXBCpyFOrXPz0mYs2oFnvkN2W0G7yYxcONNnCp/kLdNvDjKLttKjNmX ZJ7wFsGV3rCx2wXrI1MYR2C1rXS640PagWTfuHTmETiLmaJP0aOvElSfMzVMaHA06T RZ07R9DB/Rj4+wQMHXZUsG3LCuuNdhcpeDXeoNlg= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Alexander Gordeev , Heiko Carstens , Sasha Levin Subject: [PATCH 6.6 0881/1167] s390/cert_store: Fix out-of-bounds read in pr_dbf_vce() Date: Fri, 4 Dec 2026 19:05:08 +0900 Message-ID: <20261204100725.115866253@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100702.047403948@linuxfoundation.org> References: <20261204100702.047403948@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Heiko Carstens [ Upstream commit 539cf27f0b090d84438b7da9045a271a947192ed ] pr_dbf_vce() dumps the last 128 bytes of the certificate data of a Verification Certificate Entry (VCE) into a debug area. However the address calculation is wrong: vce_length is the length of the whole entry including the header, while cert_data_buf starts behind the header. Therefore the dump starts at the end of the entry and starts reading behind it. Dump the last 128 bytes of the entry like intended. Limit dumps to the data length. Fixes: 8cf57d7217c3 ("s390: add support for user-defined certificates") Acked-by: Alexander Gordeev Signed-off-by: Heiko Carstens Signed-off-by: Alexander Gordeev Signed-off-by: Sasha Levin --- arch/s390/kernel/cert_store.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/arch/s390/kernel/cert_store.c b/arch/s390/kernel/cert_store.c index 71a840a18ab2e..0402803aeefd2 100644 --- a/arch/s390/kernel/cert_store.c +++ b/arch/s390/kernel/cert_store.c @@ -179,6 +179,7 @@ static void pr_dbf_vce(const struct vce *e) { unsigned char vc_name[VC_NAME_LEN_BYTES + 1]; char log_string[VC_NAME_LEN_BYTES + 40]; + u32 data_len = 0; pr_dbf_msg("VCE Header:"); pr_dbf_msg("vce_hdr.vce_length: %d", e->vce_hdr.vce_length); @@ -204,11 +205,13 @@ static void pr_dbf_vce(const struct vce *e) debug_text_event(cert_store_hexdump, 3, log_string); /* Certificate data. */ + if (e->vce_hdr.vce_length > sizeof(e->vce_hdr)) + data_len = e->vce_hdr.vce_length - sizeof(e->vce_hdr); debug_text_event(cert_store_hexdump, 3, "VCE: Certificate data start"); - debug_event(cert_store_hexdump, 3, (u8 *)e->cert_data_buf, 128); + debug_event(cert_store_hexdump, 3, (u8 *)e->cert_data_buf, min(data_len, 128U)); debug_text_event(cert_store_hexdump, 3, "VCE: Certificate data end"); - debug_event(cert_store_hexdump, 3, - (u8 *)e->cert_data_buf + e->vce_hdr.vce_length - 128, 128); + if (data_len > 128) + debug_event(cert_store_hexdump, 3, (u8 *)e + e->vce_hdr.vce_length - 128, 128); } static void pr_dbf_vcssb(const struct vcssb *s) -- 2.53.0