Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1040545imm; Wed, 26 Sep 2018 10:36:26 -0700 (PDT) X-Google-Smtp-Source: ACcGV60qMN0LkYe8ZrzcPuniFQtT5MdFk9jepGIvfe3+fZDLFL7mQ2XAKeqbOPiWFVHROj+KG+l/ X-Received: by 2002:a17:902:7142:: with SMTP id u2-v6mr7250808plm.154.1537983386149; Wed, 26 Sep 2018 10:36:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537983386; cv=none; d=google.com; s=arc-20160816; b=i0PPCzXyN2v7BZEgrdTUFtqov8t38wAJljVQHL24v7na+rXIO9ygEWYV0Irorh1sv8 qP7TmTxMMqEBpmTNMmPvxf6k7evoaBTFzJm0to9c45Wvb94GSAMxtahW+NeUnUcCCxdW RlL4P9W9OV3i4yAslQMiSIWEY2wMPsqSzp+QmzR7e+dd4Z3xAnukJ5oDuq+vI/M5mVV7 hrqdjfxzTckzmCIhFtQP/5VrKkZxKvO5r1Utm7oftptqhMbBOCOOHovSZhe6KxRXDWVb ElKp0OME8z6qmnuwRVwjHpqsr3top8qXBfw4MJfhfzY20Uu+MxLa2dbx0XH14a4g6J/X wzOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=Kwf4vcM9W7OHPzZwOjUBuEPfmNPO7z6HJ2XvWASbN5M=; b=OGqEanKWpyLLkPROSaNJ7ZP9EdjV9fmAajJBQdF2EFcJiLCZJsXgTrniFtHQKglpCM /d2a+HsKj3HRy2UN817Adh5L2ztvHta4dP9s5Wp2x8ZJt9hLC+K5xs0eHXzensUQjdzQ z5smaYrVXfn86dZj5Qhi3qnhCpCIgFq2PSFduTW4MUk5fJTSb2fOsFqEUsbsC2e3jXbR uob4lV1k91rnGjFKlVzlGl0fbBzX5Zhep6zbd4p6kyk0wGMbAzUj2MFLfO+IYfVDymvf r+UypBZZFDchSEFt6K4lpfrsBAOwRySNWZP9FiLhSLqCLMOmugaEMl074PNr/vpI7wlt qhAw== 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 x5-v6si5820531pgc.210.2018.09.26.10.36.10; Wed, 26 Sep 2018 10:36:26 -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 S1728382AbeIZXt1 (ORCPT + 99 others); Wed, 26 Sep 2018 19:49:27 -0400 Received: from mga14.intel.com ([192.55.52.115]:24845 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727205AbeIZXt1 (ORCPT ); Wed, 26 Sep 2018 19:49:27 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Sep 2018 10:35:27 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,307,1534834800"; d="scan'208";a="77491656" Received: from sjchrist-coffee.jf.intel.com (HELO linux.intel.com) ([10.54.74.55]) by orsmga006.jf.intel.com with ESMTP; 26 Sep 2018 10:35:16 -0700 Date: Wed, 26 Sep 2018 10:35:16 -0700 From: Sean Christopherson To: Andy Lutomirski Cc: Jarkko Sakkinen , X86 ML , Platform Driver , Dave Hansen , nhorman@redhat.com, npmccallum@redhat.com, "Ayoun, Serge" , shay.katz-zamir@intel.com, linux-sgx@vger.kernel.org, Andy Shevchenko , Dave Hansen , Peter Zijlstra , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , LKML Subject: Re: [PATCH v14 09/19] x86/mm: x86/sgx: Signal SEGV_SGXERR for #PFs w/ PF_SGX Message-ID: <20180926173516.GA10920@linux.intel.com> References: <20180925130845.9962-1-jarkko.sakkinen@linux.intel.com> <20180925130845.9962-10-jarkko.sakkinen@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 25, 2018 at 03:53:48PM -0700, Andy Lutomirski wrote: > Minor nit: > > On Tue, Sep 25, 2018 at 6:12 AM Jarkko Sakkinen > wrote: > > > > From: Sean Christopherson > > > > > by (c) as the kernel doesn't really have any other reasonable option, > > e.g. we could kill the task or panic, but neither is warranted. > > Not killing the task is quite nice, but... > > > + /* > > + * Access is blocked by the Enclave Page Cache Map (EPCM), > > + * i.e. the access is allowed by the PTE but not the EPCM. > > + * This usually happens when the EPCM is yanked out from > > + * under us, e.g. by hardware after a suspend/resume cycle. > > + * In any case, there is nothing that can be done by the > > + * kernel to resolve the fault (short of killing the task). > > Maybe s/killing the task/sending a signal/? My intent was to document that, unlike all other page faults, the kernel can't fix the source of the fault even if it were omniscient. How about this? With formatting changes since it's long-winded... /* * Access is blocked by the Enclave Page Cache Map (EPCM), i.e. the * access is allowed by the PTE but not the EPCM. This usually happens * when the EPCM is yanked out from under us, e.g. by hardware after a * suspend/resume cycle. In any case, software, i.e. the kernel, can't * fix the source of the fault as the EPCM can't be directly modified * by software. Handle the fault as an access error in order to signal * userspace, e.g. so that userspace can rebuild their enclave(s), even * though userspace may not have actually violated access permissions. */