Received: by 2002:a25:1104:0:0:0:0:0 with SMTP id 4csp547445ybr; Fri, 22 May 2020 12:54:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzwvhNXCO4lBTaC5u24sv37IMIL8+QOXzDjIjEXOGpVunox15WHCaKuPCCVdPYO8OPu7xgU X-Received: by 2002:a17:906:b24f:: with SMTP id ce15mr4316674ejb.59.1590177261117; Fri, 22 May 2020 12:54:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590177261; cv=none; d=google.com; s=arc-20160816; b=uRNFacGBoOI/jvaEsl4Xz7omat3XOCIx9+X5ilYC9kgRNUnamhCWJ2Cw756SDvWsiK H4QCJ7yWCUebtfq3jyLNlBhXMqygFrECjZs3+k58UDfef3wmbRjCDYz7iu+e2KBC64jJ aUo/Xgspw1ZN9JNNzj2YJeWmB6db/X5X7PvQPUMJK748rYeAbaJCqIqa8WZam5l+/4Iw KhVC9ChJGy4o1TP2e1IKbhQRDJVrwap0e36CVY6qwKd5yXjtIPvlDKMNdaSINapcBrNz x+6az0yXc2XCat2aXbNQ61sPvOhGuYGa5h/tApe3m6VuCzl1xCidnR4iWFE0Q6HIOkBK tuzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:organization:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:ironport-sdr:ironport-sdr; bh=W+W9eXunidEnZ/yJjl/zCqGaoxJNPWw3UovniZbf2O4=; b=gxRcJN8kJjWk+7ZdtEill19bLUEbJiEYpxP4MiRyQRmhJ5MqfhVp+8oO2C9id3XOej 8b5ztYI0rZu2cZ2y5WEugWFIxy/l0ZJEU/ifcJgfJHsDxXNjVu+i51pR5hnB3gRLi4A+ 4Z27SE/iNkFZf+3mbSPiqPgkJyvaHPTDOgsGrR59RAk3Ww6TUbVqJ+U0vNcE5pCRxAhw 1OISLxnkN0P0xdCeHbwRkyf5BXHeGxTtzVViy6NhkTc/Oyef8iIq6k7npYVgajXD5jMD kErJEDsT6fL2GiUUpq60FxkmbwwAWQxIxe1qamn7vo5BP2F6umFHbhLjHxgs74CaZpUS RwQQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a4si5018285edx.113.2020.05.22.12.53.57; Fri, 22 May 2020 12:54:21 -0700 (PDT) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730948AbgEVTuW (ORCPT + 99 others); Fri, 22 May 2020 15:50:22 -0400 Received: from mga03.intel.com ([134.134.136.65]:42954 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730689AbgEVTuW (ORCPT ); Fri, 22 May 2020 15:50:22 -0400 IronPort-SDR: LJZLoxAzy9G0ke2lwAAgbXMjo3Vt6bSMYVx223lgF64g2Ujpy+SRVbnw5cZBfz0NAe8h+Thfvj slKpKe/BXFIw== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 May 2020 12:50:21 -0700 IronPort-SDR: McQFZ+HU6pS6AMx8kgnQoBmj2AbLEYkA16e3Ed5j+rhddu+/mKXrtp5Fp6g5pJqYnWqUzhp1Xs p9egGDJLKkGw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,422,1583222400"; d="scan'208";a="300769217" Received: from rpurrx-mobl1.ger.corp.intel.com (HELO localhost) ([10.252.58.10]) by fmsmga002.fm.intel.com with ESMTP; 22 May 2020 12:50:17 -0700 Date: Fri, 22 May 2020 22:50:17 +0300 From: Jarkko Sakkinen To: Sean Christopherson Cc: Borislav Petkov , 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, josh@joshtriplett.org, luto@kernel.org, kai.huang@intel.com, rientjes@google.com, cedric.xing@intel.com, puiterwijk@redhat.com, Jethro Beekman Subject: Re: [PATCH v30 04/20] x86/sgx: Add SGX microarchitectural data structures Message-ID: <20200522195017.GA121470@linux.intel.com> References: <20200515004410.723949-1-jarkko.sakkinen@linux.intel.com> <20200515004410.723949-5-jarkko.sakkinen@linux.intel.com> <20200520184745.GJ1457@zn.tnic> <20200522155405.GA8377@linux.intel.com> <20200522161326.GC25128@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200522161326.GC25128@linux.intel.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 22, 2020 at 09:13:26AM -0700, Sean Christopherson wrote: > On Fri, May 22, 2020 at 06:54:05PM +0300, Jarkko Sakkinen wrote: > > On Wed, May 20, 2020 at 08:47:45PM +0200, Borislav Petkov wrote: > > > On Fri, May 15, 2020 at 03:43:54AM +0300, Jarkko Sakkinen wrote: > > > > +/** > > > > + * struct sgx_sigstruct_header - defines author of the enclave > > > > + * @header1: constant byte string > > > > + * @vendor: must be either 0x0000 or 0x8086 > > > > > > Out of pure curiosity: what is that about? > > > > > > Nothing in the patchset enforces this, so hw does? If so, why? > > > > > > Are those vendor IDs going to be assigned by someone or what's up? > > > > > > Thx. > > > > In SGX1 world 0x8086 was used to mark architectural enclaves and 0x0000 > > user run enclaves. In SGX2 world they are irrelevant. > > That's not accurate, the vendor is irrelevant in all SGX eras, e.g. enclaves > signed by someone other than Intel can use 0x8086 on SGX1 hardware and even > pre-LC hardware. 0x8086 is/was used as an _informal_ "this is an > Intel-signed enclave", but in no way was it mandatory or reliable. > > > In order to retain compatiblity I'd add an explicit check to: > > > > 1. Allow vendor ID of 0x0000 or 0x8086. > > 2. Reject other vendor ID's (-EINVAL). > > Unless we also check the reserved fields in sigstruct, I don't see the > point. Even then, I don't understand what the kernel gains from enforcing > anything with respect to sigstruct. Enforcing the SECS makes sense as we > don't want to allow userspace to enable some unknown future feature. But > sigstruct is purely for verification, we (Intel) have far bigger problems > if Intel is enabling new behavior via sigstruct. > > That being said, I'm not dead set against sanity checking sigstruct, I just > think it'd be a waste of cycles. If other values except two are never going to be used it is more than a legit point to validate this field. It also the potential to use ~0x8086 bits to be defined later if ever needed lets say for some kernel specific purpose. /Jarkko