Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp656846pxk; Wed, 16 Sep 2020 13:32:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzy59bjWO2zOtdOZvBZwYVaNyD8r0Md+S5sU7qMXAXS2gCoGOGs2l5QdlTRU8ALuTldbcsy X-Received: by 2002:aa7:cf05:: with SMTP id a5mr30047249edy.313.1600288334454; Wed, 16 Sep 2020 13:32:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600288334; cv=none; d=google.com; s=arc-20160816; b=DhbTiq3CgRYkQhlTA7uoL23WKfxiJjOg9buf4d4rUaSEuwCY/C1IieCEaylp8OlrE6 r+dDMfBgHZuGEYTMW5FVWoI7yiKLsQjMNH/Rfvlkm7jMjqx5THT1Tp7mGufhU4chi9WZ OnpUMgHVv7lVqLAG4P76qsdjo8++QbUPIKwF9E0MaGBjDp+XR6iol2os91UTa7qhq+QI bFaBqDZupvUrSLKpg+Q4KIH4phoTaR1sqFAVwmygRsBY9pZvuluYN7VdJfKLQ6BvKl2E 12a1d4pQfOy736jY+lrfSi9dSrBOZ5utVx8pY1kMpHHKhGzGvc9DVdBHUB6BkpRg5D6R +MhQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:organization:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:ironport-sdr:ironport-sdr; bh=Gl0L5nWn1NV+RXI1LJF37DrRdgWL/VMHVU4Zru/tAD0=; b=MxwYcdafCm5kKuy0Yqdv4Fs7t+LUtvfXhqLmrqrqOAmz8S5xbnMN6YPec7dAG0Tt0d VfArT3MFc7l3xWzjLqHI97DWSZwjnguMgueuMwFXZ0L5/dhbwTerKsJlqL/9PDif2iWS p5+tV1aUDwjp2lJ9o1Uc5d2rkWFCdhWW+VggE5MXCmwQ2c0+2BY70l1zhmVTlSZ+ZoCM NXBouC7Ekx5vVyapybBLOxx5gQpAqLxNKr5aiynfbqKqkULODvSPJIhiLDLK/5nySkSH eQMrnBC329lLyKRuvL/VrtZQgXX1AD52jm4DHtGigP0cwzUxkhrKpxy0JDkJI+GZ8W/8 JR3Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id m20si4426429edr.442.2020.09.16.13.31.51; Wed, 16 Sep 2020 13:32:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1726944AbgIPUad (ORCPT + 99 others); Wed, 16 Sep 2020 16:30:33 -0400 Received: from mga02.intel.com ([134.134.136.20]:41489 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727222AbgIPUaS (ORCPT ); Wed, 16 Sep 2020 16:30:18 -0400 IronPort-SDR: NVsoKvnvCmBOTH/kFD8pm0vq56WMxcQpoAoitFGzcfQxo1kyigIOjozI2Z6YLzOnUi7PZUGoa1 3QAzrcDhuG/g== X-IronPort-AV: E=McAfee;i="6000,8403,9746"; a="147246911" X-IronPort-AV: E=Sophos;i="5.76,434,1592895600"; d="scan'208";a="147246911" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Sep 2020 13:30:17 -0700 IronPort-SDR: J/ZiUkDkRxMZ0eZAC8eZeZYHPx/1ZWyZKpPM9Xgi/wQ4MOuUu7vV7EEf273Se9EeqnPm9RTEl8 4ucdadIBvk8g== X-IronPort-AV: E=Sophos;i="5.76,434,1592895600"; d="scan'208";a="452000971" Received: from scusackx-mobl1.ger.corp.intel.com (HELO localhost) ([10.249.45.87]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Sep 2020 13:30:10 -0700 Date: Wed, 16 Sep 2020 23:30:08 +0300 From: Jarkko Sakkinen To: Borislav Petkov Cc: x86@kernel.org, linux-sgx@vger.kernel.org, linux-kernel@vger.kernel.org, Sean Christopherson , Jethro Beekman , Darren Kenny , Borislav Petkov , akpm@linux-foundation.org, andriy.shevchenko@linux.intel.com, asapek@google.com, cedric.xing@intel.com, chenalexchen@google.com, conradparker@google.com, cyhanish@google.com, dave.hansen@intel.com, haitao.huang@intel.com, josh@joshtriplett.org, kai.huang@intel.com, kai.svahn@intel.com, kmoy@google.com, ludloff@google.com, luto@kernel.org, nhorman@redhat.com, npmccallum@redhat.com, puiterwijk@redhat.com, rientjes@google.com, tglx@linutronix.de, yaozhangx@google.com Subject: Re: [PATCH v38 03/24] x86/mm: x86/sgx: Signal SIGSEGV with PF_SGX Message-ID: <20200916203008.GE25541@linux.intel.com> References: <20200915112842.897265-1-jarkko.sakkinen@linux.intel.com> <20200915112842.897265-4-jarkko.sakkinen@linux.intel.com> <20200916114448.GI2643@zn.tnic> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200916114448.GI2643@zn.tnic> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 16, 2020 at 01:44:48PM +0200, Borislav Petkov wrote: > On Tue, Sep 15, 2020 at 02:28:21PM +0300, Jarkko Sakkinen wrote: > > From: Sean Christopherson > > > > Include SGX bit to the PF error codes and throw SIGSEGV with PF_SGX when > > a #PF with SGX set happens. > > > > CPU throws a #PF with the SGX set in the event of Enclave Page Cache Map > > (EPCM) conflict. The EPCM is a CPU-internal table, which describes the > > properties for a enclave page. Enclaves are measured and signed software > > entities, which SGX hosts. [1] > > > > Although the primary purpose of the EPCM conflict checks is to prevent > > malicious accesses to an enclave, an illegit access can happen also for > > legit reasons. > > > > All SGX reserved memory, including EPCM is encrypted with a transient key > > that does not survive from the power transition. Throwing a SIGSEGV allows > > user space software to react when this happens (e.g. recreate the enclave, > > which was invalidated). > > > > [1] Intel SDM: 36.5.1 Enclave Page Cache Map (EPCM) > > > > Acked-by: Jethro Beekman > > Reviewed-by: Darren Kenny > > Reviewed-by: Borislav Petkov > > Signed-off-by: Sean Christopherson > > Signed-off-by: Jarkko Sakkinen > > --- > > arch/x86/include/asm/traps.h | 14 ++++++++------ > > The SEV-ES patchset moved that to arch/x86/include/asm/trap_pf.h but > fixing that up is real easy. Simply do this search-replace > > s!arch/x86/include/asm/traps.h!arch/x86/include/asm/trap_pf.h! > > on this patch. Hey, I just did git fetch mainline && git rebase mainline/master Zero conflicts and there is no trap_pf.h yet. So this is not yet in Linus' tree? /Jarkko