Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4867935imu; Wed, 19 Dec 2018 01:30:22 -0800 (PST) X-Google-Smtp-Source: AFSGD/V7/3rdjOAbzwJu5hg9ljiuFy4rSLd8ed2DymTNxTZ5rLFTYvdMR1QQfe6t7vUndbWNlLsm X-Received: by 2002:aa7:85d7:: with SMTP id z23mr20581539pfn.205.1545211822773; Wed, 19 Dec 2018 01:30:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545211822; cv=none; d=google.com; s=arc-20160816; b=RElS6qUdzFMsgZiN2FlyYuZjPbANnw1QAfgs9WxB2QtAxXo2j7VjSIYbM+HEB0l2XG hz2/R4+QCwcqf6qUOJSY0bIwEe8U3sYglf9ZairhRNApUpvIoPruMD168335uHwAXsgE TgMmiaVAIR2iKZ3NVI2riWdlmquQWxh5rKutdLW1DtT9mamgE+jR5E1bs2cNoZp+4Jat J/jCotpMr4BBbJ0DYR0VnJxtWAs7TvemmFrVkZOMDEoTfOoQ1rnwnEvQBG5j0DPSQutj mr0AUPnXdPX7D1TBAGAQzK7AfT0IjXJg4IUpGCgJ0DeMmPlk4ngmcd3NELimc/05iv3I Ot1A== 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=ld8BFWD0JN2019UdqS/naJE9hy1eE8g4RUrdaKdLNG8=; b=xcn3kHVBwEgAsEydP9Gqzn2hjCgWsz3BdR/GAQ54W66V/FhavwW63qmb0POaNI0x1I /0Va8qHafMVxx2mE36CsqHKhfeW7OeuS8a3HSil3XpQQnUjqTs4h+m27vAbZHVKsHPEq WsTHbxhNbQQLKh/B8AqEkKNrvkkXQUbWcZ2qpwULmel8dP1yebJyrfMFlMhiKmUiUX+/ jcFJT0r1F8fxBrd2nwai7MpHPw5+Sf1N7/ok5K65zuHuhY1zjHoAfBFbhO85GmEzHzjb JP9Nl35W92sCRb0DXBDLLbuPEYW4nEr5XOLdxHH25E4sQ68zmupGCgXHlNjYeXVOCcR/ V1vw== 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 b128si16046517pfa.283.2018.12.19.01.30.07; Wed, 19 Dec 2018 01:30:22 -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 S1728598AbeLSJL7 (ORCPT + 99 others); Wed, 19 Dec 2018 04:11:59 -0500 Received: from mga18.intel.com ([134.134.136.126]:10181 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727927AbeLSJL7 (ORCPT ); Wed, 19 Dec 2018 04:11:59 -0500 X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Dec 2018 01:11:58 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,372,1539673200"; d="scan'208";a="101823214" Received: from quwen-mobl.ccr.corp.intel.com (HELO localhost) ([10.249.254.215]) by orsmga006.jf.intel.com with ESMTP; 19 Dec 2018 01:11:49 -0800 Date: Wed, 19 Dec 2018 11:11:48 +0200 From: Jarkko Sakkinen To: Jethro Beekman Cc: Andy Lutomirski , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "x86@kernel.org" , Dave Hansen , Peter Zijlstra , "sean.j.christopherson@intel.com" , "H. Peter Anvin" , "linux-kernel@vger.kernel.org" , "linux-sgx@vger.kernel.org" , Andy Lutomirski , Josh Triplett , Haitao Huang , "Dr . Greg Wettstein" Subject: Re: x86/sgx: uapi change proposal Message-ID: <20181219091148.GA5121@linux.intel.com> References: <20181214215729.4221-1-sean.j.christopherson@intel.com> <7706b2aa71312e1f0009958bcab24e1e9d8d1237.camel@linux.intel.com> <598cd050-f0b5-d18c-96a0-915f02525e3e@fortanix.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <598cd050-f0b5-d18c-96a0-915f02525e3e@fortanix.com> 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 Wed, Dec 19, 2018 at 08:41:12AM +0000, Jethro Beekman wrote: > One weird thing is the departure from the normal mmap behavior that the > memory mapping persists even if the original fd is closed. (See man mmap: > "closing the file descriptor does not unmap the region.") The mmapped region and enclave would be completely disjoint to start with. The enclave driver code would assume that an enclave VMA exists when it maps enclave address space to a process. I.e. VMA would no longer reference to the enclave or vice versa but you would still create an enclave VMA with mmap(). This is IMHO very clear and well-defined semantics. > > struct sgx_enclave_add_page { > > __u64 enclave_fd; > > __u64 src; > > __u64 secinfo; > > __u16 mrmask; > > } __attribute__((__packed__)); > > Wouldn't you just pass enclave_fd as the ioctl fd parameter? I'm still planning to keep the API in the device fd and use enclave_fd as handle to the enclave address space. I don't see any obvious reason to change that behavior. And if we ever add any "global" ioctls, then we would have to define APIs to both fd's, which would become a mess. > How to specify the address of the page that is being added? Yes, that is correct and my bad to remove it (just quickly drafted what I had in mind). /Jarkko