Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3527992imu; Mon, 24 Dec 2018 03:53:14 -0800 (PST) X-Google-Smtp-Source: ALg8bN731Rll6AE7dKhMHWsxSMXNFmKXDkSCFXghslG2BS04b2taoWupRH13O2A5G6LJashXPotd X-Received: by 2002:a62:ca05:: with SMTP id n5mr12904645pfg.154.1545652394880; Mon, 24 Dec 2018 03:53:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545652394; cv=none; d=google.com; s=arc-20160816; b=ciO81LjbjOeaeP815uRBCeobhGMemZ9PWIF7HcoP492fAxTakis2m/U7Y9qKy+bixd XbplmxoOYxTYqe8FxUupyR+lCb6f4fWilUzmfmGk2540A9b4iDfbdc4RiD71+kmPexNX TmkQzJI1LzCztwJIiAJdZTZoNigLFjkENxn1/D4I5fWYX6mAtoOt/EKjiWOaDyGs+aJY 0U9Pg6+3xR3h3bBcDMZR4R9QfuOHQCappSKQSWah+a8066fQtNh0MjFho9k4oQTmd9u/ rCifEAUqmemB59fCNcLhkCNvZ5WZDFZuPXNTDu3G/L0TRPeQ2GViMZtswHLbWUjdM5qy nnPQ== 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=AuEdXxQP3vXko5ykSegHKPk2Hj9LcyBo1+4COV/q8Tw=; b=LYSGqHeDU5Yv8w3Ro4AVrGw3mOqZIPNaLlEEQq59uCuzqlwMVQfuE6eljdOB3rq7MO OAPMCW6JMXw9q2KjykbMRYVFwLbJXsP8dRmlcsCJqLuXh+DIaMInCzjOX86uOYgYMsot IpmmYMgGZW/FAIPaK1e04I3xUAkCQ9DgZNWNSOnUXCVaRsygUFNW3msWY/QONKLzFnuc hXnEGvy7Mhzpg3bVm8gUfz/tZEGBV8VxPqnCJ4NSXqn3u6EzTwNuKFLHN9Q9H0TGGRrL +f9BeGzOPQwwykzu27MBYKVM9coGM33Lib/LWnTTY7Csa4rQ1lUnBKrVXyOhHdxM/c7v l/kQ== 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 d19si17518552pfd.196.2018.12.24.03.52.58; Mon, 24 Dec 2018 03:53: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; 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 S1725763AbeLXLwI (ORCPT + 99 others); Mon, 24 Dec 2018 06:52:08 -0500 Received: from mga12.intel.com ([192.55.52.136]:37841 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725298AbeLXLwI (ORCPT ); Mon, 24 Dec 2018 06:52:08 -0500 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Dec 2018 03:52:07 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,392,1539673200"; d="scan'208";a="120734283" Received: from dlu2-mobl4.ccr.corp.intel.com (HELO localhost) ([10.249.254.240]) by orsmga002.jf.intel.com with ESMTP; 24 Dec 2018 03:52:02 -0800 Date: Mon, 24 Dec 2018 13:52:01 +0200 From: Jarkko Sakkinen To: Andy Lutomirski Cc: 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" Subject: Re: x86/sgx: uapi change proposal Message-ID: <20181224115201.GA10971@linux.intel.com> References: <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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo User-Agent: Mutt/1.10.1 (2018-07-13) 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 12:42:48PM -0800, Andy Lutomirski wrote: > 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. What is the core reason anyway that /dev/kvm is out of the question? /Jarkko