Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1876661ybv; Fri, 21 Feb 2020 05:02:19 -0800 (PST) X-Google-Smtp-Source: APXvYqz5244xYxFz7wuMIQJyDyLW2Yq1h10El70iH6rKFHt61UyuBtpQB//sqFguppvWaT1vhjhf X-Received: by 2002:aca:ab53:: with SMTP id u80mr1837246oie.94.1582290139714; Fri, 21 Feb 2020 05:02:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582290139; cv=none; d=google.com; s=arc-20160816; b=RcX/KTe2+z8fjbbNwm6r5De8j7AhPIo2dL0bU1I2qaWJV/0+VQbi5l8NpKjuiLrL9E bA6mawrkJ9NUN9zf8w2mDl9RH35QfClKNop1pIbubJ+HcEHa9/FOWfPFysV2pS+xnlpF xFw38dUvQn0TklHOUAkB3i1h3CbhN+dTHEOZVEogN5H95SrlAUf/tYCQ7SRsbIcZdR0Q DiorAnUA0H17hhB/dWSaOK+N3E0uOnKFuJefk33m8Q0HhDu7N0ugc84CvKo57uwxSVH3 kCEbXSYEImgXKhaz8NdugmXYX+ICgDDslY5DnGbGxfvYK7XEv/ooIybHnBnpUxzba7dy SQNg== 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=TsB/i9SzMxAbT2TnJt8tWHA0c86XmMtzVn/r2r5nTBM=; b=nLTn1r1IZRR50jLzSeJcyXyVMHQwQDOytz7y48YFnb+7dzHRynIgqiresKQq1sLa3x lJ2tf+FpnQxufWjOUUOqb0Ypm7DrFS+yqAV3PQIpPHY0Uw7z8iJ5XtKHiHK0kGyw9dTs ngzzpY8zUlo7+ypbqutsnS4KJ1OQlPTWSe7ILSkVpkcRtIv/aWSwYfAixw1JUTL1IEZO EcyN54+wwgSosPr7x6LKdppDAiQutHLfoRlskX15yfAK3dA3ZhqnXBnIeHTSadxryUrR A0pgueBnb7kBSYmFy/FOj4+ErLuS0ui/ZsaG/o0pYCxD3ipTEwBOUE52v4KidUwOrTmv /ASg== 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 i13si1374008oth.175.2020.02.21.05.02.03; Fri, 21 Feb 2020 05:02:19 -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 S1728300AbgBUNBs (ORCPT + 99 others); Fri, 21 Feb 2020 08:01:48 -0500 Received: from mga01.intel.com ([192.55.52.88]:58276 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727213AbgBUNBs (ORCPT ); Fri, 21 Feb 2020 08:01:48 -0500 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Feb 2020 05:01:47 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,468,1574150400"; d="scan'208";a="409130241" Received: from mklimasz-mobl1.ger.corp.intel.com (HELO localhost) ([10.251.87.58]) by orsmga005.jf.intel.com with ESMTP; 21 Feb 2020 05:01:36 -0800 Date: Fri, 21 Feb 2020 15:01:35 +0200 From: Jarkko Sakkinen To: Andy Lutomirski Cc: Sean Christopherson , Jordan Hand , linux-kernel@vger.kernel.org, x86@kernel.org, linux-sgx@vger.kernel.org, akpm@linux-foundation.org, dave.hansen@intel.com, nhorman@redhat.com, npmccallum@redhat.com, haitao.huang@intel.com, andriy.shevchenko@linux.intel.com, tglx@linutronix.de, kai.svahn@intel.com, bp@alien8.de, josh@joshtriplett.org, luto@kernel.org, kai.huang@intel.com, rientjes@google.com, cedric.xing@intel.com, puiterwijk@redhat.com, linux-security-module@vger.kernel.org, Suresh Siddha , Haitao Huang Subject: Re: [PATCH v26 10/22] x86/sgx: Linux Enclave Driver Message-ID: <20200221130135.GC3112@linux.intel.com> References: <20200220221607.GB26618@linux.intel.com> <6AE5891F-FC0D-4062-A6CA-01C78C2D5A1A@amacapital.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <6AE5891F-FC0D-4062-A6CA-01C78C2D5A1A@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 Thu, Feb 20, 2020 at 04:32:22PM -0800, Andy Lutomirski wrote: > > On Feb 20, 2020, at 2:16 PM, Jarkko Sakkinen wrote: > > > > On Thu, Feb 20, 2020 at 10:48:42AM -0800, Sean Christopherson wrote: > >> My biggest concern for allowing PROT_EXEC if RIE is that it would result > >> in #PF(SGX) (#GP on Skylake) due to an EPCM violation if the enclave > >> actually tried to execute from such a page. This isn't a problem for the > >> kernel as the fault will be reported cleanly through the vDSO (or get > >> delivered as a SIGSEGV if the enclave isn't entered through the vDSO), but > >> it's a bit weird for userspace as userspace will see the #PF(SGX) and > >> likely assume the EPC was lost, e.g. silently restart the enclave instead > >> of logging an error that the enclave is broken. > > > > I think right way to fix the current implementation is to -EACCES mmap() > > (and mprotect) when !!(current->personality & READ_IMPLIES_EXEC). > > > > This way supporting RIE can be reconsidered later on without any > > potential ABI bottlenecks. > > > > Sounds good to me. I see no credible reason why anyone would use RIE and SGX. Great, thanks Andy. /Jarkko