[PATCH v10 10/50] x86/fault: Report RMP page faults for kernel addresses

Michael Roth posted 50 patches 2 years, 2 months ago
There is a newer version of this series
[PATCH v10 10/50] x86/fault: Report RMP page faults for kernel addresses
Posted by Michael Roth 2 years, 2 months ago
RMP #PFs on kernel addresses are fatal and should never happen in
practice. They indicate a bug in the host kernel somewhere, so dump some
information about any RMP entries related to the faulting address to aid
with debugging.

Signed-off-by: Michael Roth <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 7858b9515d4a..9f154beef9c7 100644
--- a/arch/x86/mm/fault.c
+++ b/arch/x86/mm/fault.c
@@ -34,6 +34,7 @@
 #include <asm/kvm_para.h>		/* kvm_handle_async_pf		*/
 #include <asm/vdso.h>			/* fixup_vdso_exception()	*/
 #include <asm/irq_stack.h>
+#include <asm/sev-host.h>		/* sev_dump_rmpentry()          */
 
 #define CREATE_TRACE_POINTS
 #include <asm/trace/exceptions.h>
@@ -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)
+		sev_dump_hva_rmpentry(address);
 }
 
 static noinline void
-- 
2.25.1
Re: [PATCH v10 10/50] x86/fault: Report RMP page faults for kernel addresses
Posted by Borislav Petkov 2 years, 1 month ago
On Mon, Oct 16, 2023 at 08:27:39AM -0500, Michael Roth wrote:
> RMP #PFs on kernel addresses are fatal and should never happen in

s/#PFs/faults/

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette