From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.3 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DF184C606CF for ; Tue, 9 Jul 2019 00:02:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 99BBB216C4 for ; Tue, 9 Jul 2019 00:02:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=yahoo.com header.i=@yahoo.com header.b="Fcg/07gN" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725889AbfGIACF (ORCPT ); Mon, 8 Jul 2019 20:02:05 -0400 Received: from sonic309-23.consmr.mail.bf2.yahoo.com ([74.6.129.197]:35610 "EHLO sonic309-23.consmr.mail.bf2.yahoo.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725937AbfGIACE (ORCPT ); Mon, 8 Jul 2019 20:02:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1562630521; bh=0bABuSM8vXX/kRlsageKPfgn55dZl7H1znqPEjOgo/Q=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From:Subject; b=Fcg/07gN9ycliYqt0CrIE94dmIDMoQLbZVYzwxxEAVJr7ukVg8XppfUtpiYVp1sshOk4CcrCQGA89a4Q5aB/4MwU1HncDyeGtdWGfqzcQOreHCFg0VTpSqEFblUz4fDXOpC2tjTSg5crQJnWgws3VX0hS9mvJ1aVRneJ/N/QWB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yahoo.com with HTTP; Tue, 9 Jul 2019 00:02:01 +0000 Received: by smtp409.mail.bf1.yahoo.com (Oath Hermes SMTP Server) with ESMTPA ID fa96bfe426bb012e6c874f9d1fca7ee3; Tue, 09 Jul 2019 00:02:01 +0000 (UTC) Subject: Re: [RFC PATCH v2 1/3] x86/sgx: Add SGX specific LSM hooks To: "Dr. Greg" , casey@schaufler-ca.com Cc: "Xing, Cedric" , Stephen Smalley , "linux-sgx@vger.kernel.org" , "linux-security-module@vger.kernel.org" , "selinux@vger.kernel.org" , "Schaufler, Casey" , "jmorris@namei.org" , "luto@kernel.org" , "jethro@fortanix.com" , "sds@tycho.nsa.gov" , "jarkko.sakkinen@linux.intel.com" , "Christopherson, Sean J" References: <18833f2e-9d18-1f39-6bc5-9242910ab25c@schaufler-ca.com> <960B34DE67B9E140824F1DCDEC400C0F6551D585@ORSMSX116.amr.corp.intel.com> <960B34DE67B9E140824F1DCDEC400C0F6551D7F7@ORSMSX116.amr.corp.intel.com> <63c92ab6-dc8d-826b-b8bf-05ad262f06e4@schaufler-ca.com> <960B34DE67B9E140824F1DCDEC400C0F6551DBF7@ORSMSX116.amr.corp.intel.com> <9e45df1b-3aac-e851-4ef2-5b262f5139bd@schaufler-ca.com> <20190703094651.GA29601@wind.enjellic.com> <012fc47d-4e9d-3398-0d9d-d9298a758c8d@schaufler-ca.com> <20190707133023.GA4521@wind.enjellic.com> From: Casey Schaufler Openpgp: preference=signencrypt Autocrypt: addr=casey@schaufler-ca.com; keydata= mQINBFzV9HABEAC/mmv3jeJyF7lR7QhILYg1+PeBLIMZv7KCzBSc/4ZZipoWdmr77Lel/RxQ 1PrNx0UaM5r6Hj9lJmJ9eg4s/TUBSP67mTx+tsZ1RhG78/WFf9aBe8MSXxY5cu7IUwo0J/CG vdSqACKyYPV5eoTJmnMxalu8/oVUHyPnKF3eMGgE0mKOFBUMsb2pLS/enE4QyxhcZ26jeeS6 3BaqDl1aTXGowM5BHyn7s9LEU38x/y2ffdqBjd3au2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v+ob2RCT7qQlUo6GRLcvj9Fn5tR4hBvR6D3m8aR0AGHbcC62cq I7LjaSDP5j/em4oVL2SMgNTrXgE2w33JMGjAx9oBzkxmKUqprhJomPwmfDHMJ0t7y39Da724 oLPTkQDpJL1kuraM9TC5NyLe1+MyIxqM/8NujoJbWeQUgGjn9uxQAil7o/xSCjrWCP3kZDID vd5ZaHpdl8e1mTExQoKr4EWgaMjmD/a3hZ/j3KfTVNpM2cLfD/QwTMaC2fkK8ExMsz+rUl1H icmcmpptCwOSgwSpPY1Zfio6HvEJp7gmDwMgozMfwQuT9oxyFTxn1X3rn1IoYQF3P8gsziY5 qtTxy2RrgqQFm/hr8gM78RhP54UPltIE96VywviFzDZehMvuwzW//fxysIoK97Y/KBZZOQs+ /T+Bw80Pwk/dqQ8UmIt2ffHEgwCTbkSm711BejapWCfklxkMZDp16mkxSt2qZovboVjXnfuq wQ1QL4o4t1hviM7LyoflsCLnQFJh6RSBhBpKQinMJl/z0A6NYDkQi6vEGMDBWX/M2vk9Jvwa v0cEBfY3Z5oFgkh7BUORsu1V+Hn0fR/Lqq/Pyq+nTR26WzGDkolLsDr3IH0TiAVH5ZuPxyz6 abzjfg== Message-ID: <256013f7-292d-7014-9abb-61755f07eb25@schaufler-ca.com> Date: Mon, 8 Jul 2019 17:02:00 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: <20190707133023.GA4521@wind.enjellic.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Content-Language: en-US Sender: selinux-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: selinux@vger.kernel.org On 7/7/2019 6:30 AM, Dr. Greg wrote: > On Wed, Jul 03, 2019 at 08:32:10AM -0700, Casey Schaufler wrote: > > Good morning, I hope the weekend has been enjoyable for everyone. > >>>> On 7/2/2019 12:42 AM, Xing, Cedric wrote: >>>>> ... >>>>> Guess this discussion will never end if we don't get into >>>>> code. Guess it'd be more productive to talk over phone then come ba= ck >>>>> to this thread with a conclusion. Will that be ok with you? >>>> I don't think that a phone call is going to help. Talking code >>>> issues tends to muddle them in my brain. If you can give me a few >>>> days I will propose a rough version of how I think your code should >>>> be integrated into the LSM environment. I'm spending more time >>>> trying (unsuccessfully :( ) to discribe the issues in English than >>>> it will probably take in C. >>> While Casey is off writing his rosetta stone, >> I'd hardly call it that. More of an effort to round the corners on >> the square peg. And Cedric has some ideas on how to approach that. > Should we infer from this comment that, of the two competing > strategies, Cedric's is the favored architecture? With Cedric's latest patches I'd say there's only one strategy. There's still some refinement to do, but we're getting there. >>> let me suggest that the >>> most important thing we need to do is to take a little time, step bac= k >>> and look at the big picture with respect to what we are trying to >>> accomplish and if we are going about it in a way that makes any sense= >>> from an engineering perspective. >>> >>> This conversation shouldn't be about SGX, it should be about the best= >>> way for the kernel/LSM to discipline a Trusted Execution Environment >>> (TEE). As I have noted previously, a TEE is a 'blackbox' that, by >>> design, is intended to allow execution of code and processing of data= >>> in a manner that is resistant to manipulation or inspection by >>> untrusted userspace, the kernel and/or the hardware itself. >>> >>> Given that fact, if we are to be intellectually honest, we need to as= k >>> ourselves how effective we believe we can be in controlling any TEE >>> with kernel based mechanisms. This is particularly the case if the >>> author of any code running in the TEE has adversarial intent. >>> >>> Here is the list of controls that we believe an LSM can, effectively,= >>> implement against a TEE: >>> >>> 1.) Code provenance and origin. >>> >>> 2.) Cryptographic verification of dynamically executable content. >>> >>> 2.) The ability of a TEE to implement anonymous executable content. >>> >>> If people are in agreement with this concept, it is difficult to >>> understand why we should be implementing complex state machines and >>> the like, whether it is in the driver or the LSM. Security code has >>> to be measured with a metric of effectiveness, otherwise we are >>> engaging in security theater. >>> >>> I believe that if we were using this lens, we would already have a >>> mainline SGX driver, since we seem to have most of the needed LSM >>> infrastructure and any additional functionality would be a straight >>> forward implementation. Most importantly, the infrastructure would >>> not be SGX specific, which would seem to be a desirable political >>> concept. >> Generality introduced in the absence of multiple instances >> often results in unnecessary complexity, unused interfaces >> and feature compromise. Guessing what other TEE systems might >> do, and constraining SGX to those models (or the other way around) >> is a well established road to ruin. The LSM infrastructure is >> a fine example. For the first ten years the "general" mechanism >> had a single user. I'd say to hold off on the general until there >> is more experience with the specific. It's easier to construct >> a general mechanism around things that work than to fit things >> that need to work into some preconceived notion of generality.=20 > All well taken points from an implementation perspective, but they > elide the point I was trying to make. Which is the fact that without > any semblance of a discussion regarding the requirements needed to > implement a security architecture around the concept of a TEE, this > entire process, despite Cedric's well intentioned efforts, amounts to > pounding a square solution into the round hole of a security problem. Lead with code. I love a good requirements document, but one of the few places where I agree with the agile folks is that working code speaks loudly. > Which, as I noted in my e-mail, is tantamount to security theater. Not buying that. Not rejecting it, either. Without code to judge it's kind of hard to say. > Everyone wants to see this driver upstream. If we would have had a > reasoned discussion regarding what it means to implement proper > controls around a TEE, when we started to bring these issues forward > last November, we could have possibly been on the road to having a > driver with reasoned security controls and one that actually delivers > the security guarantees the hardware was designed to deliver. > > Best wishes for a productive week to everyone. > > Dr. Greg > > As always, > Dr. G.W. Wettstein, Ph.D. Enjellic Systems Development, LLC. > 4206 N. 19th Ave. Specializing in information infra-structure= > Fargo, ND 58102 development. > PH: 701-281-1686 EMAIL: greg@enjellic.com > -----------------------------------------------------------------------= ------- > "Any intelligent fool can make things bigger and more complex... It > takes a touch of genius - and a lot of courage to move in the opposite= > direction." > -- Albert Einstein