Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1089844imm; Wed, 11 Jul 2018 17:07:34 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdgmQrcHl4Ra/kLXX5f/TrPLe9xSPIWqFa1IGrXaNg7HX0ymYoaxO23IBDVRFxTq3FGrHHE X-Received: by 2002:a63:d916:: with SMTP id r22-v6mr598923pgg.381.1531354054708; Wed, 11 Jul 2018 17:07:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531354054; cv=none; d=google.com; s=arc-20160816; b=cDtb+4qwriKocXY7t8qidNHysSQcCbvU9Xa2VBxIEDjStrmI9JvFyEdIiKcXC7D7Hl BYbw/qwablsdb2gpVAQR+ZS96mUyUCR07wHChkkaGBKf9IUz/sKJmC5P33eESkRK24Rq JRjl42CFw2OxjQkzxMCBNTzv0zH0bqd2xy1mTWH5O8EMeVDHtQPKfWyJGBO09pBPp/7j qbJ8GYYYqFZVdDddYnK/luyrzXENbsrU6z6cpOekRYt2DZXRxCS7DMj/q/9pyxMbpJ9d DYNZ/ljhHZ5gvQE4zMCegUw6hozEZije7nh7SkLmRP5OBAPzch9Yk2zcpfg61b3MB0zP ApAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:date:to:from:subject:message-id :arc-authentication-results; bh=zBCN/Hjz+Uu+U/ixLIXIrlWdhwGYw8RTzIPOidWxcXs=; b=a2wbKs8piQYaCNVTZz2K0EBZnE97kO0/gJUUj/VFVHhgTOwK1IzP4plfFkQGkkB5qx aSUwHxaCiujYEoyXycqdIw2FOgCOB70xb/U0G6CEiIUv5Zy8pkUr4OOzeEQTz2R80bcG Re9jOSs+hsto8IdRXmvPX7dkmx4mAc4QrqHhigMsr2kaGjRhVA5oFS07rbY3WP5Jdx+g mJnn5J3qtQAclWatSAoNGo44/vBK/p1wM5WWyR92GSmSDfwnz0X2cEuN9kF0YBcajgD6 F+gSAu6SZkbsf5nRyBINRUB72Y4Dodjkyd40kJpIAijKuSvBh3oRO9FlnXMguaSjwttM qhAA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c16-v6si4406429pgm.307.2018.07.11.17.07.18; Wed, 11 Jul 2018 17:07:34 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732959AbeGKRhR (ORCPT + 99 others); Wed, 11 Jul 2018 13:37:17 -0400 Received: from mga03.intel.com ([134.134.136.65]:20438 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732677AbeGKRhR (ORCPT ); Wed, 11 Jul 2018 13:37:17 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Jul 2018 10:31:54 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,338,1526367600"; d="scan'208";a="74003160" Received: from 2b52.sc.intel.com ([143.183.136.52]) by orsmga002.jf.intel.com with ESMTP; 11 Jul 2018 10:31:53 -0700 Message-ID: <1531330096.15351.10.camel@intel.com> Subject: Re: [RFC PATCH v2 12/27] x86/mm: Shadow stack page fault error checking From: Yu-cheng Yu To: Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Thomas Gleixner , Ingo Molnar , linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-api@vger.kernel.org, Arnd Bergmann , Andy Lutomirski , Balbir Singh , Cyrill Gorcunov , Florian Weimer , "H.J. Lu" , Jann Horn , Jonathan Corbet , Kees Cook , Mike Kravetz , Nadav Amit , Oleg Nesterov , Pavel Machek , Peter Zijlstra , "Ravi V. Shankar" , Vedvyas Shanbhogue Date: Wed, 11 Jul 2018 10:28:16 -0700 In-Reply-To: <61793360-f37c-ec19-c390-abe3c76a5f5c@linux.intel.com> References: <20180710222639.8241-1-yu-cheng.yu@intel.com> <20180710222639.8241-13-yu-cheng.yu@intel.com> <61793360-f37c-ec19-c390-abe3c76a5f5c@linux.intel.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.18.5.2-0ubuntu3.2 Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2018-07-10 at 15:52 -0700, Dave Hansen wrote: > On 07/10/2018 03:26 PM, Yu-cheng Yu wrote: > > > > +++ b/arch/x86/include/asm/traps.h > > @@ -157,6 +157,7 @@ enum { > >   *   bit 3 == 1: use of reserved > > bit detected > >   *   bit 4 == 1: fault was an > > instruction fetch > >   *   bit 5 == 1: protection keys > > block access > > + *   bit 6 == 1: shadow stack > > access fault > >   */ > Could we document this bit better? > > Is this a fault where the *processor* thought it should be a shadow > stack fault?  Or is it also set on faults to valid shadow stack PTEs > that just happen to fault for other reasons, say protection keys? Thanks Vedvyas for explaining this to me. I will add this to comments: This flag is 1 if (1) CR4.CET = 1; and (2) the access causing the page- fault exception was a shadow-stack data access. So this bit does not report the reason for the fault. It reports the type of access; i.e. it was a shadow-stack-load or a shadow-stack-store that took the page fault. The fault could have been caused by any variety of reasons including protection keys.