Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2523805pxb; Sat, 30 Jan 2021 05:30:22 -0800 (PST) X-Google-Smtp-Source: ABdhPJw0JplqTNsgBOELGgwFoNzMevjHXbASzI475Gs/A+HfXgzb07gWTTY5Wd/MWBOfBisxkMaN X-Received: by 2002:aa7:c88a:: with SMTP id p10mr10047930eds.204.1612013422045; Sat, 30 Jan 2021 05:30:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612013422; cv=none; d=google.com; s=arc-20160816; b=ocukKl4I+Dt5FF5544VwBIRC1f5VlXeG6TG8M2VchX80hkpT2vn7nD5+IZTttVqTiP qTNPtnICceR7Ostd8bHpfEWBh8nKpqIneZT+7LJL8MJzyNrj2Imj7NBvdrJLC3ab2Ejl wE3HQxzcRcXB9lu9jW+ymbjxD8L/8VaKDOGRHifUfkN8a6Lcp0GK0rU8E2UEOwypec0c G903bFk7Qv4tJklnwZWlnOAIJpJcBsySrKsYOcgtgw3JZN8bNFGYldG72+C0jg0x00lj 0FyJ9H1NcV2aCb38IiQ0EPcQWYUGUfY9QgwfS/w6dGRCuK5EOm9rz3BXCByEsjnhTH/Q MYgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=PI329EWiFre5empinNQK5/0Sl9CiAAoyrD4hUD8iRsg=; b=fFglFRh0wNg6tJU+OmLhRaD7rmCbLDCBBCIDnR97rVWkLPz4OV1NWjcm6I6XuGrcV+ ZsTKuXMPLBhb63ost1l8tmElsACvjHxonb9T2pAvYybjpJBS4+dDfEbhfeEVkVdBsmyH rvSOkFTzRGSi2YFGyUgfHoHOoIuZm5n9PPc5wqmJ7x0C8ee2k8j5clsv3BAmNXsrVrTj IiglI5XIVGqRUh9zILRBziwbSlkAys2Twu/XMeYAzslPOv/7/yMmJcAaEBPlo8oP7Rz3 v7pOr+a3hUNDKOoOnLYaRG3ap9zmUQfnVKE0OMT8l3p/pIyUrzejkjfQHH1H9oQO5E+L trnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=tXJfBMXx; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f10si6846520ejr.536.2021.01.30.05.29.57; Sat, 30 Jan 2021 05:30:22 -0800 (PST) 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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=tXJfBMXx; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230358AbhA3N1Q (ORCPT + 99 others); Sat, 30 Jan 2021 08:27:16 -0500 Received: from mail.kernel.org ([198.145.29.99]:36984 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229763AbhA3N1G (ORCPT ); Sat, 30 Jan 2021 08:27:06 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id F111964E05; Sat, 30 Jan 2021 13:26:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1612013185; bh=9g8Weva6Bu5I0fLYPtGE67zrIs27HNKf1unRqDZxlEQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=tXJfBMXxV4u0dYwPJtTQ4Vlg5hacVZMJlJ1ENGA/tGGxMozaqW2iQC/3Lab8Zw9s9 46EORyIB0J8gGhRGamLIkPo8beFQCJ7x6eZwen4cyidOzH2q/Wx/+knefkDWIc1oW/ WjR/HqCV4UWRx2rVQVq80GEQG5i3g16eAvzcc5+csFq3/2v11N32g4h1souzn2UPP5 +QyhvCJZbiCe2aTcyKEJA5mSmwVJ5SAC4kHfNZRxEriKxHf16gRxsFybsd7YX+1E9+ sJjC8tk5A+VFx1x3+W9om1pdB/cgWUDeYTaK+JiGrUdKwaZ+cbAZKs8S2ig9nJIcuK St865nS088Nlw== Date: Sat, 30 Jan 2021 15:26:20 +0200 From: Jarkko Sakkinen To: Tianjia Zhang Cc: Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Sean Christopherson , Shuah Khan , x86@kernel.org, linux-sgx@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Jia Zhang Subject: Re: [PATCH v3 4/5] x86/sgx: Allows ioctl PROVISION to execute before CREATE Message-ID: References: <20210124062907.88229-1-tianjia.zhang@linux.alibaba.com> <20210124062907.88229-5-tianjia.zhang@linux.alibaba.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210124062907.88229-5-tianjia.zhang@linux.alibaba.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Jan 24, 2021 at 02:29:06PM +0800, Tianjia Zhang wrote: > In the function sgx_create_enclave(), the direct assignment > operation of attributes_mask determines that the ioctl PROVISION > operation must be executed after the ioctl CREATE operation, > which will limit the flexibility of sgx developers. > > This patch takes the assignment of `attributes_mask` from the > function sgx_create_enclave() has been moved to the function > sgx_open() to avoid this restriction. > > Signed-off-by: Tianjia Zhang The commit message should explicit that the API behaviour changes as the result. Please don't use hyphens in quoting. /Jarkko > --- > arch/x86/kernel/cpu/sgx/driver.c | 1 + > arch/x86/kernel/cpu/sgx/ioctl.c | 1 - > 2 files changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/x86/kernel/cpu/sgx/driver.c b/arch/x86/kernel/cpu/sgx/driver.c > index f2eac41bb4ff..fba0d0bfe976 100644 > --- a/arch/x86/kernel/cpu/sgx/driver.c > +++ b/arch/x86/kernel/cpu/sgx/driver.c > @@ -36,6 +36,7 @@ static int sgx_open(struct inode *inode, struct file *file) > return ret; > } > > + encl->attributes_mask = SGX_ATTR_DEBUG | SGX_ATTR_MODE64BIT | SGX_ATTR_KSS; > file->private_data = encl; > > return 0; > diff --git a/arch/x86/kernel/cpu/sgx/ioctl.c b/arch/x86/kernel/cpu/sgx/ioctl.c > index 90a5caf76939..1c6ecf9fbeff 100644 > --- a/arch/x86/kernel/cpu/sgx/ioctl.c > +++ b/arch/x86/kernel/cpu/sgx/ioctl.c > @@ -109,7 +109,6 @@ 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; > > /* Set only after completion, as encl->lock has not been taken. */ > set_bit(SGX_ENCL_CREATED, &encl->flags); > -- > 2.19.1.3.ge56e4f7 > >