Message ID | 169641301005.3135.2308946231716648881.tip-bot2@tip-bot2 |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:254a:b0:403:3b70:6f57 with SMTP id hf10csp13094vqb; Wed, 4 Oct 2023 02:50:21 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGn82ylcoTlQfouwfcGZ8xPzfvoJNIzgyt1Ixqt5FqqZ26xmc2HBQZZhGjZVav5zuR7CP3X X-Received: by 2002:a05:6a20:12d6:b0:13e:90aa:8c8b with SMTP id v22-20020a056a2012d600b0013e90aa8c8bmr2798107pzg.4.1696413020687; Wed, 04 Oct 2023 02:50:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696413020; cv=none; d=google.com; s=arc-20160816; b=bkK65xsoPFUe3wY+R1mZjwPLjsy0ozxxk+vGc12NkcvNiKq33hoN8fcFDuwiqmO+ac +WW00jE6W6DgOGh+7eevx+gPQuCqwG2taEJ9VOWZ2YlO6NS6Gj794vu1EZvZotdlzGKL M6Po6UVcZvJEbk7pmKW1KNv5Z2ylSGJwW+iVYIDKFSqMv6gI5kwyk5VjJJbO3CFvF223 OJ14N2L7z2cw2Xuw/PkmfWB6K6DieN3D+SyqRdjZVUICO5pfRSbkp9bP/jtJMM45xO3V DocNSX2pKSFOYxwNYu5qz7xE7iFIqoPQuqJ/ID07xU7+jRfAPPRcKhjHl6pKtidhP19F jWrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=bvb8b/giLe1+Ig6ztHhXVSzK4lYodlkVlqCESw+5lJk=; fh=sBv4pOj9N3Drim1SCO7+OzjnpAkhuhj7g0023Gf6/QY=; b=P+UBf0ERRYAT+7+aMuE+DAy9WYKnUfjoaGUcRAabCuwky2ZpqANiZxl7TvCqGI0L1T Y25AxImUWzWJdQxIyye0s/rZ2NkOqA5rE8vP7fXXPhYv8RJJFlkpdhyLBP458n6y0mXk 1RGAjNLT9GS2kVRS37vyJA0jbqDq+3WY8z23C8XVXnUrkbGqAg4qolCqKywuj4pYdqaf vi5MimNkp7ytPx+aNmnHzXRtTL9Sn7arox0eCjsNlMifpWAO7Q+Jo+0WrpUDSeQ8Xq9d 3iaRiPr3CrOGxzwDv2x23BhtzOKHDwjRx4S94WedqCSQJFGB8M6i0S2+7Chve2xvDqaz 5/pw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=PfJpwrDA; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id d18-20020a056a00199200b00690d4b91636si3503865pfl.229.2023.10.04.02.50.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Oct 2023 02:50:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=PfJpwrDA; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 21F908206D72; Wed, 4 Oct 2023 02:50:19 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232971AbjJDJuQ (ORCPT <rfc822;pusanteemu@gmail.com> + 18 others); Wed, 4 Oct 2023 05:50:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47308 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232889AbjJDJuP (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 4 Oct 2023 05:50:15 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 26734B4; Wed, 4 Oct 2023 02:50:12 -0700 (PDT) Date: Wed, 04 Oct 2023 09:50:10 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1696413010; h=from:from:sender:sender:reply-to: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=bvb8b/giLe1+Ig6ztHhXVSzK4lYodlkVlqCESw+5lJk=; b=PfJpwrDAF5lPyLxRmRCB86YssF3ZIV5sMrER0muv9YSmqNydIJ0iIb1rvyp2vSUx+LQSdd sFLqSI719wZHqEA0F5BaxfJ6hzXyE6VcEiLKmQ4r06egOPNAOCupmEzX6wNzWqLdGLWXr3 KxpZGpMOLybSPf0Vo5zKhZEDu6ikvsSUSrBPC93Di/DurL7QHH1PErFUOYyGKRPdnIwB9v UGdpwQmrVVQa+Y8U3BUWE+jx+VFJk1InS+o6QHamG7Sv3UIEEdvKVHTgrCiA7oUdHwRcJi /EVYzMZl5Ug8lbs5E+MXZK5q+fONJYQhEi8DOjv+BZzxbP5RcBReXmS9TOTNOg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1696413010; h=from:from:sender:sender:reply-to: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=bvb8b/giLe1+Ig6ztHhXVSzK4lYodlkVlqCESw+5lJk=; b=S0twSuhVr0q6fHhplA+dqmy7oYPPafIYVCDxviNTKtEjz1Z/bjn1hrXysufVvI5qvK1kDq FfFzHzIbF0hpbyAQ== From: "tip-bot2 for Tom Lendacky" <tip-bot2@linutronix.de> Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/urgent] x86/sev: Change npages to unsigned long in snp_accept_memory() Cc: Tom Lendacky <thomas.lendacky@amd.com>, "Borislav Petkov (AMD)" <bp@alien8.de>, <stable@kernel.org>, x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: =?utf-8?q?=3C6d511c25576494f682063c9fb6c705b526a3757e=2E1687441?= =?utf-8?q?505=2Egit=2Ethomas=2Elendacky=40amd=2Ecom=3E?= References: =?utf-8?q?=3C6d511c25576494f682063c9fb6c705b526a3757e=2E16874415?= =?utf-8?q?05=2Egit=2Ethomas=2Elendacky=40amd=2Ecom=3E?= MIME-Version: 1.0 Message-ID: <169641301005.3135.2308946231716648881.tip-bot2@tip-bot2> Robot-ID: <tip-bot2@linutronix.de> Robot-Unsubscribe: Contact <mailto:tglx@linutronix.de> to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 04 Oct 2023 02:50:19 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1769411352289704578 X-GMAIL-MSGID: 1778817979535003493 |
Series |
[tip:,x86/urgent] x86/sev: Change npages to unsigned long in snp_accept_memory()
|
|
Commit Message
tip-bot2 for Thomas Gleixner
Oct. 4, 2023, 9:50 a.m. UTC
The following commit has been merged into the x86/urgent branch of tip: Commit-ID: 62d5e970d022ef4bde18948dd67247c3194384c1 Gitweb: https://git.kernel.org/tip/62d5e970d022ef4bde18948dd67247c3194384c1 Author: Tom Lendacky <thomas.lendacky@amd.com> AuthorDate: Thu, 22 Jun 2023 08:45:05 -05:00 Committer: Borislav Petkov (AMD) <bp@alien8.de> CommitterDate: Mon, 02 Oct 2023 14:55:41 +02:00 x86/sev: Change npages to unsigned long in snp_accept_memory() In snp_accept_memory(), the npages variables value is calculated from phys_addr_t variables but is an unsigned int. A very large range passed into snp_accept_memory() could lead to truncating npages to zero. This doesn't happen at the moment but let's be prepared. Fixes: 6c3211796326 ("x86/sev: Add SNP-specific unaccepted memory support") Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Cc: <stable@kernel.org> Link: https://lore.kernel.org/r/6d511c25576494f682063c9fb6c705b526a3757e.1687441505.git.thomas.lendacky@amd.com --- arch/x86/kernel/sev.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/arch/x86/kernel/sev.c b/arch/x86/kernel/sev.c index 2787826..d8c1e3b 100644 --- a/arch/x86/kernel/sev.c +++ b/arch/x86/kernel/sev.c @@ -868,8 +868,7 @@ void snp_set_memory_private(unsigned long vaddr, unsigned long npages) void snp_accept_memory(phys_addr_t start, phys_addr_t end) { - unsigned long vaddr; - unsigned int npages; + unsigned long vaddr, npages; if (!cc_platform_has(CC_ATTR_GUEST_SEV_SNP)) return;