Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp54351imd; Wed, 31 Oct 2018 14:31:36 -0700 (PDT) X-Google-Smtp-Source: AJdET5cuhBAnuOt9x37gaT6qs3w7+OyK4VlZ9UCPw9cNq3K+C6n136q4CNTbdNSLurxSQiB0cBY6 X-Received: by 2002:a63:6150:: with SMTP id v77mr4635232pgb.266.1541021496752; Wed, 31 Oct 2018 14:31:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541021496; cv=none; d=google.com; s=arc-20160816; b=XlLTX96ywEyt57VvcQYQ1ew2bpwMiEbGF2E9iJkNEtdTYQ6lSm89+X9JY2vfSmfqvg /Kh9MRPuWPqjdt3GOAMUOzYlfwyeMB3e5WqudOdX6iY3qGRH5b6K6+KMoBkhEokbE0iT 26HVHRZ+sE0Fo+MCiI7029CTwTPZJL5+ruikS51QlQAySwZaooK2xQcg3QXpPXmg1VRN jobyK0kJQsLjKGYaTzlgizqUDyntDK2uweYtkV+t/pL6OS/jAvOY+M+JBv9sM7bc+MpC 34S41YEPbiCo6twzYxnHkOrqRdatZ7SDTyk6AqIrp3hSc9csRMIOfG88OVsg9/cfKpVx a3Zg== 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=KEg1gCLMVx07fvJ575UW0hjhtXsr9e5qiZwAlVxnswQ=; b=L+syH1aYKdR2qL69QYmqBNdIz9Q5KUJEB/wTOnqDqmPQQouuGUtQwiSKV8O0qJTMu+ P2hETWz+1YIH3r9i1MZ2Y/FDCVR5YdVo5YWjAHTJVELaYRsZOGuhCMH7B8Hfgk6SPSpj EgWOGuZVAOSp0uvj8Gr8QMTz24nsyZZHKCX4J1bARSHINfuahPCxMDb9yD/dKNKvvOiH dKyXos6AEKuwqqAsPeZ/lrL4p4/UJTr8g4m4A6toxx0k5epT9J90GX5bbQASVB1mJCOD S7cSrP3sa2399X84YE169feP6oI6XJRBQBBdFM3ddiS4ECLHmZrbUw+2OOC8dizsRrNP OJZg== 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 c10-v6si26717896pla.251.2018.10.31.14.31.21; Wed, 31 Oct 2018 14:31:36 -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 S1726230AbeKAGa2 (ORCPT + 99 others); Thu, 1 Nov 2018 02:30:28 -0400 Received: from mga04.intel.com ([192.55.52.120]:41562 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725901AbeKAGa1 (ORCPT ); Thu, 1 Nov 2018 02:30:27 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 31 Oct 2018 14:30:37 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,449,1534834800"; d="scan'208";a="277316362" Received: from sjchrist-coffee.jf.intel.com (HELO linux.intel.com) ([10.54.74.193]) by fmsmga006.fm.intel.com with ESMTP; 31 Oct 2018 14:30:36 -0700 Date: Wed, 31 Oct 2018 14:30:36 -0700 From: Sean Christopherson To: Dave Hansen Cc: Jethro Beekman , Jarkko Sakkinen , Andy Lutomirski , Andrew Lutomirski , X86 ML , Platform Driver , "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: <20181031213036.GA23089@linux.intel.com> References: <20180926173516.GA10920@linux.intel.com> <2D60780F-ADB4-48A4-AB74-15683493D369@amacapital.net> <9835e288-ba98-2f9e-ac73-504db9512bb9@intel.com> <20180926204400.GA11446@linux.intel.com> <992b1d6d-cc0f-776f-d938-2a1f7cad52c8@intel.com> <20180927135603.GF8242@linux.intel.com> <2e7b81e1-818f-7d76-e2b4-793d9ec5d5a6@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2e7b81e1-818f-7d76-e2b4-793d9ec5d5a6@intel.com> 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 Mon, Oct 01, 2018 at 03:03:30PM -0700, Dave Hansen wrote: > On 10/01/2018 02:42 PM, Jethro Beekman wrote: > > > > 1) Even though the vDSO function exists, userspace may still call > > `ENCLU[EENTER]` manually, so the fault handling as described in the > > current patch should also be maintained. > > Why? Circling back to this question, what if we take the easy way out and simply signal SIGSEGV without an SGX-specific code? I.e. treat #PF with X86_PF_SGX as an access error, no more no less. That should be sufficient for userspace to function, albeit with a little more effort, but presumably no more than would be needed to run on SGX1 hardware. AFAIK there isn't a way to prevent userspace from manually invoking EENTER, short of doing some really nasty text poking or PTE swizzling. We could declare using EENTER as unsupported, but that seems like cutting off the nose to spite the face. Supporting userspace EENTER in a limited capacity would allow people to do whatever crazy tricks they're wont to do without having to deal with absurd requests for the vDSO interface. If we go this route we could also add the vDSO stuff after basic SGX support is in mainline, obviously with approval from the powers that be.