Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp875174imu; Tue, 11 Dec 2018 08:54:52 -0800 (PST) X-Google-Smtp-Source: AFSGD/Xlrexcw6VnCPj8cQp8qi6mkLQP5kwbOXrvyiPh/YyWS9TW7N2l30sn36tCruqEEAzLUeIU X-Received: by 2002:a63:dd15:: with SMTP id t21mr14731060pgg.347.1544547291973; Tue, 11 Dec 2018 08:54:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544547291; cv=none; d=google.com; s=arc-20160816; b=QAb47RVve5+vewAueuFKhNuZUSFa7TWv+QgCLWSj5AMPD2QpuKdcjLgnCYGhuxQI1V RkFkSKwhS+Z02Ti9guTVosRuVqtVtuuhIH0RdVcI1fqafhbDQ/pJQ82KXH5YCM0ZSTO4 XJ9diB5t782ECCJL333nuspsW2wgGusWSvJG+vZB0jSsUiPYsOk6+lKdUqFxflhBPo6p dwqhpaM2rZtBvJ7xrwjeWewxhoD+cURkag2WMrgE/kH/8GlysQYvbr3nPC30SEPuDdir Zv7lz4EJ6h4ZnnfcBAkKMYnbdrv1jxVaEJpv+O0In7Tdl/CCDd3R0Z1cYYxdHlURNzsZ mu6w== 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-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=0az7D0qDMNgw9oxP0FlUtWwAtEsNeyp/8qsF0Mp5BUM=; b=d8d/bkGv2XdmwZlOcg4AdgDvC0xaT3SeJFm/SJIbHrCUtURbj2gXH3ltG/KQgFeANC KNq88it8ee1+bmLp+ZkX6d3EN5opvTTJ4h6c+hKr6cyjq/xeSS45W1fcFS7DbFjt5QLI HDyZRignVHAqggCD1kBoIhv6PNVUPTzXdqlvA7APlfuk8eh0R8vVFUVg7bYeQdTNe+dU AJjpn4g8M5ETwML4kP0Mrf977MVwz64RWye3ncRBj8jtpF9nL3zShhG6GmCZgELm3fu2 0SKZVE/rNo87niCgKRj62QvjmZxKdpTWb9fJ2D7aMlyUKqQQ5Ii1H5lEbul19vvOC41s GqaQ== 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 x8si12602993pll.187.2018.12.11.08.54.36; Tue, 11 Dec 2018 08:54:51 -0800 (PST) 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 S1728099AbeLKQwy (ORCPT + 99 others); Tue, 11 Dec 2018 11:52:54 -0500 Received: from mga04.intel.com ([192.55.52.120]:1363 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726808AbeLKQwy (ORCPT ); Tue, 11 Dec 2018 11:52:54 -0500 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Dec 2018 08:52:53 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,342,1539673200"; d="scan'208";a="117757867" Received: from sjchrist-coffee.jf.intel.com (HELO linux.intel.com) ([10.54.74.154]) by FMSMGA003.fm.intel.com with ESMTP; 11 Dec 2018 08:52:53 -0800 Date: Tue, 11 Dec 2018 08:52:53 -0800 From: Sean Christopherson To: Andy Lutomirski Cc: Josh Triplett , Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org, Jarkko Sakkinen , Dave Hansen , Andy Lutomirski , Peter Zijlstra , "H. Peter Anvin" , linux-kernel@vger.kernel.org, linux-sgx@vger.kernel.org, Haitao Huang , Jethro Beekman , "Dr . Greg Wettstein" Subject: Re: [RFC PATCH v3 0/4] x86: Add exception fixup for SGX ENCLU Message-ID: <20181211165253.GB14731@linux.intel.com> References: <20181210232141.5425-1-sean.j.christopherson@intel.com> <20181210232449.GA11843@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit 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, Dec 11, 2018 at 07:41:27AM -0800, Andy Lutomirski wrote: > > > > On Dec 10, 2018, at 3:24 PM, Josh Triplett wrote: > > > >> On Mon, Dec 10, 2018 at 03:21:37PM -0800, Sean Christopherson wrote: > >> At that point I realized it's a hell of a lot easier to simply provide > >> an IOCTL via /dev/sgx that allows userspace to register a per-process > >> ENCLU exception handler. At a high level, the basic idea is the same > >> as the vDSO approach: provide a hardcoded fixup handler for ENCLU and > >> attempt to fixup select unhandled exceptions that occurred in user code. > > > > So, on the one hand, this is *absolutely* much cleaner than the VDSO > > approach. On the other hand, this is global process state and has some > > of the same problems as a signal handler as a result. > > I liked the old version better for this reason This isn't fundamentally different than forcing all EENTER calls through the vDSO, which is also per-process. Technically this is more flexible in that regard since userspace gets to choose where their one ENCLU gets to reside. Userspace can have per-enclave entry flows so long as the actual ENLU[EENTER] is common, same as vDSO. > and for another reason: > while this new one looks very very simple, it still has the hidden > complexity that the magic values written to registers in the event of an > exception are very much Linux specific. Definitely more magical, but not necessarily more difficult to document. It'd essentially be an extension of hardware's AEE/AEP behavior. > OTOH, the old approach clobbered more regs than needed, but that’s a easy fix.