Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp7019369ybi; Thu, 13 Jun 2019 08:14:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqxCJqiRqjCLclywVvjRv0Trrc6zwbk3hdzgo+wNfXgrdmXSA5TG7Yf/K12m/g0B71un3uN4 X-Received: by 2002:a63:91c4:: with SMTP id l187mr29218732pge.95.1560438877078; Thu, 13 Jun 2019 08:14:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560438877; cv=none; d=google.com; s=arc-20160816; b=fc1mdNw++7a3/+NriXS4fizMaYNSa+uQeBS25O2sGew1DL4TB6E9+CjLmfpDcDfppG 5uP0EOtxVdpojZ6AL1wpOvtF7VXzRMOXQ1fB0P8MVDeq4wU2kopw0FTYF8CuRcPc11q3 GDyUYSOgZ2FDoi/Qiw8IYdJ31TXMgva384odG6Ue2310Vk5NmKntm6dP15gWRyr+OT+Z RHOQ/kfNsSX5t0e99a9nVGVSWBrQcLqtNSEtsBmFXXMNpmNudK8uBT68QYbmjacC1Y4F Z/XEUyXDFBYQs2nKvE9vy3b7XpdYndg7sV2XxhyDoHMBo/+DWXJ0nNoFpoRtoax6E7Nf /GlQ== 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-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=LR5mBkhfwWP7Q3JDQVBpseKGSATC4Fe79p2IQ48xTSc=; b=AbSoI9XSv7H4x9V35ak5sAt0pZ3VAg87YxZORFfmXtGPTfPCC97nF8SoBgOyeHbrJ7 CmiHG3AzgIINdKnI8cttY7i60A5c7TYLpZlmIacCjI+AAuXN24oztammGqwWgmiQqvis OLmwo8P0I/8SVfDVIzqbLctzuZL7GlcCkv6GRyaIRpA0YZYQWhobfPWHPFiPJcOfu5fZ /LIi2zzhycSU6/GPaFckL3O6UGMMOLftcCNsHGVs+UaZuNS0mXIeLv81pnUTD2438/Ap Ek/tYf4cQfmyiMrkPkEqWNS3avDclk5Rd/s5lbKneZ1nGpT3sB16a5zbm4NJoOMJ71aN tciA== 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 s17si45455pgj.186.2019.06.13.08.14.21; Thu, 13 Jun 2019 08:14:37 -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 S1732517AbfFMPMW (ORCPT + 99 others); Thu, 13 Jun 2019 11:12:22 -0400 Received: from mga09.intel.com ([134.134.136.24]:61276 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732284AbfFMNsL (ORCPT ); Thu, 13 Jun 2019 09:48:11 -0400 X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Jun 2019 06:48:09 -0700 X-ExtLoop1: 1 Received: from bbouchn-mobl.ger.corp.intel.com (HELO localhost) ([10.252.35.22]) by orsmga006.jf.intel.com with ESMTP; 13 Jun 2019 06:48:01 -0700 Date: Thu, 13 Jun 2019 16:48:00 +0300 From: Jarkko Sakkinen To: Andy Lutomirski Cc: "Xing, Cedric" , Andy Lutomirski , "Christopherson, Sean J" , Stephen Smalley , James Morris , "Serge E . Hallyn" , LSM List , Paul Moore , Eric Paris , "selinux@vger.kernel.org" , Jethro Beekman , "Hansen, Dave" , Thomas Gleixner , Linus Torvalds , LKML , X86 ML , "linux-sgx@vger.kernel.org" , Andrew Morton , "nhorman@redhat.com" , "npmccallum@redhat.com" , "Ayoun, Serge" , "Katz-zamir, Shay" , "Huang, Haitao" , Andy Shevchenko , "Svahn, Kai" , Borislav Petkov , Josh Triplett , "Huang, Kai" , David Rientjes , "Roberts, William C" , "Tricca, Philip B" Subject: Re: [RFC PATCH 2/9] x86/sgx: Do not naturally align MAP_FIXED address Message-ID: <20190613134800.GA12791@linux.intel.com> References: <20190531233159.30992-1-sean.j.christopherson@intel.com> <20190531233159.30992-3-sean.j.christopherson@intel.com> <20190604114951.GC30594@linux.intel.com> <960B34DE67B9E140824F1DCDEC400C0F654EDBDE@ORSMSX116.amr.corp.intel.com> <20190605151653.GK11331@linux.intel.com> <5A85C1D7-A159-437E-B42A-3F4254E07305@amacapital.net> <20190606153710.GB25112@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20190606153710.GB25112@linux.intel.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 Thu, Jun 06, 2019 at 06:37:10PM +0300, Jarkko Sakkinen wrote: > On Wed, Jun 05, 2019 at 01:14:04PM -0700, Andy Lutomirski wrote: > > > > > > > On Jun 5, 2019, at 8:17 AM, Jarkko Sakkinen wrote: > > > > > >> On Tue, Jun 04, 2019 at 10:10:22PM +0000, Xing, Cedric wrote: > > >> A bit off topic here. This mmap()/mprotect() discussion reminds me a > > >> question (guess for Jarkko): Now that vma->vm_file->private_data keeps > > >> a pointer to the enclave, why do we store it again in vma->vm_private? > > >> It isn't a big deal but non-NULL vm_private does prevent mprotect() > > >> from merging adjacent VMAs. > > > > > > Same semantics as with a regular mmap i.e. you can close the file and > > > still use the mapping. > > > > > > > > > > The file should be properly refcounted — vm_file should not go away while it’s mapped. mm already takes care of that so vm_file does not go away. Still we need an internal refcount for enclaves to synchronize with the swapper. In summary nothing needs to be done. > Right, makes sense. It is easy one to change essentially just removing > internal refcount from sgx_encl and using file for the same. I'll update > this to my tree along with the changes to remove LKM/ACPI bits ASAP. /Jarkko