Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp420590pxa; Fri, 21 Aug 2020 10:37:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxXv3uC3gngrM5QZGdhIE6Vuqw7dwjdSH7Qt5jeFzWyJ4soZLxed3Y2WsUWtoztBaW1yJmP X-Received: by 2002:a17:906:957:: with SMTP id j23mr3993310ejd.344.1598031422641; Fri, 21 Aug 2020 10:37:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598031422; cv=none; d=google.com; s=arc-20160816; b=rBMlPaRFZe1fFyycAszM7nOkyespGIOueXBAv21gQsE0dLNm1erDJg+TGpstBDrqIa Pvkjfebk8TGjnrVPFEf55yOXo0FbjcbD9PdJP1TnIh/NPJC7PHPXO8qSEP8TfQNbkMVi GvzLAL0/QrpT5GZ/QkQAX7Y+bFYiT0cNH3q4YrATWtyK2eLDHCep7nNdwb0eozXRa62f mKuKAU6Tmsh3P6Dhf1CD3bgcfb98j2i0h6tZNzSIk9twb3voOmFJxiJGjHHgXPK/RLJ5 kgR9D5R6uyWPlQUEByLe6KhYZ34DG4oKK+i62RTCVKIUG220u/IMGZFMoF+o5MgujcS3 jg/Q== 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=rbbATnXP34w+xP1y6QZhfERzf47LFyJHPRFPyc2y/rY=; b=FGVVmk4SMD18Lo50qg+IdHQ/CSBwIPdP4naH9re5xbnpKnb12cuJjEEubGJFCJhiSC mlZkJgcXnRQ0JGo2lwKD6P/NtS5pwzmPKkEANQWCHlxu93RvI8FjKx9IJIPGC4XI2Ns8 dnlEHpwTv5Eugts31Lp4PofV8gHPHJL3JYUorgejEZXsCc24eDZ/WddWBAu7nl02DxM9 EhhZI8lM/Zv8eqUtbEf93ujW4/NCDmldqRhPdUK7qb8xI1EevkBSkZvqpBOadWTfdjMs H2M7JakFwXHffetg2Jihm5GMzmxjGFXXNEd0Q3Nlra6/XqN+KjgFuEO+1Z4KS5rK9Cg1 Fd3g== 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 gl17si1560846ejb.589.2020.08.21.10.36.38; Fri, 21 Aug 2020 10:37:02 -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 S1727858AbgHURfo (ORCPT + 99 others); Fri, 21 Aug 2020 13:35:44 -0400 Received: from mga14.intel.com ([192.55.52.115]:20504 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727781AbgHURfn (ORCPT ); Fri, 21 Aug 2020 13:35:43 -0400 IronPort-SDR: Kkic0r1b5R9DXC2Mk/tZEdyOGlR+SXYbjWoW4O6+OuX0bpFORn37NHlm/z/3r/VwGMqPniiIPC MCbDrTttlWCQ== X-IronPort-AV: E=McAfee;i="6000,8403,9720"; a="154864475" X-IronPort-AV: E=Sophos;i="5.76,338,1592895600"; d="scan'208";a="154864475" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Aug 2020 10:35:43 -0700 IronPort-SDR: klasee6OdksvB3oQshH7S42SYdgGJyZOZcnid5EhxrrFgpCjxmu6F3r4chrX0urt4OvFm5yp7Y +TFHumC6YiSA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,338,1592895600"; d="scan'208";a="498598235" Received: from jjakacki-mobl.ger.corp.intel.com (HELO localhost) ([10.252.52.112]) by fmsmga005.fm.intel.com with ESMTP; 21 Aug 2020 10:35:37 -0700 Date: Fri, 21 Aug 2020 20:35:36 +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 , 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 v36 03/24] x86/mm: x86/sgx: Signal SIGSEGV with PF_SGX Message-ID: <20200821173536.GA3559@linux.intel.com> References: <20200716135303.276442-1-jarkko.sakkinen@linux.intel.com> <20200716135303.276442-4-jarkko.sakkinen@linux.intel.com> <20200820153114.GA17271@zn.tnic> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200820153114.GA17271@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 Thu, Aug 20, 2020 at 05:31:14PM +0200, Borislav Petkov wrote: > On Thu, Jul 16, 2020 at 04:52:42PM +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 > > Signed-off-by: Sean Christopherson > > Signed-off-by: Jarkko Sakkinen > > --- > > arch/x86/include/asm/traps.h | 14 ++++++++------ > > arch/x86/mm/fault.c | 13 +++++++++++++ > > 2 files changed, 21 insertions(+), 6 deletions(-) > > Reviewed-by: Borislav Petkov Thank you. Appended to the commit. > > -- > Regards/Gruss, > Boris. > > https://people.kernel.org/tglx/notes-about-netiquette /Jarkko