Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2066539imm; Thu, 27 Sep 2018 06:58:15 -0700 (PDT) X-Google-Smtp-Source: ACcGV62xflI4BXh7jdbQTSokWm9A/Gsku57EX8UEFJp/35OT0f2Qg/s+yIrkB60n29AmBE1fSLkk X-Received: by 2002:a62:e511:: with SMTP id n17-v6mr11603895pff.210.1538056695835; Thu, 27 Sep 2018 06:58:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538056695; cv=none; d=google.com; s=arc-20160816; b=qgLEm3/kEa2gjiNZqDuQGwu6dFHwgzMJRS+9il0nVTUqoeuDmX9E59OBf3YvDvHgW0 UJ9M4FouChJrEzE3gYlEoTuTRx8zeH3X3az7PaN0VomJ3Ist8hhaaBEch62lpI85a26I 7zRFT91mniJBj0B4xJCKvfGilVN3v/OeVf/O67PeUd1SlCSNvoj0mr/PS6wtdthWO+Ny 1GCfJjNG/hy48Hd5xNGfkTr996ka3TaZ39lfHvw/7Zkm4UTALI78eZ5pTZnjy/7RAq3s ozKPgqYebs+DvYn6506iyljdtucI64InMTj4TovpRrGJHvoAkTeada/Bx7fuWKc5L6Ol Iw5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:organization:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=JoDFrmurQAHNQAPFrAwjfGXh/XT8atDezlG/EvfLtZE=; b=THextwHNr2LSZdk0Cko64LqNVnE10H79iLKJjAsM3nU2Rgo/wzem9AW30fK1TeA715 UQGk/mmR/O6bW7ntJf7c9qjFTD+A0EubzHbnw80H6VsrJUNdQkBkooqFHSLBWlK50SuQ uVvrcMSXEWaMNp3Nj7xwaSOaieZEcpDaWgtmIR/sFiV6OPHeAl9aCz6kiGSD1UTZGaMr IIrwQTTLqdKDbrVc2t1Z+Z+5adZini0tPY0qq1FuEUWGMGl5gZBRrBgf4SyImAQbaPZ9 iCi0KHY1QUh1IEpPvwYWfXeyiNWwWaSet7348rzuZh5qxYoQJWJPVC6XnVEFX0xLk+Iu 11Aw== 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 x7-v6si2130557plv.413.2018.09.27.06.57.59; Thu, 27 Sep 2018 06:58:15 -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 S1727516AbeI0UOc (ORCPT + 99 others); Thu, 27 Sep 2018 16:14:32 -0400 Received: from mga02.intel.com ([134.134.136.20]:38443 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726953AbeI0UOc (ORCPT ); Thu, 27 Sep 2018 16:14:32 -0400 X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Sep 2018 06:56:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,310,1534834800"; d="scan'208";a="93847732" Received: from jsakkine-mobl1.tm.intel.com (HELO localhost) ([10.237.50.69]) by fmsmga001.fm.intel.com with ESMTP; 27 Sep 2018 06:56:04 -0700 Date: Thu, 27 Sep 2018 16:56:03 +0300 From: Jarkko Sakkinen To: Dave Hansen Cc: Andy Lutomirski , "Christopherson, Sean J" , 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: <20180927135603.GF8242@linux.intel.com> References: <20180925130845.9962-1-jarkko.sakkinen@linux.intel.com> <20180925130845.9962-10-jarkko.sakkinen@linux.intel.com> <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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <992b1d6d-cc0f-776f-d938-2a1f7cad52c8@intel.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 26, 2018 at 02:45:17PM -0700, Dave Hansen wrote: > On 09/26/2018 02:15 PM, Andy Lutomirski wrote: > > Could we perhaps have a little vDSO entry (or syscall, I suppose) that > > runs an enclave an returns an error code, and rig up the #PF handler > > to check if the error happened in the vDSO entry and fix it up rather > > than sending a signal? > > Yeah, signals suck. > > So, instead of doing the enclave entry instruction (EENTER is it?), the > app would do the vDSO call. It would have some calling convention, like > "set %rax to 0 before entering". Then, we just teach the page fault > handler about the %RIP in the vDSO that can fault and how to move one > instruction later, munge %RIP to a value that tells about the error, > then return from the fault. It would basically be like the kernel > exception tables, but for userspace. Right? > > How would a syscall work, though? I assume we can't just enter the > enclave from ring0. Enclave cannot be entered from ring-0. For me this plan sounds simple and sound. /Jarkko