Received: by 2002:a05:6a10:6006:0:0:0:0 with SMTP id w6csp1575915pxa; Fri, 28 Aug 2020 17:23:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyzgqF90nPEJ6OS+DCEmjyTEStG30MuPNFVFuUb2xzfBKZmM11SUGSJavn+QNf80RIkxIlg X-Received: by 2002:a05:6402:114d:: with SMTP id g13mr1257741edw.157.1598660595924; Fri, 28 Aug 2020 17:23:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598660595; cv=none; d=google.com; s=arc-20160816; b=GeK/470JJBrg3F4A7JNMEEln910fPRR8GcaPjT7h4MNqPtgfdmOGjDc6XlcOh+Mpxo wcjcLwSkQgbWEAP+F251OL3awdtwWA4ZxBS70Zf2neJrXXVrVQxbPihrODk31EQm/Zkn i15AJhzOVofQTqyZu9G+jZjNPbt/Ac0YxfEwvGOq8nquGOlPIJGiCVPydO9eadkf895x LFFUDh+kKKaPm9gvEOjs9tbouLsyDJy1Nu4IgTMeeQ+r7IpUe1qqX84+tN107SIMGiM0 kLwkYuP7aB+ElDoHddmobeFut43HB2VjhIMIWRqsG2UneQdcBHubSP6VC5Kk6tvwOkW/ N2JQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:organization:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:ironport-sdr:ironport-sdr; bh=DskSg3JAXoFXxdcpnuZcVNqRNalVlSE7/OWen/KV+G4=; b=ZwYH8MTtrmOVSK8DSB/OOET9ketHAuF4J8jXy6OsQOyhwAlXn6M7PigQbR4NDd6gc5 hsJ4YMmpBynTMGiGcFG3ou6GdYR3gpLgL/JC8WAvng0bo/HVGtTZ1mw5OkZvQQwm1twS CCgcdkBvUBh96mGlxcrBTvaW8Wt5wrGXHJd0gK4drRTdLF+3mXEfFmW2YhVY3LQyc5z9 hX1pgd6zyNt3dzSOypm5LfoRcumJVjwcTSwWuJOIVLHLFD3Po9cg3V/bLv+dK1181zUU 9HMXksGvlp1/eLNakjvZhyzxsAeQzJNTSyd7zE1hGbh7L0h0eDIVQrV6zGJkf/xLj3rY bPUQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id r11si440706edo.607.2020.08.28.17.22.50; Fri, 28 Aug 2020 17:23:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1726821AbgH2AVM (ORCPT + 99 others); Fri, 28 Aug 2020 20:21:12 -0400 Received: from mga14.intel.com ([192.55.52.115]:49793 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726584AbgH2AVL (ORCPT ); Fri, 28 Aug 2020 20:21:11 -0400 IronPort-SDR: MpFWC40r6sZtFFFqyJdV72SmPVU+ptm13awjhWSLLOmVhCq7Ph1+jy+c2vfpbM2QgUdVF+R5qs VkNFamtJ2TxA== X-IronPort-AV: E=McAfee;i="6000,8403,9727"; a="156027449" X-IronPort-AV: E=Sophos;i="5.76,365,1592895600"; d="scan'208";a="156027449" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Aug 2020 17:21:10 -0700 IronPort-SDR: XsL7UiaTnATWvQFIcY/3MD+Sm5W8U41OWW6gftH2LedzEuZTp8ocscyURk3zZPyDqWy9YX22Dj aRlVHA3S71sA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,365,1592895600"; d="scan'208";a="340052040" Received: from faerberc-mobl2.ger.corp.intel.com (HELO localhost) ([10.249.36.74]) by orsmga007.jf.intel.com with ESMTP; 28 Aug 2020 17:21:03 -0700 Date: Sat, 29 Aug 2020 03:21:02 +0300 From: Jarkko Sakkinen To: Borislav Petkov Cc: x86@kernel.org, linux-sgx@vger.kernel.org, linux-kernel@vger.kernel.org, Jethro Beekman , Haitao Huang , Chunyang Hui , Jordan Hand , Nathaniel McCallum , Seth Moore , Sean Christopherson , Suresh Siddha , akpm@linux-foundation.org, andriy.shevchenko@linux.intel.com, asapek@google.com, cedric.xing@intel.com, chenalexchen@google.com, conradparker@google.com, cyhanish@google.com, dave.hansen@intel.com, haitao.huang@intel.com, josh@joshtriplett.org, kai.huang@intel.com, kai.svahn@intel.com, kmoy@google.com, ludloff@google.com, luto@kernel.org, nhorman@redhat.com, puiterwijk@redhat.com, rientjes@google.com, tglx@linutronix.de, yaozhangx@google.com Subject: Re: [PATCH v36 12/24] x86/sgx: Add SGX_IOC_ENCLAVE_CREATE Message-ID: <20200829002102.GB39420@linux.intel.com> References: <20200716135303.276442-1-jarkko.sakkinen@linux.intel.com> <20200716135303.276442-13-jarkko.sakkinen@linux.intel.com> <20200826145239.GC22390@zn.tnic> <20200827132436.GA4674@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200827132436.GA4674@linux.intel.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Aug 27, 2020 at 04:24:50PM +0300, Jarkko Sakkinen wrote: > > > + * @arg: userspace pointer to a struct sgx_enclave_create instance > > > + * > > > + * Allocate kernel data structures for a new enclave and execute ECREATE after > > > + * verifying the correctness of the provided SECS. > > > + * > > > + * Note, enforcement of restricted and disallowed attributes is deferred until > > > + * sgx_ioc_enclave_init(), only the architectural correctness of the SECS is > > > + * checked by sgx_ioc_enclave_create(). > > > > From that same review: > > > > "Well, I don't see that checking. Where is it?" > > > > Ok, I'm going to stop here. Please go over v33's review and either > > address *all* feedback or incorporate it into your patches if you agree > > with it but do not silently ignore it. One of the things I very strongly > > detest is ignored review comments. OK, so sgx_validate_secs() is the validation of what the CPU requires from the contents of the SECS. That is mean by "architectural correctness". I spotted the glitch that makes this confusing. The change that the comment is related is https://lore.kernel.org/linux-sgx/20200716135303.276442-16-jarkko.sakkinen@linux.intel.com/ This check in sgx_encl_init() should be relocated to this commit: /* Check that the required attributes have been authorized. */ if (encl->secs_attributes & ~encl->allowed_attributes) return -EACCES; It is the "enforcement of restricted and disallowed attributes" part. Does this make sense to you? > > -- > > Regards/Gruss, > > Boris. /Jarkko