From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 33B72D711CE for ; Fri, 19 Dec 2025 00:26:09 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vWOJC-0000AG-Fa; Thu, 18 Dec 2025 19:25:26 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vWOJB-00008T-52; Thu, 18 Dec 2025 19:25:25 -0500 Received: from out-184.mta0.migadu.com ([2001:41d0:1004:224b::b8]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vWOJ8-0005ve-Hz; Thu, 18 Dec 2025 19:25:24 -0500 Message-ID: <4afaf7a0-b7c6-4bf9-bcf3-875f2f633464@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1766103910; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jgq+w2hFc+ilQWvLOB6ixtwANacmdk8l9MSSTELX7lQ=; b=DONIoAneWMBffok1cSr2rNOO74ahxWJS20Vojl725OThmeTJy2I46kDkXwLQ2/AfKiPuv8 OEz9BvBp41iKkeXsCln6NEO2bDqFJj7pLMXD/KzxC/qhmhooeyUr+ReBVysgbB+EfKvsge wpjEOzlkW+Ubc1yEgGlnmWtfXI1TNQs= Date: Fri, 19 Dec 2025 08:24:59 +0800 MIME-Version: 1.0 Subject: Re: [PATCH 1/2] hw/virtio/virtio-crypto: verify asym request size To: Mauro Matteo Cascella Cc: qemu-devel@nongnu.org, mst@redhat.com, arei.gonglei@huawei.com, nakamurajames123@gmail.com, qemu-security@nongnu.org References: <20251214090939.408436-1-zhenwei.pi@linux.dev> <20251214090939.408436-2-zhenwei.pi@linux.dev> Content-Language: en-US X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: zhenwei pi In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT Received-SPF: pass client-ip=2001:41d0:1004:224b::b8; envelope-from=zhenwei.pi@linux.dev; helo=out-184.mta0.migadu.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org On 12/18/25 18:43, Mauro Matteo Cascella wrote: > On Sun, Dec 14, 2025 at 10:19 AM zhenwei pi wrote: >> >> The total lenght of request is limited by cryptodev config, verify it >> to avoid unexpected request from guest. > > CVE-2025-14876 has been assigned to this bug. > > Thanks, > OK, I suggest the two patches are tagged with this CVE. This root reason of this issue: - the lack of limitation from hw akcipher (this fix) - so huge limitation (almost LONG_MAX bytes) from backend builtin driver (the next fix) >> Fixes: 0e660a6f90a ("crypto: Introduce RSA algorithm") >> Reported-by: AM 이재영 >> Signed-off-by: zhenwei pi >> --- >> hw/virtio/virtio-crypto.c | 7 +++++++ >> 1 file changed, 7 insertions(+) >> >> diff --git a/hw/virtio/virtio-crypto.c b/hw/virtio/virtio-crypto.c >> index 517f2089c5..94dbf9d92d 100644 >> --- a/hw/virtio/virtio-crypto.c >> +++ b/hw/virtio/virtio-crypto.c >> @@ -767,11 +767,18 @@ virtio_crypto_handle_asym_req(VirtIOCrypto *vcrypto, >> uint32_t len; >> uint8_t *src = NULL; >> uint8_t *dst = NULL; >> + uint64_t max_len; >> >> asym_op_info = g_new0(CryptoDevBackendAsymOpInfo, 1); >> src_len = ldl_le_p(&req->para.src_data_len); >> dst_len = ldl_le_p(&req->para.dst_data_len); >> >> + max_len = src_len + dst_len; >> + if (unlikely(max_len > vcrypto->conf.max_size)) { >> + virtio_error(vdev, "virtio-crypto asym too big length"); >> + goto err; >> + } >> + >> if (src_len > 0) { >> src = g_malloc0(src_len); >> len = iov_to_buf(iov, out_num, 0, src, src_len); >> -- >> 2.43.0 >> > >