From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 59A94C433DB for ; Wed, 20 Jan 2021 22:34:53 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B74F623440 for ; Wed, 20 Jan 2021 22:34:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B74F623440 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id B4EC26B0005; Wed, 20 Jan 2021 17:34:51 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B00D26B0006; Wed, 20 Jan 2021 17:34:51 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9C9306B0007; Wed, 20 Jan 2021 17:34:51 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0075.hostedemail.com [216.40.44.75]) by kanga.kvack.org (Postfix) with ESMTP id 854016B0005 for ; Wed, 20 Jan 2021 17:34:51 -0500 (EST) Received: from smtpin01.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 4D024180AD806 for ; Wed, 20 Jan 2021 22:34:51 +0000 (UTC) X-FDA: 77727609582.01.thing30_19133322755e Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin01.hostedemail.com (Postfix) with ESMTP id 2BCA71004EF6B for ; Wed, 20 Jan 2021 22:34:51 +0000 (UTC) X-HE-Tag: thing30_19133322755e X-Filterd-Recvd-Size: 3753 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf18.hostedemail.com (Postfix) with ESMTP for ; Wed, 20 Jan 2021 22:34:50 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id 7B1B12220B; Wed, 20 Jan 2021 22:34:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1611182089; bh=2C82eInXgK2XP3lkS3yelUgVXzNNZFQQWo02fjG+A70=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=aKrcqVFk4tx3fqxndo4w3WVFUgE3tAHmDHisYKPZaOuc14wUi1g2ZdK912FZpJ8B4 cy3QdbZu7OqDNzg9k8AbdEVyxQbJVLEn2DMgL+LAOtm7cS611cUb3JPWzBUBzxJnV5 0bVoPRnizOAyyHRfd5nb8kDYUrn5QF3Nqerg0dEn/QGOBQIVHaUs16fIqX5dthLYF5 mhutvMvn6tZrTupydxSWesA6mihWF4/iiVTHMIc+rqc/drT7O47g4ycOGnyUyBPABx duiJfyYq+wNDOzhMRURdsVwsyA5tBR9Y5QIlb/OUXNVVwAogvz94Yd61Z5ogPjZUc9 GlXSut2CHkrDw== Date: Thu, 21 Jan 2021 00:34:43 +0200 From: Jarkko Sakkinen To: Tianjia Zhang Cc: Sean Christopherson , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Andrew Morton , Shuah Khan , haitao.huang@intel.com, Kai Huang , x86@kernel.org, linux-sgx@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, Jia Zhang Subject: Re: [PATCH] x86/sgx: Allows ioctl PROVISION to execute before CREATE Message-ID: References: <20210118133335.98907-1-tianjia.zhang@linux.alibaba.com> <5037ee56-0211-f16c-3ea0-86cf8146b7f8@linux.alibaba.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5037ee56-0211-f16c-3ea0-86cf8146b7f8@linux.alibaba.com> X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Wed, Jan 20, 2021 at 11:57:18AM +0800, Tianjia Zhang wrote: > Hi, > > On 1/20/21 4:05 AM, Sean Christopherson wrote: > > On Mon, Jan 18, 2021, Tianjia Zhang wrote: > > > In function sgx_encl_create(), the logic of directly assigning > > > value to attributes_mask determines that the call to > > > SGX_IOC_ENCLAVE_PROVISION must be after the command of > > > SGX_IOC_ENCLAVE_CREATE. If change this assignment statement to > > > or operation, the PROVISION command can be executed earlier and > > > more flexibly. > > > > > > Reported-by: Jia Zhang > > > Signed-off-by: Tianjia Zhang > > > --- > > > arch/x86/kernel/cpu/sgx/ioctl.c | 2 +- > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > diff --git a/arch/x86/kernel/cpu/sgx/ioctl.c b/arch/x86/kernel/cpu/sgx/ioctl.c > > > index f45957c05f69..0ca3fc238bc2 100644 > > > --- a/arch/x86/kernel/cpu/sgx/ioctl.c > > > +++ b/arch/x86/kernel/cpu/sgx/ioctl.c > > > @@ -108,7 +108,7 @@ static int sgx_encl_create(struct sgx_encl *encl, struct sgx_secs *secs) > > > encl->base = secs->base; > > > encl->size = secs->size; > > > encl->attributes = secs->attributes; > > > - encl->attributes_mask = SGX_ATTR_DEBUG | SGX_ATTR_MODE64BIT | SGX_ATTR_KSS; > > > + encl->attributes_mask |= SGX_ATTR_DEBUG | SGX_ATTR_MODE64BIT | SGX_ATTR_KSS; > > > > Alternatively, move the existing code to sgx_open()? Initializing the field > > when the encl object is allocated feels more correct. > > > > > This seems like a good idea. Thanks for your suggestion. I have sent v2 > patch, include the next two patches. Did you ask from Sean about suggested-by's? Now it looks like that doing these patches were originally proposed by Sean. /Jarkko