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=1796381768; b=gp2sWnPa2mWSgsrgGQsWugQeAmk5PR6t9t/PUsRgGgs3WK5OZH8t7BOskpWfZhYdFGn1 hH8VFcWGqBms/eiu/1NBLKltBQtj8z42m15Bo0pGVWfNhdMrEE7AxldPVAxTiT+lG6VWx zj8dbAnL9bnTNdjCCkz9ICRQiExfCAjZe6yhNQztq1V3jc3uY2yju64MzvFODS+KeIPD5 yhB2qyHZeZTiVAaLzhPvYMeCpcpOL78JDLCkxXVgD22Cw9IZGjhyDjxiD84jlpqriKsA5 GadMkYu8hr+DrxNq/gHwzsmtd53Njro9DQ1mZKYw5bfA6WmoXCAeqLMvjEnCy+v7TyA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796381768; 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=VHDzQgA93YPqfCGw3gdPVW4p/PGtub/z62zEI4q974Q=; b=lUDh1pMwQy2X0idYSCZRalFPJbyGwApvYOLvZZgjtsUPnkqQY7W/mE1FQdqJP3r4CsvF AXVoMecqH4szr6+hLrhaZsu+hfr5942z9ZCWre3KpXJXb6fFNAOXCHRimOZtSvQFU9apy HRIZ55XjvrErdkLyGvSJ5fUqogW05NY/GFW5rUsc4eXJxfIcqLLwBBgqe0SSo9ffYXPiq X6UUGUnEEJymf7xs0zQvom5eIuxw9ED14RwX9SjrLMG0/yBSj3QdHSl0G0n1Oe6s6Mt1G srxlwcT981laGDbGPcUmqkS4d/os5Wb86R8QBIEdmcyiJTN+vVMtSWjkK7Hj4celM4Q== 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=GSMB4XYt; 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 D1E89606A330; Fri, 4 Dec 2026 10:56:08 +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=GSMB4XYt Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4F96F1F00931; Fri, 4 Dec 2026 10:56:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796381768; bh=VHDzQgA93YPqfCGw3gdPVW4p/PGtub/z62zEI4q974Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=GSMB4XYtMCi1nxA8Fcz7KgP/wqJLce22FNHSKXAPrqJlxWNQesFk2LFjgxFoRpxs+ tecnxuRn8qwvmiS8LPhobO9mP229jnBk1Nu10aFse1KuyNQCqw+FJF5sf09SIlQRd+ Y/1OaGl6gMhLp/3eFok/+d2EFXsnwGA7CO2Di770= 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.18 165/703] s390/cert_store: Fix out-of-bounds read in pr_dbf_vce() Date: Fri, 4 Dec 2026 19:01:04 +0900 Message-ID: <20261204100632.275116709@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100627.522266145@linuxfoundation.org> References: <20261204100627.522266145@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.18-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 ff8b3dd0fc633..6acec6d5ba604 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