Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp5930683ybf; Thu, 5 Mar 2020 09:41:13 -0800 (PST) X-Google-Smtp-Source: ADFU+vtPmNDDwDOJukb+QtlGv3fZpBu5ksdT8f+FfoaYOVRfuHZEaQjbcufBwyt8iFVgTtqyayZ3 X-Received: by 2002:a9d:6d96:: with SMTP id x22mr7741853otp.264.1583430073116; Thu, 05 Mar 2020 09:41:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583430073; cv=none; d=google.com; s=arc-20160816; b=XJz9Z1UgkjrcPGb4X+yrfnFPFSywavBqzkGJYOdOaK8SG3n9FsJsVe+OR9QIAmsOwF J1tg5ivbnXxlA9Qftgbolpl373Jo4c5b8shr2/raGXfALevTxv4nQ+52WslVIbYVk1xR T48XzGcpC+jn9lp904bJVcdFFVdMGKATcF1pKNCq3nIGTXVb2/Xba5e9pXhH2duTOnWm DY8xcIBEU9bEMvWD3HMTVZO9+tlTbffNwkFVHH3fQLf8auG/JM8qxXeAzHzZMHQKulYe kbOBoplsW/Lt0X+C2o/g70FTBZpjlwNM8uLpLNNCPW46RBx8eLWESiTbrq+yhcsWCvCJ HXHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=vnhQsx3J83dyC6txdqXbhoi9X8YHXr0BcxBQ8+CiMVU=; b=sy5eoRe31aR7bmsnmmYgzlVurq2GeI2GPoPVOTAjo+QzA7swmB7cvQLmEEDBWZGQ21 xJt3J281cn77Ql5dBBXlJaLQOL04tXIXUd/K9h5op165mdcfmgKtkeGcOdzfWdYo82/5 2cX+Q+3AhMg/U/Q4pu1RU4n2JoDLZLSkvI8vZeQpwxHf/qScT+wq/DaAesK3UQoaZE6q SC9/mtQyIsTQhJMnnd9hFWiMa4YZbMualvRkC9+zQIScx8i0goRC0i9vSjzQVytkVmzq 30qxRcPWzU49KaMe73PXpGk+NdCVzjb7pniDVQSJA2+sis419MztLhBG0Ur4Qie4s0uG TI/Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id f24si3861858otl.300.2020.03.05.09.41.00; Thu, 05 Mar 2020 09:41:13 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1726128AbgCERkR (ORCPT + 99 others); Thu, 5 Mar 2020 12:40:17 -0500 Received: from mga04.intel.com ([192.55.52.120]:50947 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725938AbgCERkR (ORCPT ); Thu, 5 Mar 2020 12:40:17 -0500 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Mar 2020 09:40:16 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,518,1574150400"; d="scan'208";a="275184963" Received: from sjchrist-coffee.jf.intel.com (HELO linux.intel.com) ([10.54.74.202]) by fmsmga002.fm.intel.com with ESMTP; 05 Mar 2020 09:40:15 -0800 Date: Thu, 5 Mar 2020 09:40:15 -0800 From: Sean Christopherson To: Jarkko Sakkinen Cc: linux-kernel@vger.kernel.org, x86@kernel.org, linux-sgx@vger.kernel.org, akpm@linux-foundation.org, dave.hansen@intel.com, nhorman@redhat.com, npmccallum@redhat.com, haitao.huang@intel.com, andriy.shevchenko@linux.intel.com, tglx@linutronix.de, kai.svahn@intel.com, bp@alien8.de, josh@joshtriplett.org, luto@kernel.org, kai.huang@intel.com, rientjes@google.com, cedric.xing@intel.com, puiterwijk@redhat.com, linux-security-module@vger.kernel.org, Suresh Siddha , Haitao Huang , Jethro Beekman , Chunyang Hui Subject: Re: [PATCH v28 11/22] x86/sgx: Linux Enclave Driver Message-ID: <20200305174015.GJ11500@linux.intel.com> References: <20200303233609.713348-1-jarkko.sakkinen@linux.intel.com> <20200303233609.713348-12-jarkko.sakkinen@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200303233609.713348-12-jarkko.sakkinen@linux.intel.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 04, 2020 at 01:35:58AM +0200, Jarkko Sakkinen wrote: > diff --git a/arch/x86/include/uapi/asm/sgx.h b/arch/x86/include/uapi/asm/sgx.h > new file mode 100644 > index 000000000000..5edb08ab8fd0 > --- /dev/null > +++ b/arch/x86/include/uapi/asm/sgx.h > @@ -0,0 +1,66 @@ > +/* SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause) WITH Linux-syscall-note */ > +/* > + * Copyright(c) 2016-19 Intel Corporation. > + */ > +#ifndef _UAPI_ASM_X86_SGX_H > +#define _UAPI_ASM_X86_SGX_H > + > +#include > +#include > + > +/** > + * enum sgx_epage_flags - page control flags > + * %SGX_PAGE_MEASURE: Measure the page contents with a sequence of > + * ENCLS[EEXTEND] operations. > + */ > +enum sgx_page_flags { > + SGX_PAGE_MEASURE = 0x01, > +}; > + > +#define SGX_MAGIC 0xA4 > + > +#define SGX_IOC_ENCLAVE_CREATE \ > + _IOW(SGX_MAGIC, 0x00, struct sgx_enclave_create) > +#define SGX_IOC_ENCLAVE_ADD_PAGES \ > + _IOWR(SGX_MAGIC, 0x01, struct sgx_enclave_add_pages) > +#define SGX_IOC_ENCLAVE_INIT \ > + _IOW(SGX_MAGIC, 0x02, struct sgx_enclave_init) > + > +/** > + * struct sgx_enclave_create - parameter structure for the > + * %SGX_IOC_ENCLAVE_CREATE ioctl > + * @src: address for the SECS page data > + */ > +struct sgx_enclave_create { > + __u64 src; Would it make sense to add reserved fields to the structs so that new features can be added in a backwards compatible way? E.g. if we want to allow userspace to control the backing store by passing in a file descriptor ENCLAVE_CREATE. > +}; > + > +/** > + * struct sgx_enclave_add_pages - parameter structure for the > + * %SGX_IOC_ENCLAVE_ADD_PAGE ioctl > + * @src: start address for the page data > + * @offset: starting page offset > + * @length: length of the data (multiple of the page size) > + * @secinfo: address for the SECINFO data > + * @flags: page control flags > + * @count: number of bytes added (multiple of the page size) > + */ > +struct sgx_enclave_add_pages { > + __u64 src; > + __u64 offset; > + __u64 length; > + __u64 secinfo; > + __u64 flags; > + __u64 count; > +}; > + > +/** > + * struct sgx_enclave_init - parameter structure for the > + * %SGX_IOC_ENCLAVE_INIT ioctl > + * @sigstruct: address for the SIGSTRUCT data > + */ > +struct sgx_enclave_init { > + __u64 sigstruct; > +};