Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp1034229pxb; Thu, 17 Feb 2022 22:11:45 -0800 (PST) X-Google-Smtp-Source: ABdhPJwZcWrPzrH/iWXGoNjAMni+Cwp77S61hdUu5/ussD8J4/FOIdCDYUcCpRYqsPNb/8/tqk8h X-Received: by 2002:a17:902:8bc2:b0:149:1ce6:c28c with SMTP id r2-20020a1709028bc200b001491ce6c28cmr6197723plo.164.1645164705421; Thu, 17 Feb 2022 22:11:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645164705; cv=none; d=google.com; s=arc-20160816; b=qcn4jP6zfCEdy8mTErX5t+BDjOLqjRzarIvd+9TU+bmw83b/5NtbVM28TLXvFEsvjf e1EEx+/QfNLtgrBBCz3d0KjXl/0MCZ15tbtaNzq42HHfn3DEWFn0n1tLuIn2AlOTEWf0 tS8uD6AEbjYcdSMDCN/5+H8qTnzwhcfRYpKYdlTrz5Sp2JjCxU/dCR/JQ3RJBPnlmnLI kJ1MIGf9elmebMEgsJfXy2l9qXqUDlBegDfWnLQNLM6RR1XO+HtITvTf3YnRv+7haMXq PBtT5wTZ6/O0YTQVteSxgWKIdZioiB2JA24cqZEkae6kIiEyBDN8mYeGaJvtBNPGA75c 6qfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=wY/KakgbhM23E0L1ApW2eimobFXbel0cLHO1J8DoOmM=; b=MPNo7iQCYVoMonhFqJ2ut8e5nwUCX2MaPtedqBk0SOwyaoP6zIaBVmpn/QLvSETccQ q4E5rR3RQ5K5b8ok6gj/59KiRJzpVelVnBjUK7EMyM3ItKAPvCthtUKHtX0zTDEPgNve gL2NIl8jLCZGvM22cs69qtr1GHMIgjps75GorE8njmM46zLFkxq+I24xed8xIEiH134q O+/C35yrluva/3u4T+V3+GxYLJsM2EgWYyvKH06HWeCroJZfAonbdt9aV8w9jV8RgZN1 2WOBuRMsjTAuW2tT9/nPEHHsosneZ7EDvtY5oG/uzthnvnhkrIBLo5/PL+ZoQRhDOWnU wkEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=L0090UBv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a26si7072320pgv.666.2022.02.17.22.11.31; Thu, 17 Feb 2022 22:11:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=L0090UBv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230510AbiBRGBj (ORCPT + 99 others); Fri, 18 Feb 2022 01:01:39 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:52724 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231136AbiBRGBh (ORCPT ); Fri, 18 Feb 2022 01:01:37 -0500 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C5CE626512B for ; Thu, 17 Feb 2022 22:01:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1645164080; x=1676700080; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=WIaZmEHzMxcJvoDjxKbAEPF9S2X6WO7L8fWfrnJriR8=; b=L0090UBv+xR/lkb5JTOeY344iLTd2n08Hx9BgQKvajpH/ejzSPp25+9r KN7a2n68ImZYl4MH2O14ZWek7uL01LzKCfkMerZH+WUcLLJlaiAJaz68B fIAieSzQNKPAfR1jUvqcDKK672V6/augx4m+enDkbIJlKB6wHnbYUprAB vCpov+NZP0qSvhn3X5AQsiNYBvEoYU1HKcHBU7lb4ctuD3xVpgYiPvOT7 yLNM9PoA8CEkgCCDajN2NRcNR/uQumM8ZWJFhqOS0aXp8ng4JQ349nU34 qD1JxhPb2BuMTIgLnjeke87wbKzrl9YTsqiirhcS4C8GVdtIE4DaXsK6U w==; X-IronPort-AV: E=McAfee;i="6200,9189,10261"; a="238463423" X-IronPort-AV: E=Sophos;i="5.88,377,1635231600"; d="scan'208";a="238463423" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Feb 2022 22:01:20 -0800 X-IronPort-AV: E=Sophos;i="5.88,377,1635231600"; d="scan'208";a="605453730" Received: from rbfawkes-mobl1.amr.corp.intel.com (HELO localhost) ([10.212.127.120]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Feb 2022 22:01:19 -0800 Date: Thu, 17 Feb 2022 22:01:19 -0800 From: Ira Weiny To: "Edgecombe, Rick P" Cc: "hpa@zytor.com" , "Williams, Dan J" , "dave.hansen@linux.intel.com" , "Yu, Fenghua" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH V8 26/44] x86/fault: Print PKS MSR on fault Message-ID: References: <20220127175505.851391-1-ira.weiny@intel.com> <20220127175505.851391-27-ira.weiny@intel.com> <2a919d9ed8ed874f8b89014c0b42cbadb44d837b.camel@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2a919d9ed8ed874f8b89014c0b42cbadb44d837b.camel@intel.com> X-Spam-Status: No, score=-4.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE 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: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 01, 2022 at 10:13:40AM -0800, Edgecombe, Rick P wrote: > On Thu, 2022-01-27 at 09:54 -0800, ira.weiny@intel.com wrote: > > + if (error_code & X86_PF_PK) > > + pks_dump_fault_info(regs); > > + > > If the kernel makes an errant accesses to a userspace address with PKU > enabled and the usersapce page marked AD, it should oops and get here, > but will the X86_PF_PK bit be set even if smap is the real cause? Per > the SDM, it sounds like it would: > " > For accesses to user-mode addresses, the flag is set if > (1) CR4.PKE = 1; > (2) the linear address has protection key i; and > (3) the PKRU register (see Section 4.6.2) is such that either > (a) ADi = 1; or > (b) the following all hold: > (i) WDi = 1; > (ii) the access is a write access; and > (iii) either CR0.WP = 1 or the access causing the > page-fault exception was a user-mode access. > " > > ...and then this somewhat confusingly dumps the pks register. Is that > the real behavior? Are you suggesting the PKRU should be printed instead or in addition to the PKS? AFAICS this really should not present a problem even if the fault is due to a user pkey violation. It is simply extra information. Ira