Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp8453409ybi; Thu, 6 Jun 2019 12:34:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqwh59hD0hfb+A8pbjVBk+ZqTMLa7iTVEsUT6fbx7jz58/x7pKgVHq3S6FB/zZTbnzvSWvA9 X-Received: by 2002:a17:90a:a415:: with SMTP id y21mr1485176pjp.75.1559849681615; Thu, 06 Jun 2019 12:34:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559849681; cv=none; d=google.com; s=arc-20160816; b=K97MR8qq+zRSPb2oCykzFC1RKdaRq4yINqqPvjv8m00V6ZxVlT/My3uAhn3/mdrr8C zcLNtPc5P1qhVGaYMqZ70bmoif+2SK3pbqd9P/6UlJUXdppW2penq6AL0n1VNN7Yu7n3 vP2aIdzoRkYHXeU+QmgJpPRGwYYfR7zR8g14Q8UbpJt+fAd2NVSCxQSNHVjLFj/RMizl qqpS4MvAstrGcLQz0/L64S62vzeJejeh5Rdyh8VRj/xIB/gJY7RfSJ9EqSWAFo73xudF W2zfqGw44j4Y3R7yThgyS9KpGSir+uln0Wf5MZ5MJfDjvAWn9loXan4SPQA9/QmJ3vc0 kkOA== 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=2LjxwuPXWwi9DD389lKbV0fGuxAbzIlcCJaSMmQZPC4=; b=ZhtUvggYOSfChk6RH+/C5b/bsf6WVWrKXfb9gc2IkM45Lo84cu3fGEap3hMFtM3Hgn ztTY4Pu2Foa+tfyTrAuH8PxtwUPRta5aZkMmwkGDFEzhFTL1DpDMkHP/9hhAyzilmoPK vKdAVgxjX0kRCh7o0Z4DGWasE2SQNwstWq2yzdvGm/ySa0RDqxyegPUI2bOE7NV5r4V6 L5YgTQ0l1P/l2Uz20hXTAv5M941NVP80lOXM4Bx1KblEsInSmCFl03dipJ4qM8m3iOJi sDGUg3PGbbef7V5LZI9hDWOzU5sWZPh2UH7wzM4aueYhSQ7BNB8cNl1c0pC0Z2/Z2trr 8pxw== 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 n7si2337991plk.435.2019.06.06.12.34.24; Thu, 06 Jun 2019 12:34:41 -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 S1729507AbfFFPhj (ORCPT + 99 others); Thu, 6 Jun 2019 11:37:39 -0400 Received: from mga18.intel.com ([134.134.136.126]:14081 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729173AbfFFPhi (ORCPT ); Thu, 6 Jun 2019 11:37:38 -0400 X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Jun 2019 08:37:37 -0700 X-ExtLoop1: 1 Received: from harend-mobl.ger.corp.intel.com (HELO localhost) ([10.252.33.8]) by fmsmga008.fm.intel.com with ESMTP; 06 Jun 2019 08:37:24 -0700 Date: Thu, 6 Jun 2019 18:37:23 +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: <20190606153710.GB25112@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> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <5A85C1D7-A159-437E-B42A-3F4254E07305@amacapital.net> 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, 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. 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