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 C11FCC433E0 for ; Wed, 20 Jan 2021 22:37:41 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 53A2F235DD for ; Wed, 20 Jan 2021 22:37:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 53A2F235DD 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 C357B6B0005; Wed, 20 Jan 2021 17:37:40 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id BE6596B0006; Wed, 20 Jan 2021 17:37:40 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AFBBC6B0007; Wed, 20 Jan 2021 17:37:40 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0197.hostedemail.com [216.40.44.197]) by kanga.kvack.org (Postfix) with ESMTP id 9A9156B0005 for ; Wed, 20 Jan 2021 17:37:40 -0500 (EST) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 58CEC8249980 for ; Wed, 20 Jan 2021 22:37:40 +0000 (UTC) X-FDA: 77727616680.20.fall25_0110bf32755e Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin20.hostedemail.com (Postfix) with ESMTP id 232D7180C07AB for ; Wed, 20 Jan 2021 22:37:40 +0000 (UTC) X-HE-Tag: fall25_0110bf32755e X-Filterd-Recvd-Size: 4167 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf23.hostedemail.com (Postfix) with ESMTP for ; Wed, 20 Jan 2021 22:37:39 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id A5B7D23440; Wed, 20 Jan 2021 22:37:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1611182258; bh=oSG+9JCEDtoH01WuM1ed6gw+x9TEFGlrSLZLk8N5Ybk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=NIByYIeIuKNAFtQlyHLFL/UwxXXgBLrsA0lxr4nxA9/xUtV2fvg7qupq2S1zsyX6d xRgnRAEGfUIT3Q9A7xiluSiVhU5s/uLn4AcyCoLjVa161/VwzYx9j0cuPZr5+khX4v kpgSoMHZExxf4Wr0n9WH3v58G0WCR5ehd72f0bKbwCrCWqF6xGGLASnMF42+h4EKpf IjzpAh0hJKBkKBEJDb7qYIjUyObEK9Zgq1lEiBdVoZjC7940CBJVZezP83Dp6zU6Ok BflbD1LvOZcB2/tGPlRGTzfb3Q+nqrC7czIn/hO9Qr3biRBIOIj2HY9wt9ulHC58en fCMvn9aLkfTYA== Date: Thu, 21 Jan 2021 00:37:32 +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: 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 Thu, Jan 21, 2021 at 12:34:49AM +0200, Jarkko Sakkinen wrote: > 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. Please do not add tags from people *unauthentically*. I do not see anything from Sean to any of the patches that would suggest adding those tags. You are basically just stamping that to all patches, which he has given a code review. Can you stop doing this? /Jarkko