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=1796383341; b=Fv3O0WGcXPdKxOmFzp/2fMulKb5bOmY9HUNVUv0NfwfB1FK7f2eIbw6cmvgw042DAb9U YLHE5WXmRjC+zhUWdlG6gBskFpD7JOLAe4lxlvdGVqIuW2fhhVC3UzZcI2jN2rqLOG7ZW EU2e4b9yDY6gXKa7M/1ZAlnLaqMgTiH3Wo9atmfxS+ysCkUUQxx8ENIiqqjrwPuwa9SU8 OBTpNOPhnyj1a4mkSP9krGh88TqQMjOsKqih7XVtTQMv6HU7JJjNAXnQ/Lnwjh6hNgfeW 2lNqdwc650AgGKL3FPYuhhncwX8nI0BpWjdxgMnLMWQNBqdZMXLokTMUNqaQb8SW2fA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796383341; 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=S6p5z9larvvzJPfJOwihdG62pymARdJcFU5x6P6zBwc=; b=xeLLVmth1lfo84xKRmX3OHRn5kqCWhFj1deS3fWFxi203iaMf28RFtvJ1EvpV96W7sqQ /bkNFnwUlIhkXCny2ihw+mIFsGb9ZU4BEpOs/u5nEDt2rXjit1cDtII9xQ0BTAV/AcxkI CwL+U4mEzZij7HQ9bl5dJEMoDAW2K88aUD4qmXmveVuAKB32KqRCr0eqiSqzkcquYSh7E x25En1l9xrCy4Zr9Cl7ytj9bJwyytWE/Xe+Q8+i6iiLuwwMSg30TKeK9IK8cYFI9vdN4p nyp64XAWVC9ZmMPjfZ17S8ddgtywvmJHbDH8um/fxxnPx7j024UHgw6LrR65uPo1EFQ== 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=iTrGq4Gu; 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 86A01606A330; Fri, 4 Dec 2026 11:22:21 +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=iTrGq4Gu Received: by smtp.kernel.org (Postfix) with ESMTPSA id F3A181F000CE; Fri, 4 Dec 2026 11:22:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796383341; bh=S6p5z9larvvzJPfJOwihdG62pymARdJcFU5x6P6zBwc=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=iTrGq4GuOiDwFFWWXxS6pCrM3TQtgErn51DJq4FmzKu+1R7672e+LTga7o7iHAP0Z SkcpfGzqxfmi9hcju/n8HX6s2HyjO1ntEwZMw5KxNlC4gxUCnpWebSG6pAJ90n9ipo 8lmhjuls73Ln14v3bkzsPQ2c4sIekbMOS4ETG4BA= 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.12 186/555] s390/cert_store: Fix out-of-bounds read in pr_dbf_vce() Date: Fri, 4 Dec 2026 19:03:49 +0900 Message-ID: <20261204100615.255337031@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100603.988357525@linuxfoundation.org> References: <20261204100603.988357525@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.12-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 f4f604e1f67c9..1048428c15b1e 100644 --- a/arch/s390/kernel/cert_store.c +++ b/arch/s390/kernel/cert_store.c @@ -180,6 +180,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); @@ -205,11 +206,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