From patchwork Tue Jan 30 16:26:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 194232 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp1340901dyb; Tue, 30 Jan 2024 08:30:17 -0800 (PST) X-Google-Smtp-Source: AGHT+IGrJi53LFU0LRSS7p8zMih9KILDVbo6cgSTfCMd0ryk99Tf2TY8giGWDLbX0k5yAxxOPi8P X-Received: by 2002:a17:906:c343:b0:a30:d336:d7b6 with SMTP id ci3-20020a170906c34300b00a30d336d7b6mr7124262ejb.57.1706632217315; Tue, 30 Jan 2024 08:30:17 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706632217; cv=pass; d=google.com; s=arc-20160816; b=mPSJtDQ/L/ddR+vOJnSYnwCP6SAnko8W1s1jkNsRxDxg4/zSmOuyRH2duvyW+HITJ8 WdBUs4n/HugYzGWO/YXYu03Y6pjk9Iu9+zIaqEsQ5ZO5oV/EhgxTpGUfOfYEuPqe5agg 282dszhsvmDDUR4FJax5kZNSp8uts3u2BSXuvY5y3NgwP7XGGQI+vYPay1lNlycQCsAz i9XVF/uw3PlDx9JkKb4kP0MarU47UNJi2jXF4RpBOynOYHiyoqjshhlqfjEWTsU2OlW3 Uo6QnJuQu26v//aadz2IYkQVUGfJBe51muaVMph3bIc5ENkgPiN+pUIgzlDJJH0a8ZM8 lF4Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:precedence:robot-unsubscribe:robot-id :message-id:mime-version:list-unsubscribe:list-subscribe:list-id :precedence:references:in-reply-to:cc:subject:to:reply-to:sender :from:dkim-signature:dkim-signature:date; bh=7YRXGLgfg3ZbM5YYYP3t2aMeDNRtj+vKjmLz2BjMsYI=; fh=C8Kh98opsl9/O+3r6bKOumr/oM/ma7M9s89U/Emda+I=; b=J+uOILBKPpsOAhy2152dcDHUrJf7KSkIPUSN70o1BQPNzVJ1WlmFiMPxJBZlk1XZFs iSkM0VdhI+Z6DzvfsJ6Kmg67ixNBwO9P8GsSN4kKGtV6MTtJqDAe0Dqpxzg2Dls7ITGK 2f9Gjmzj7s19elOOD+kSaeG1mAdTEkTr3v3yqHYdeA1rho+RF3ywDjMTfLrv2StpgbTY CllVmD4n/3WC2euzVIhpQ46OicixL0P0myXBOuHnRb7Y5ooa1cakgdJMKiJKseZrUNUd 02DGpZuZ3AmmHHVIZ9yyI3zR/Ydpu0vRQrpAKTWNTpg8c8BKnkn1WRwG0cMhtGTDvmCa /ykA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=RTC43VoZ; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-44935-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-44935-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id z25-20020a170906075900b00a36133cd9d6si964897ejb.778.2024.01.30.08.30.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 08:30:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-44935-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=RTC43VoZ; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-44935-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-44935-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id DC1841F27DF5 for ; Tue, 30 Jan 2024 16:30:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 993D712FF98; Tue, 30 Jan 2024 16:26:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="RTC43VoZ"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="K2+AEAhT" Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0A27E12C55D; Tue, 30 Jan 2024 16:26:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706631972; cv=none; b=qYbyp9ZRb7MR9KE55+lVezZ9vFiY1zy47BxFNNmJbvQEncwspTc28V2acdsndjK7EAdSdALS4WCcNTJH6V/nD2Of/2B06BsxogjIO182IshNOQAAqEPyfXhEKI1A4KW2gRde+1spw7rd9D4KEUM61Arfl426JUBKCbQ649wa950= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706631972; c=relaxed/simple; bh=tcKCLnvHtvkmfg+UErQpEFfMalWobr5GzMqM/kkERSY=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=l7lnm545ttdA94ml99On0WEy33W1RXq0mnQgGbIbvAkPXSVV/stuqGkxGL0OSzKi9wwslwZor+ARfubUnIz24x9aBgHgxt6lpP3I3rtoNq6H/kmz+0kCxMpdrXq4k7uHOkePPTaoQYlhPjl/LSw6VBDZUhcV6nafKIkrg0fJiZs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=RTC43VoZ; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=K2+AEAhT; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Date: Tue, 30 Jan 2024 16:26:07 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1706631968; 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=7YRXGLgfg3ZbM5YYYP3t2aMeDNRtj+vKjmLz2BjMsYI=; b=RTC43VoZn4IPYJSk1KO2hdZ5mypN7oVtMfKGb78VOGm66i/dlBoXi4sxGG7Lyi9eE9snAF 8i1zOYw+8ZN7rdf8TNBQV6UOcP4KGtr9bmRxDa35t1LNfgDLlzr8yWROWaSihNi3oB4oJS i/A0yqp73GiHWdtcumewOJOLoHz1fVhgOcIKGo6YxX+nPrjrPENbWf52SGI5DzE1C9eMJd AfT2cUzEVp0ZflPO+OgnRwgX2DSbnK5CVWDuvxIPz1jOPDlmzrbCnE4rjNB/3U7e+qUq2P AKSDjqaQ5DD+StTFwgb1O+Rs4gWFGitrx20tgCcvOOIP0uYhPQMehhLlNXK14A== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1706631968; 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=7YRXGLgfg3ZbM5YYYP3t2aMeDNRtj+vKjmLz2BjMsYI=; b=K2+AEAhTpl5BrRxTgy7GFvEL7vbUH/2ZvKKy5BaiBV/YhK6ffPEbGivUPjwFL9jsZOtTM9 H39uYE+JEERPUDBA== From: "tip-bot2 for Michael Roth" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/sev] x86/fault: Dump RMP table information when RMP page faults occur Cc: Michael Roth , "Borislav Petkov (AMD)" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20240126041126.1927228-10-michael.roth@amd.com> References: <20240126041126.1927228-10-michael.roth@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <170663196762.398.11962253377329116323.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789126575002085007 X-GMAIL-MSGID: 1789533583678321478 The following commit has been merged into the x86/sev branch of tip: Commit-ID: e8bbd303d7de3fb32be1434a5d5ce3e1cb182018 Gitweb: https://git.kernel.org/tip/e8bbd303d7de3fb32be1434a5d5ce3e1cb182018 Author: Michael Roth AuthorDate: Thu, 25 Jan 2024 22:11:09 -06:00 Committer: Borislav Petkov (AMD) CommitterDate: Mon, 29 Jan 2024 17:27:25 +01:00 x86/fault: Dump RMP table information when RMP page faults occur RMP faults on kernel addresses are fatal and should never happen in practice. They indicate a bug in the host kernel somewhere. Userspace RMP faults shouldn't occur either, since even for VMs the memory used for private pages is handled by guest_memfd and by design is not mappable by userspace. Dump RMP table information about the PFN corresponding to the faulting HVA to help diagnose any issues of this sort when show_fault_oops() is triggered by an RMP fault. Signed-off-by: Michael Roth Signed-off-by: Borislav Petkov (AMD) Link: https://lore.kernel.org/r/20240126041126.1927228-10-michael.roth@amd.com --- arch/x86/mm/fault.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c index 8805e2e..859adcd 100644 --- a/arch/x86/mm/fault.c +++ b/arch/x86/mm/fault.c @@ -34,6 +34,7 @@ #include /* kvm_handle_async_pf */ #include /* fixup_vdso_exception() */ #include +#include /* snp_dump_hva_rmpentry() */ #define CREATE_TRACE_POINTS #include @@ -580,6 +581,9 @@ show_fault_oops(struct pt_regs *regs, unsigned long error_code, unsigned long ad } dump_pagetable(address); + + if (error_code & X86_PF_RMP) + snp_dump_hva_rmpentry(address); } static noinline void