Bit 31 in the page fault-error bit will be set when processor encounters an RMP violation.
Cc: Thomas Gleixner <t...@linutronix.de> Cc: Ingo Molnar <mi...@redhat.com> Cc: Borislav Petkov <b...@alien8.de> Cc: Joerg Roedel <jroe...@suse.de> Cc: "H. Peter Anvin" <h...@zytor.com> Cc: Tony Luck <tony.l...@intel.com> Cc: Dave Hansen <dave.han...@intel.com> Cc: "Peter Zijlstra (Intel)" <pet...@infradead.org> Cc: Paolo Bonzini <pbonz...@redhat.com> Cc: Tom Lendacky <thomas.lenda...@amd.com> Cc: David Rientjes <rient...@google.com> Cc: Sean Christopherson <sea...@google.com> Cc: x...@kernel.org Cc: k...@vger.kernel.org Signed-off-by: Brijesh Singh <brijesh.si...@amd.com> --- arch/x86/include/asm/trap_pf.h | 2 ++ arch/x86/mm/fault.c | 1 + 2 files changed, 3 insertions(+) diff --git a/arch/x86/include/asm/trap_pf.h b/arch/x86/include/asm/trap_pf.h index 10b1de500ab1..107f9d947e8d 100644 --- a/arch/x86/include/asm/trap_pf.h +++ b/arch/x86/include/asm/trap_pf.h @@ -12,6 +12,7 @@ * bit 4 == 1: fault was an instruction fetch * bit 5 == 1: protection keys block access * bit 15 == 1: SGX MMU page-fault + * bit 31 == 1: fault was an RMP violation */ enum x86_pf_error_code { X86_PF_PROT = 1 << 0, @@ -21,6 +22,7 @@ enum x86_pf_error_code { X86_PF_INSTR = 1 << 4, X86_PF_PK = 1 << 5, X86_PF_SGX = 1 << 15, + X86_PF_RMP = 1ull << 31, }; #endif /* _ASM_X86_TRAP_PF_H */ diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c index f1f1b5a0956a..f39b551f89a6 100644 --- a/arch/x86/mm/fault.c +++ b/arch/x86/mm/fault.c @@ -547,6 +547,7 @@ show_fault_oops(struct pt_regs *regs, unsigned long error_code, unsigned long ad !(error_code & X86_PF_PROT) ? "not-present page" : (error_code & X86_PF_RSVD) ? "reserved bit violation" : (error_code & X86_PF_PK) ? "protection keys violation" : + (error_code & X86_PF_RMP) ? "rmp violation" : "permissions violation"); if (!(error_code & X86_PF_USER) && user_mode(regs)) { -- 2.17.1