Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp1122063rdb; Tue, 30 Jan 2024 08:29:36 -0800 (PST) X-Google-Smtp-Source: AGHT+IEjtwm1+9PPkkG09JQeXZHS8MaQcGHsEz+Dm8aZjjPnTduFQnMPiDhdgKQSH8WZhTkzGDl6 X-Received: by 2002:a17:906:4901:b0:a35:2758:22a3 with SMTP id b1-20020a170906490100b00a35275822a3mr6448731ejq.1.1706632175953; Tue, 30 Jan 2024 08:29:35 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706632175; cv=pass; d=google.com; s=arc-20160816; b=Cd6A4V+IOrF0hgnUQxNNCjK0XyNmJyELLZiyzDPSMwHosRlNAuhzMx9cyh4lYmSAL9 QzsgmoOLLfnGDCQ1iRNNCRtNW2Y6o+dkLr/9I7PXZw88+6KT9kOB7u+p85h3k9gnLZKY PJOiE+H+A4xmg6u97C3bw4BhgZsbgSXfqEnj8YSb7KEsUdg2dK9c+I2swlG+dIAae1Qh tWCL75J0hiDEFoI9lT5JDmRp4/PG+/fI3wMldyEesdnVs5ga5RnhL2hylAtPKGX8/AI/ I+WEJipuZaT+Bm/N1aP906VtkWyb06JCqqBOy+6RRFhXxOtFM94YvL+n994v3cse2WjP BDSg== 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=AGPmg3bM0K0ziuVF/bpOWtTuv50Na0x4WowzmqJ4PB8=; fh=yHSXRj11pnxmXEnSReowBx2pEiubyPUphqNxLJb3NFs=; b=HXIONfw6opU5O37ynwNJCl8GlhZNI9YyETYW9kPWvjO0qTCitFwtnG299soowQn8G7 46SS8U7crLwc7amB9RvpUMCdmSdS0zsMONyz7eMfWOW3NDkq/P+aLknzh2qqePgDscrf XeJo8ET8tKMqfXg/5NHDdzQFjZhfmgX+ZdDYrYKMduzjv9AT/M80EXdaHnBlXaQ16hpy fkkZoTeQDfhKqYcEoambunqi6MjkBe0wUSe6Z6lYsq5KvqtJ6kzDKrzlLeZTG1kvvGHl Af1c/YyLbf36lW2aCqVvvrFdB6YjJAOf3e0e8qOoo4ndEYVJD7AAwhzj05DyAokBs1L5 +PFQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=tOwHBaff; 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-44936-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-44936-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id b13-20020a1709062b4d00b00a31491dfc8csi4577335ejg.986.2024.01.30.08.29.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 08:29:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-44936-linux.lists.archive=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=tOwHBaff; 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-44936-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-44936-linux.lists.archive=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 B46971F277E8 for ; Tue, 30 Jan 2024 16:29:35 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9969212F599; Tue, 30 Jan 2024 16:26:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="tOwHBaff"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="ukcV1/gE" 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 5B8C312CD8D; Tue, 30 Jan 2024 16:26:10 +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=LyCt/9Qbtp9qy9JvzXxWviHAoQYqlJkBCOOh7fMz/TEekpLzSJVlm7U+hrMA81rW7ux46jwwtabT3F8kaNX+taorTCqJjAhSSpW7jy7TYPr4kXkAlf2o6FlvpKw0cUBUdHui+caH6HmCc2vhubMc6NY112oSGYONpDQ5ZB1QWmw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706631972; c=relaxed/simple; bh=WADDM1H92wETD+9wiEl2YfbHXXl8A+FMqf1KJYev7uk=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=stDHiC4DDngyy7IN/1UQaHwPs4wTkS5MkNJ6qGae/51Q/X3aracb4RIDu77u2HRxz58H4RilDxSPzcIX4bHp9Dpyi3VWvPFrbs3rp9sHD59Afxl1vv4NXR+WdjOCSUt70iNvOIRlm03NdIEhUH1C+CQx8Y9nrsEkjkzB3lqlqzg= 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=tOwHBaff; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=ukcV1/gE; 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:08 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1706631969; 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=AGPmg3bM0K0ziuVF/bpOWtTuv50Na0x4WowzmqJ4PB8=; b=tOwHBaffiUlFO5kIuXr//hbLLmbnz6Ef+a2Fb8S8dzGgdB0SolG6VRtfR0GIM3XqHKZDKp b4rXn/YHKOpgarsgraTIIEK1Yny6ecpGzNAXQ0F30cfRGhK0tfrD5QokfkGHmpiJA7YesQ gtv6k6rNZf8CbRIpOw4a9uRzWJp9iDsJWvDtwar6CE5GqTPue+TiSuPng5N8GytcIPEvfp N4K+7qDRpkZnm39GKeGhjJ4AP4zylSpNA4ipNJ2fT+9MMP3mF9b5Tlb0eWbkvDwa3QLVwX KkuzrSBhV6nXneXAAijeHg1iFLyPUq9pQmK31LBEYiRQVWBESyNFmV5Q62sigQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1706631969; 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=AGPmg3bM0K0ziuVF/bpOWtTuv50Na0x4WowzmqJ4PB8=; b=ukcV1/gEqMWEBII8uTbHIDJibiA837km17WChHzxaxGd5hy8S4dMG8R9/44J2aaSGEgiUk wTbgUp0BTNqR8UDQ== From: "tip-bot2 for Brijesh Singh" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/sev] x86/traps: Define RMP violation #PF error code Cc: Brijesh Singh , Michael Roth , "Borislav Petkov (AMD)" , Dave Hansen , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20240126041126.1927228-9-michael.roth@amd.com> References: <20240126041126.1927228-9-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: <170663196817.398.3820994161857678840.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit The following commit has been merged into the x86/sev branch of tip: Commit-ID: 54055344b232c917a9e492a8bf5864fed99ad6b8 Gitweb: https://git.kernel.org/tip/54055344b232c917a9e492a8bf5864fed99ad6b8 Author: Brijesh Singh AuthorDate: Thu, 25 Jan 2024 22:11:08 -06:00 Committer: Borislav Petkov (AMD) CommitterDate: Mon, 29 Jan 2024 17:26:56 +01:00 x86/traps: Define RMP violation #PF error code Bit 31 in the page fault-error bit will be set when processor encounters an RMP violation. While at it, use the BIT() macro. Signed-off-by: Brijesh Singh Signed-off-by: Michael Roth Signed-off-by: Borislav Petkov (AMD) Acked-by: Dave Hansen Link: https://lore.kernel.org/r/20240126041126.1927228-9-michael.roth@amd.com --- arch/x86/include/asm/trap_pf.h | 20 ++++++++++++-------- arch/x86/mm/fault.c | 1 + 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/arch/x86/include/asm/trap_pf.h b/arch/x86/include/asm/trap_pf.h index afa5243..a23a7b7 100644 --- a/arch/x86/include/asm/trap_pf.h +++ b/arch/x86/include/asm/trap_pf.h @@ -2,6 +2,8 @@ #ifndef _ASM_X86_TRAP_PF_H #define _ASM_X86_TRAP_PF_H +#include + /* * Page fault error code bits: * @@ -13,16 +15,18 @@ * bit 5 == 1: protection keys block access * bit 6 == 1: shadow stack access fault * bit 15 == 1: SGX MMU page-fault + * bit 31 == 1: fault was due to RMP violation */ enum x86_pf_error_code { - X86_PF_PROT = 1 << 0, - X86_PF_WRITE = 1 << 1, - X86_PF_USER = 1 << 2, - X86_PF_RSVD = 1 << 3, - X86_PF_INSTR = 1 << 4, - X86_PF_PK = 1 << 5, - X86_PF_SHSTK = 1 << 6, - X86_PF_SGX = 1 << 15, + X86_PF_PROT = BIT(0), + X86_PF_WRITE = BIT(1), + X86_PF_USER = BIT(2), + X86_PF_RSVD = BIT(3), + X86_PF_INSTR = BIT(4), + X86_PF_PK = BIT(5), + X86_PF_SHSTK = BIT(6), + X86_PF_SGX = BIT(15), + X86_PF_RMP = BIT(31), }; #endif /* _ASM_X86_TRAP_PF_H */ diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c index 679b09c..8805e2e 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)) {