Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp1310429ybi; Thu, 30 May 2019 15:23:47 -0700 (PDT) X-Google-Smtp-Source: APXvYqx9g6Pb3VjU1E6YXF/QDQiblRvu5HyWRdmT/b5nw12OSaHJGhFINcLIuaSrBoUh+AxstjKU X-Received: by 2002:a17:90a:af8b:: with SMTP id w11mr5527746pjq.135.1559255027705; Thu, 30 May 2019 15:23:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559255027; cv=none; d=google.com; s=arc-20160816; b=Aoig3jlV0xVOo0pBsrlvdQEUXvYixpPH9FY6aNXBoPB8yuT4hHYA3GmtQ4aiDbJpJf U3gHgk8tmdCT+Ee3fA8djXY6CGQIP6aUqgym1ZGUOXeRaoqbNeAdWLN7cPC4O69T91SA CLrBINWpqV/MT31z4dgS3pEuihRVlFOPmBCnK0EnVVyzmzD10D1Nem+F+qqoKQMPNuTi MsG47BAOXyvkcW+7oMebIntIUdnghMP4GeIA/0zkZp78Oezp7uIOc3Nkh7/Dc08CQdMO l6nVmGYVDMfddoz+2ZPhkxsRUrJ6n0ONDgh6uZGT7x0vaXyoWjZzlhoc5cXHRNkqFuCI izww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=/AAZg2hNZGKeokb2MNGVflDeyheAoJTdT+WoP06lQwQ=; b=w7ouLUnAjSLWPx2y7+NKckNrppka0rkE6rfTmU0r5yzsJSjptSal14faV8s43s3Vbl /VE4rpSg8/364HnGzsnjVEjkXD23PGGU24wVHpl40LSrKpaPL/somy5p26mVgiixMEwq nsvNE5rzmkhP4fujtahMgRT+/9tKr3iBhykajqVUNrvbWV3CquZjTeu+jPV6Sj+Ow2Yi sYNDrtStVNfmqPvSKPyxFUYOEcGNAUoiGZzPEQf4jLrKiy4UpDFXaGm8t3BrctvTVYF0 p3JYAiXrUtBYGN8B5Qh82C2sh0PedduIL5jpaImcD6k4R2Q3lDF3dgVuBk16I0H+NXpx oGyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="sO+/27uE"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d192si3911302pgc.480.2019.05.30.15.23.31; Thu, 30 May 2019 15:23:47 -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; dkim=pass header.i=@kernel.org header.s=default header.b="sO+/27uE"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726666AbfE3WW0 (ORCPT + 99 others); Thu, 30 May 2019 18:22:26 -0400 Received: from mail.kernel.org ([198.145.29.99]:33622 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726355AbfE3WWX (ORCPT ); Thu, 30 May 2019 18:22:23 -0400 Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4AC82261D7 for ; Thu, 30 May 2019 21:23:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1559251401; bh=oq8IWdqTe7Bw3zkTzFHzZXXeKKTFiHHCQoJ8FlQJtDA=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=sO+/27uEIYIVD27JT/3qbo5sArzvjKlEGCApT/NRFm8PZUybMSDNtYcCNE9AKE3dg R0SKX00e65Gnt+OTdg4kxYHTKeMgLxiF3jt4Es+nxN12WHDXEclud4mVoQ4pXA0M9l uKy0uqC+kwlmx87W2DHQSPEVOwGRRcRCibMJy/WU= Received: by mail-wm1-f44.google.com with SMTP id t5so4642260wmh.3 for ; Thu, 30 May 2019 14:23:21 -0700 (PDT) X-Gm-Message-State: APjAAAUMKyBWXvDlF4zxewLvcjpSwhq3nd12vyt2Z1FtUqXcIr0OagJQ /E62t394f7VLBJKVP9ge322qNfwnGgKfA4exg5a/5g== X-Received: by 2002:a05:600c:489:: with SMTP id d9mr3262525wme.173.1559251399871; Thu, 30 May 2019 14:23:19 -0700 (PDT) MIME-Version: 1.0 References: <960B34DE67B9E140824F1DCDEC400C0F654E9824@ORSMSX116.amr.corp.intel.com> <20190528202407.GB13158@linux.intel.com> <285f279f-b500-27f0-ab42-fb1dbcc5ab18@tycho.nsa.gov> <960B34DE67B9E140824F1DCDEC400C0F654EB487@ORSMSX116.amr.corp.intel.com> <678a37af-797d-7bd5-a406-32548a270e3d@tycho.nsa.gov> <20190530180110.GB23930@linux.intel.com> <20190530211645.GB27551@linux.intel.com> In-Reply-To: <20190530211645.GB27551@linux.intel.com> From: Andy Lutomirski Date: Thu, 30 May 2019 14:23:07 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: SGX vs LSM (Re: [PATCH v20 00/28] Intel SGX1 support) To: Sean Christopherson Cc: Andy Lutomirski , Stephen Smalley , "Xing, Cedric" , William Roberts , Jarkko Sakkinen , James Morris , "Serge E. Hallyn" , LSM List , Paul Moore , Eric Paris , "selinux@vger.kernel.org" , Jethro Beekman , "Hansen, Dave" , Thomas Gleixner , "Dr. Greg" , Linus Torvalds , LKML , X86 ML , "linux-sgx@vger.kernel.org" , Andrew Morton , "nhorman@redhat.com" , "npmccallum@redhat.com" , "Ayoun, Serge" , "Katz-zamir, Shay" , "Huang, Haitao" , Andy Shevchenko , "Svahn, Kai" , Borislav Petkov , Josh Triplett , "Huang, Kai" , David Rientjes Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 30, 2019 at 2:16 PM Sean Christopherson wrote: > > On Thu, May 30, 2019 at 12:20:45PM -0700, Andy Lutomirski wrote: > > On Thu, May 30, 2019 at 11:01 AM Sean Christopherson > > wrote: > > > > > > On Thu, May 30, 2019 at 09:14:10AM -0700, Andy Lutomirski wrote: > > > > Enclave file -- that is, the file backing the vma from which the data is loaded. > > > > > > It wasn't explicitly called out in Andy's proposal(s), but the idea is > > > that the SGX driver would effectively inherit permissions from the source > > > VMA (EADD needs a source for the initial value of the encave page). > > > > I actually meant for it to *not* work like this. I don't want the > > source VMA to have to be VM_EXEC. I think the LSM should just check > > permissions on ->vm_file. > > But if ->vm_file is NULL, i.e. the enclave is not backed by a file, > then PROCESS__EXECMEM is required (or more likely, ENCLAVE__EXECMEM). > If ->vm_file is NULL, then I think some privilege is needed. I suppose the policy could have a new lesser permission EXECUNTRUSTED which is like EXECMOD but you can't modify it. I'm not convinced this is particular important.