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 BE876C433DB for ; Wed, 20 Jan 2021 14:31:09 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 647B92336E for ; Wed, 20 Jan 2021 14:31:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 647B92336E 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 D14526B0008; Wed, 20 Jan 2021 09:31:08 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id CC6816B000E; Wed, 20 Jan 2021 09:31:08 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C00B46B0010; Wed, 20 Jan 2021 09:31:08 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0203.hostedemail.com [216.40.44.203]) by kanga.kvack.org (Postfix) with ESMTP id A94716B0008 for ; Wed, 20 Jan 2021 09:31:08 -0500 (EST) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 6936A1EE6 for ; Wed, 20 Jan 2021 14:31:08 +0000 (UTC) X-FDA: 77726390616.27.grip19_540072b2755b Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin27.hostedemail.com (Postfix) with ESMTP id 0C2033D663 for ; Wed, 20 Jan 2021 14:31:08 +0000 (UTC) X-HE-Tag: grip19_540072b2755b X-Filterd-Recvd-Size: 3168 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf11.hostedemail.com (Postfix) with ESMTP for ; Wed, 20 Jan 2021 14:31:07 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id A4DF823329; Wed, 20 Jan 2021 14:31:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1611153066; bh=8ijHEArz/T4yteWj2Qo2ETynpxRFgL8u5w2L3MIippg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=V6yhmSWuo5TCqMwsKHnuAdBHWipZGSvZEzuvDV2sg4DDvVeKNy21ThcJZDc1JpviA kUoUUd3Prgjewen8Geby42C8apKpctaIZTHb9VHrxBsZEYJScoRf5TkPszok7cjVpG Jh9pfVcjiAU73NKlZvyv8ijJckfqk5KvBQ0EZbcCf3DUSfpcXd31axMfshcoC90oAC astLVLfgvR94fFkni1HsBbKmpCIP7UxvNhXYSgytjSlbLlFuyz95t8uBWUiQ2tDimo qfLLrbphpGRNZwU5YRKjQF99+mCwKa9/iDUp/B6Wmh3HGm0kYpME+ARWqCQqkgumIH aK/jFIM6d8YIg== Date: Wed, 20 Jan 2021 16:31:00 +0200 From: Jarkko Sakkinen To: Tianjia Zhang Cc: 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210118133335.98907-1-tianjia.zhang@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 Mon, Jan 18, 2021 at 09:33:35PM +0800, 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 > --- Why? > 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; > > /* Set only after completion, as encl->lock has not been taken. */ > set_bit(SGX_ENCL_CREATED, &encl->flags); > -- > 2.19.1.3.ge56e4f7 > >