Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp1097009ybf; Fri, 28 Feb 2020 14:05:59 -0800 (PST) X-Google-Smtp-Source: APXvYqyXK4MvXVTD5MBfsM1HU+DA514AynTqZ+/mpxLmnNhVuLlHG5w+Wn7v2IYv58HRIFwMkaFX X-Received: by 2002:aca:1903:: with SMTP id l3mr4713583oii.16.1582927559832; Fri, 28 Feb 2020 14:05:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582927559; cv=none; d=google.com; s=arc-20160816; b=YJTJ7E+E+kjHAl5hynQWPjlGJBVT8+p/kDNcKENo8NegMvMp0Rkw6zNPa2tUb/cNOM Yc08ZjtkE0b8bwY20owoJLLHgEEi63+sivz8RsJGOan0x+q6LT6IsEH08nBU7VC1iVBm lvxKEUJdbtFnRyfaHAKjkhht/ejL9M9Ybtpm31FMRFXyWkqGAjaeaoOuYF53itv92rfs AddyKu0SCOfBD7Ninaam4jmy1MaltS4UEFxdlEk7Z9QV/79FHKhHgdwiKDpoKUKKJv01 eNqHttSbEstuEDhvI1dpQTTyEZhIcDYCfK3fI/NErfWCSOIqgN8bCfsSXsOLwgpXKB3P m5AQ== 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=38G5dP871t87TeDjV18QpdIMhC0TN+YPXCcj+XxbjAg=; b=xHTZqWXeETPyArtk1Zzv2LICB2jj6pmVEyuOYARIiUgtBnBG4bpOE9bh75ahqDkwpp D57SRARUGfS5QKtnTauMVIHXMeVSqjbZMgP8L40wUpz0sEqyzRYd/PiANSN94eb+8Qou DHMESo6TOus0ILOhJUinvygqnyN/DTxRBShdWMDc3aXBNBAzTXm4Tt8mb1K1g9y828iV H0jUrrxH8w/uG0edu+sif2BSxegZ3kMzpJa+41G85k0+TwzFHY+dQKA4Rwi3hP7gtccp HiTd8HhymyP64y/E2NcP9vGwZP7vxCzLAjNZCEFchTBZ6EJ5RaFz5pub+iyJ+HSAzj9e qjlg== 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 o1si2249714otk.154.2020.02.28.14.05.46; Fri, 28 Feb 2020 14:05:59 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726418AbgB1WEx (ORCPT + 99 others); Fri, 28 Feb 2020 17:04:53 -0500 Received: from wind.enjellic.com ([76.10.64.91]:58694 "EHLO wind.enjellic.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726077AbgB1WEx (ORCPT ); Fri, 28 Feb 2020 17:04:53 -0500 Received: from wind.enjellic.com (localhost [127.0.0.1]) by wind.enjellic.com (8.15.2/8.15.2) with ESMTP id 01SM2DVg008025; Fri, 28 Feb 2020 16:02:13 -0600 Received: (from greg@localhost) by wind.enjellic.com (8.15.2/8.15.2/Submit) id 01SM2CkT008024; Fri, 28 Feb 2020 16:02:12 -0600 Date: Fri, 28 Feb 2020 16:02:12 -0600 From: "Dr. Greg" To: Sean Christopherson Cc: Jarkko Sakkinen , 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 Subject: Re: [PATCH v27 00/22] Intel SGX foundations Message-ID: <20200228220212.GA7978@wind.enjellic.com> Reply-To: "Dr. Greg" References: <20200223172559.6912-1-jarkko.sakkinen@linux.intel.com> <20200224100932.GA15526@wind.enjellic.com> <20200224211317.GJ29865@linux.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200224211317.GJ29865@linux.intel.com> 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]); Fri, 28 Feb 2020 16:02:13 -0600 (CST) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Feb 24, 2020 at 01:13:17PM -0800, Sean Christopherson wrote: Hi, I hope the week is ending well for everyone. > On Mon, Feb 24, 2020 at 04:09:32AM -0600, Dr. Greg wrote: > > On Sun, Feb 23, 2020 at 07:25:37PM +0200, Jarkko Sakkinen wrote: > > > > Good morning, I hope the week is starting well for everyone. > > > > > Intel(R) SGX is a set of CPU instructions that can be used by > > > applications to set aside private regions of code and data. The code > > > outside the enclave is disallowed to access the memory inside the > > > enclave by the CPU access control. > > > > Do we misinterpret or is the driver not capable of being built in > > modular form? > Correct. That is what we had concluded, thanks for the verification. > > If not, it would appear that this functionality has been lost since > > version 19 of the driver, admittedly some time ago. > It was removed in v20[*]. We didn't see documentation of this in any of the v20 release bullet points, hence the question. > > > * Allow the driver to be compiled as a module now that it no code is using > > > its routines and it only uses exported symbols. Now the driver is > > > essentially just a thin ioctl layer. > > Not having the driver available in modular form obviously makes > > work on the driver a bit more cumbersome. > Heh, depends on your development environment, e.g. I do 99% of my > testing in a VM with a very minimal kernel that even an anemic > system can incrementally build in a handful of seconds. Lacking a collection of big beefy development machines with 256+ gigabytes of RAM isn't the challenge, rebooting to test functionality on the physical hardware is what is a bit of a nuisance. > > I'm assuming that the lack of module support is secondary to some > > innate architectural issues with the driver? > As of today, the only part of the driver that can be extracted into > a module is effectively the ioctl() handlers, i.e. a module would > just be an ioctl() wrapper around a bunch of in-kernel > functionality. At that point, building the "driver" as a module > doesn't provide any novel benefit, e.g. very little memory > footprint savings, reloading the module wouldn't "fix" any bugs with > EPC management, SGX can still be forcefully disabled via kernel > parameter, etc... And on the flip side, allowing it to be a module > would require exporting a non-trivial number of APIs that really > shouldn't be exposed outside of the SGX subsystem. > > As for why things are baked into the kernel: > > - EPC management: support for future enhancements (KVM and EPC cgroup). > > - Reclaim: don't add a unnecessary infrastructure, i.e. avoid a callback > mechanism for which there is a single implementation. > > - Tracking of LEPUBKEYHASH MSRs: KVM support. I don't doubt the justifications, just a bit unusual for a driver, but this driver is obviously a bit unusual. It will be interesting to see if the distros compile it in. Thank you for the clarifications, have a good weekend. Dr. Greg As always, Dr. Greg Wettstein, Ph.D Worker / Principal Engineer IDfusion, LLC 4206 19th Ave N. Specialists in SGX secured infrastructure. Fargo, ND 58102 PH: 701-281-1686 CELL: 701-361-2319 EMAIL: gw@idfusion.org ------------------------------------------------------------------------------ "We are confronted with insurmountable opportunities." -- Walt Kelly