Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp347700ybh; Wed, 11 Mar 2020 02:14:44 -0700 (PDT) X-Google-Smtp-Source: ADFU+vulmOX6OdWqQyZveA8pm5EggOMSLyBLFGd9y1zUzDTz8tx3keuPl2FpQ7Q64Ato86wkfXsD X-Received: by 2002:a9d:d04:: with SMTP id 4mr1528587oti.101.1583918084435; Wed, 11 Mar 2020 02:14:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1583918084; cv=none; d=google.com; s=arc-20160816; b=d2QIHL3Xc6LRyQPIq9r+O+55Jr3oRF71/vSkkA3UgKiOVvIEDZql+g7xSd0UjVu3QJ nmWY959vwgaUtrU7dX/VlUb3tNgN5khvyaScihJoF0UlDMImhoACVoKzwC3Ej9c0suKQ yKa2/nyheg5DYJY3xpVKlWewLR8HooZQtPbLz8I6CC8gZXfMWWOP5U8CNa20Kqov6g3o IiT13QHzlhBkF8PSN1z/jSdQAkJU65fyF+52nmmo5wBDKZGGxL31G8xhza0FbzB154Kr 5VJRI4OWewhNVRJ/L4GsDJ16JVjvqdzFpDuaHyBPoHBWJ8Azb3TcFt4FPfcd/Vtjtttw Siag== 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:reply-to:message-id :subject:cc:to:from:date; bh=O5lFESoTOUYlbQDoZ3AhHg9tdzFpAqB0Pwjj0vZELuM=; b=Llno4A1rSicKFEbfLSSPn7XT6oFEmCvZL3pLcldW5iErGhsfUu590pCVdd7Lzqrq6X 4bF6b/4SIEDR+uAO3Vt6GFxfBX9MIul1b+asZ2BAHMAw98cAUiEOpx5tkLrXruB8oOSF FZtQp8SOXxTMMxHSDODvv+fQKuqor2j/KjtJKNY83yF9+o458ElvRStafT8XWq+glOQu CI2aB6+TrCBmBNW65s815VmQIGVHezBp3IUaYnqjdNMmPtTyruk8ATgm/cPq2ljz3oIN axAtTu9ZY2bfqpsgzFHi+Rr05YTilefCLRoFJ9eLAW4UrdId4jh/Z0/7UrwGKHF5afEP GGrQ== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x7si739123oie.189.2020.03.11.02.14.33; Wed, 11 Mar 2020 02:14:44 -0700 (PDT) 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728917AbgCKJNl (ORCPT + 99 others); Wed, 11 Mar 2020 05:13:41 -0400 Received: from wind.enjellic.com ([76.10.64.91]:59852 "EHLO wind.enjellic.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728150AbgCKJNk (ORCPT ); Wed, 11 Mar 2020 05:13:40 -0400 Received: from wind.enjellic.com (localhost [127.0.0.1]) by wind.enjellic.com (8.15.2/8.15.2) with ESMTP id 02B9DEfJ008298; Wed, 11 Mar 2020 04:13:14 -0500 Received: (from greg@localhost) by wind.enjellic.com (8.15.2/8.15.2/Submit) id 02B9DDv2008297; Wed, 11 Mar 2020 04:13:13 -0500 Date: Wed, 11 Mar 2020 04:13:13 -0500 From: "Dr. Greg" To: Haitao Huang Cc: Jarkko Sakkinen , linux-kernel@vger.kernel.org, x86@kernel.org, linux-sgx@vger.kernel.org, akpm@linux-foundation.org, dave.hansen@intel.com, sean.j.christopherson@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-kselftest@vger.kernel.org Subject: Re: [PATCH v28 14/22] selftests/x86: Add a selftest for SGX Message-ID: <20200311091313.GA8094@wind.enjellic.com> Reply-To: "Dr. Greg" References: <20200303233609.713348-1-jarkko.sakkinen@linux.intel.com> <20200303233609.713348-15-jarkko.sakkinen@linux.intel.com> <20200306053210.GA16297@wind.enjellic.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4i X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.2.3 (wind.enjellic.com [127.0.0.1]); Wed, 11 Mar 2020 04:13:14 -0500 (CDT) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 10, 2020 at 02:29:41PM -0500, Haitao Huang wrote: Good morning, I hope this note finds the week going well for everyone. > On Thu, 05 Mar 2020 23:32:10 -0600, Dr. Greg wrote: > > >On Wed, Mar 04, 2020 at 01:36:01AM +0200, Jarkko Sakkinen wrote: > > > >Good evening, I hope the end of the week is going well for everyone. > > > >>Add a selftest for SGX. It is a trivial test where a simple enclave > >>copies one 64-bit word of memory between two memory locations given > >>to the enclave as arguments. Use ENCLS[EENTER] to invoke the > >>enclave. > > > >Just as a clarification, are you testing the new driver against signed > >production class enclaves in .so format that also include metadata > >layout directives or is the driver just getting tested against the two > >page toy enclave that copies a word of memory from one memory location > >to another? > We (Intel SGX SDK/PSW team) tested this driver for enclaves in .so > format with metadata. Our 2.8 release supports v24 and 2.9 supports > v25+. Both production signed and debug signed enclaves worked. Very good, this was the feedback we were hoping to get. > *Note* we did make some code changes in our runtime for v24+, mainly > dealing with src & EPC page alignment for EADD, open one fd per > enclave, use -z noexecstack linker option, etc. You can see the > changes on GitHub. Yes, we made all of those changes as well, in a similar fashion. This was the third time that we have changed the enclave creation mmap() and alignment constraints, only to take us back to what we had started with... :-)( > >Our PSW/runtime is currently failing to initialize production class > >enclaves secondary to a return value of -4 from the ENCLU[EINIT] > >instruction, which means the measurement of the loaded enclave has > >failed to match the value in the signature structure. > > > >The same enclave loads fine with the out of kernel driver. Our > >diagnostics tell us we are feeding identical page streams and > >permissions to the page add ioctl's of both drivers. The identity > >modulus signature of the signing key for the enclave is being written > >to the launch control registers. > > > >We see the same behavior from both our unit test enclaves and the > >Quoting Enclave from the Intel SGX runtime. > We did not see any issue loading QE in our tests. Please directly > email me on this test if you have specific questions. It isn't anything specific to the QE, we just used that as an example, since it has no special attribute requirements and would seem to be a good reference test for everyone working on runtimes. We are missing some nuance with the latest version of the driver, our runtime was working fine with the new driver a year ago. It almost has to be a problem with metadata, we are suspicious of guard page processing. We are following the same strategy that we had used previously and leaving a 'hole' in the enclave for each guard page at its RVA offset. The comment in the add page ioctl indicating that the page range has to be contiguous caught our eye and has us questioning if this continues to be the correct approach. Do you remember, off the top of your head, having to address guard pages differently? Have a good remainder of the week. Dr. Greg > Using Opera's mail client: http://www.opera.com/mail/ As always, Dr. Greg Wettstein, Ph.D, Worker IDfusion, LLC SGX secured infrastructure and 4206 N. 19th Ave. autonomously self-defensive platforms. Fargo, ND 58102 PH: 701-281-1686 EMAIL: greg@enjellic.com ------------------------------------------------------------------------------ "Work makes life enjoyable." -- North Dakota Germans