Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp1136995imd; Thu, 1 Nov 2018 10:45:33 -0700 (PDT) X-Google-Smtp-Source: AJdET5dTReyfXSdvG5uH6CIf7/RgNyzV9JVQheCW6DjXDZKGFKzxlSyLL+WroHeH4dYFpPvv8MPV X-Received: by 2002:a17:902:9a94:: with SMTP id w20-v6mr8533156plp.115.1541094333295; Thu, 01 Nov 2018 10:45:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541094333; cv=none; d=google.com; s=arc-20160816; b=LE2foCtUeuZlj6mXTCwoVdKOgDjaCwO1MderwrDzcv/jKmSsyLSlaBkMiw0MVQ/wVa tZIXZZh1/Jw/yA0frDBpYzCk/RZa346dt69CT9tBv+jvTqQDqRSW3UnOPrbPOeZ7IacI 5ZwQQ+fua56JhwdC0RHaJb3HYtHVmfhlgGnH64BBoEZTB7XLh3escTs21JjKzaaXCpek e4oXKmpP5UlNACjDwMPUx5ApCLJqkHeM+SENk0wttIFdKpifoKj0DEupQnVzG1jRgmS1 NuymwUkh9+pNu0J+K3PZLnyipXe9gg5vRC/xu4VWkwrRoi1lJs4HCNJfepz4rl7Tw2JG J4+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date; bh=PpEnKLJygg8JeI+QhfitA3CcRH+SK3eManRJERalVnE=; b=aQYul6v/mRclWUzfq7sKxsBQWSh1gjOQvwkAtx3t9/BmEyguMW1I/UPuxTS9XtmoEK yDAdEFaWSXeZXWcFBfuogM7zu3R8Xc6QVMZmLcC1hVTnRBqWngekedRhAAAEKRXstOHf AC8vrVRxbAK7KhJ16xW/oBxoXMIaVwZW8mZxo8L/IYnSsxP6rBOEijZdj0k0RSnzHHHi 9uNT4wV3T84BZfxUt5SFnaaYmPdQDqgmu/WYzzIC1RtOcOigZhpxclAgYVyP5f9H7uQV W192CRfQSQ2vnL8Pb8bfLPd6ypMSl6W+0Y1/IhH3TDzKoTN3eQR9hESyc7T9s26Hk0kV FF7g== 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 d70-v6si11488254pfg.49.2018.11.01.10.45.18; Thu, 01 Nov 2018 10:45:33 -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 S1727965AbeKBCsg (ORCPT + 99 others); Thu, 1 Nov 2018 22:48:36 -0400 Received: from mga06.intel.com ([134.134.136.31]:17010 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726085AbeKBCsg (ORCPT ); Thu, 1 Nov 2018 22:48:36 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 01 Nov 2018 10:44:38 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,452,1534834800"; d="scan'208";a="92997714" Received: from btyborox-mobl.ger.corp.intel.com ([10.249.254.138]) by FMSMGA003.fm.intel.com with ESMTP; 01 Nov 2018 10:44:29 -0700 Date: Thu, 1 Nov 2018 19:44:27 +0200 (EET) From: Jarkko Sakkinen X-X-Sender: jsakkine@jsakkine-mobl1 To: Jarkko Sakkinen cc: Sean Christopherson , Dave Hansen , Jethro Beekman , 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 In-Reply-To: Message-ID: 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> <20181031213036.GA23089@linux.intel.com> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 1 Nov 2018, Jarkko Sakkinen wrote: > On Wed, 31 Oct 2018, Sean Christopherson wrote: >> 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. >> > > Yeah, this would give stable behavior when vDSO functions are not > available. > > Here's a question: if we implement this behavior, could be upstream > series without vDSO's first and after those changes have been landed > we would continue with the vDSO's? Right, it was in your last paragraph, sorry. Yeah, I fully support this idea. It will be easier also to work on the vDSO's once we have something landed (instead of working on a moving platform). /Jarkko