Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2990917imu; Sun, 23 Dec 2018 12:45:14 -0800 (PST) X-Google-Smtp-Source: AFSGD/X9fOP+V8YIX5+euI8pKSO7t7KvjPHyjWApQ94tVIdHFUeTb138ic59NWtqBHHKf/t/FQi6 X-Received: by 2002:a62:9419:: with SMTP id m25mr11334030pfe.147.1545597914233; Sun, 23 Dec 2018 12:45:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545597914; cv=none; d=google.com; s=arc-20160816; b=wueuWj3km0qe6eRwN8W6cgA7cOmx234S68VKJccPHZ2+NRKQ8SzndHDZxKCFIVyTme eJVGj8bbBHRFnaaXryzlSaxgP7xNKggF8fSDQ7YQ5k8l0J997DjtOUjPwtezwSRus6Xw JmP8XdXFC4kdvynuAtr3+6QbCOy4l8+WDlIWN1qPogO6LlUCexDRNxq3bObLBJPgXpsl nlXmM3+ELOvJNywZhx9HrrSG746XXCaGgmtB7T48l9tNopOHpA5cAMQxkhPVHtWqQF2A wv87AAps8DU+mLs2oXDk6m1BxlNmSnbr7r7N8SUciyBjoHCJNUq1BxCSw+p1BV8A6Be/ rINA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=LyrIyW8/iTiwdtqTvoLioubIz2pWTeYSXrmrVUwtGu4=; b=UGizzOGUdfr+3GSZ6EIbH0YjpYxsQhSTEJf86FmW2CUPwA6nUtokOpsnVAQZxiLclo 1N1Id9ALrf6W2JF3g4D9nCyqCfxgy8fiaDDAqFePuTDmmKHMM+CoY+UBUMKzabFpE2xB Kfk1rUsw0a8uAESgqsxfuUrPW2tUyiX30CHMWjTXLsfsVlP0bwAJO/VSJJEjw05veNQk 5kLIXBCjWpqSvPMIawqIBGI3TJJjpZVEgaV9Df/2cTjIR5fSmZaYzhe8jojeUvVN3AAU eDVGCutNygEbypufTFjl/fnA4c1pYY+1zTfZBqUZNmn1m1KD8PIKpkKeQ3qK5gGEdEDO VTbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=YnxwSVxW; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 65si7931839pgf.521.2018.12.23.12.44.31; Sun, 23 Dec 2018 12:45:14 -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; dkim=pass header.i=@kernel.org header.s=default header.b=YnxwSVxW; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725894AbeLWUnC (ORCPT + 99 others); Sun, 23 Dec 2018 15:43:02 -0500 Received: from mail.kernel.org ([198.145.29.99]:43948 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725812AbeLWUnC (ORCPT ); Sun, 23 Dec 2018 15:43:02 -0500 Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id AF799218AF for ; Sun, 23 Dec 2018 20:43:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1545597781; bh=XWloAgP0FimDnwcL2BUy6GJT3cfzyDOhnds0UkaNybQ=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=YnxwSVxWl05U9WKyzfP3iXJFV9jtY01GKPVmSqO9P5sC0XB7r2T6tZu4M3D3tg1vM czmdxw/lw9QjtNYQdT6x0EuHbV0C9YDPFZtQ2oSw8U2xf5hq45aI9DZY2ZT91gLBWB TWXrwqoFRGHrdPIlrEk9++5MJ5i9KCIms+w174xE= Received: by mail-wm1-f42.google.com with SMTP id m1so9865647wml.2 for ; Sun, 23 Dec 2018 12:43:00 -0800 (PST) X-Gm-Message-State: AJcUukeiRtzq1GexWjRfO/OMuJ2gtr3X9NJhcxpn1bkNHpRUlj4CO6O7 NBC3D39shsGpaF1ioTDPp1woV7WQtJsjVKHT0wVHyg== X-Received: by 2002:a1c:aa0f:: with SMTP id t15mr9809530wme.108.1545597779143; Sun, 23 Dec 2018 12:42:59 -0800 (PST) MIME-Version: 1.0 References: <20181214215729.4221-1-sean.j.christopherson@intel.com> <7706b2aa71312e1f0009958bcab24e1e9d8d1237.camel@linux.intel.com> <598cd050-f0b5-d18c-96a0-915f02525e3e@fortanix.com> <20181219091148.GA5121@linux.intel.com> <613c6814-4e71-38e5-444a-545f0e286df8@fortanix.com> <20181219144515.GA30909@linux.intel.com> <20181220103204.GB26410@linux.intel.com> <20181222081649.GB8895@linux.intel.com> <20181222082502.GA13275@linux.intel.com> <20181223125114.GA7051@linux.intel.com> In-Reply-To: <20181223125114.GA7051@linux.intel.com> From: Andy Lutomirski Date: Sun, 23 Dec 2018 12:42:48 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: x86/sgx: uapi change proposal To: Jarkko Sakkinen Cc: Andy Lutomirski , Sean Christopherson , Jethro Beekman , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "x86@kernel.org" , Dave Hansen , Peter Zijlstra , "H. Peter Anvin" , "linux-kernel@vger.kernel.org" , "linux-sgx@vger.kernel.org" , Josh Triplett , Haitao Huang , "Dr . Greg Wettstein" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Dec 23, 2018 at 4:52 AM Jarkko Sakkinen wrote: > > On Sat, Dec 22, 2018 at 10:25:02AM +0200, Jarkko Sakkinen wrote: > > On Sat, Dec 22, 2018 at 10:16:49AM +0200, Jarkko Sakkinen wrote: > > > On Thu, Dec 20, 2018 at 12:32:04PM +0200, Jarkko Sakkinen wrote: > > > > On Wed, Dec 19, 2018 at 06:58:48PM -0800, Andy Lutomirski wrote: > > > > > Can one of you explain why SGX_ENCLAVE_CREATE is better than just > > > > > opening a new instance of /dev/sgx for each encalve? > > > > > > > > I think that fits better to the SCM_RIGHTS scenario i.e. you could send > > > > the enclav to a process that does not have necessarily have rights to > > > > /dev/sgx. Gives more robust environment to configure SGX. > > > > > > Sean, is this why you wanted enclave fd and anon inode and not just use > > > the address space of /dev/sgx? Just taking notes of all observations. > > > I'm not sure what your rationale was (maybe it was somewhere). This was > > > something I made up, and this one is wrong deduction. You can easily > > > get the same benefit with /dev/sgx associated fd representing the > > > enclave. > > > > > > This all means that for v19 I'm going without enclave fd involved with > > > fd to /dev/sgx representing the enclave. No anon inodes will be > > > involved. > > > > Based on these observations I updated the uapi. > > > > As far as I'm concerned there has to be a solution to do EPC mapping > > with a sequence: > > > > 1. Ping /dev/kvm to do something. > > 2. KVM asks SGX core to do something. > > 3. SGX core does something. > > > > I don't care what the something is exactly is, but KVM is the only sane > > place for KVM uapi. I would be surprised if KVM maintainers didn't agree > > that they don't want to sprinkle KVM uapi to random places in other > > subsystems. > > The one option to consider to do would be to have a device driver for > KVM if you really want this e.g. something like /dev/vsgx. With the > current knowledge I'm not yet sure why all could not be done just > through /dev/kvm. > That seems reasonable too. I don't really care about the path to the device node, but it does seem reasonable to me to have it be a separate node entirely from the normal enclave interface.