Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp1333398pxp; Thu, 10 Mar 2022 03:32:22 -0800 (PST) X-Google-Smtp-Source: ABdhPJxeQLc3xPuNvGCxfrphECX3wBLbvmW0VLxfz1soJojVMmddvrYGX7+AqMjIEjIQm94m5Qrc X-Received: by 2002:a17:906:7954:b0:6da:9ee0:2e54 with SMTP id l20-20020a170906795400b006da9ee02e54mr3950665ejo.630.1646911942058; Thu, 10 Mar 2022 03:32:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646911942; cv=none; d=google.com; s=arc-20160816; b=1Ax9P/mxwKXE5rJic5YMpU0BUizJSGrJtHd67Rr7b7CD0aFijqfWs7qf0NJk83MbCu 24Q0URfKvXxS+LsbxO7MTJfKuynmat7UIFt7p9PVTzLMIyj2lrbHpHTkU05e0p7uJqNv pDwlIB8OJ+w1mGMsrXoP0Uy9ymuMNPuSuau/cs8cxBWGtw1s4RLwE/VhoOQKCFLdCLge +vB4Vk3MFAXMi7qRDuk20zsVK8NeukH9VfPapAsSHjSvNvpF9t9EKt1F+Slmcc/ErV+Z yCV7sUgft6JURPA/lUmnyt09ptqiFLpy7QhZ93FlI1zPi0lzGmXVr6XIYkIQ90knjyQY FfQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=XuUh7vtyo2T9b+W0ephEXwPufAxfZCnlFSufSsM0rHQ=; b=zdXxRi2L3LXTcY0J/97/7yiYpY6H0S760X5EpEx8TiAaW/LkPex0JR+DvXAYXuI/J9 zu9PMhqok4WJswrNL/O9ah6p1S7M7MBBbTCuoepw4lQ67H5A1XshXq/oTmjii/kMs6cY ITMqaoNcse3SflkuOJ0Yf9F+nSLRU0Ifs28poQKqatwJw0O6HP2tDxZ705IgZ/w2ImT2 8fjPf/koaV+nQxtub41Mn2psk7PMvOzmCSvUXiKytTMS+uqPfhGeEJcoL1Xr3PlSW0HT N7xarDkxnDc7oMEjf8DTu8W1VV8HMtpeuwdeTLmc+25boVcMD5UghCIJqi+X4kaUstbX x/qQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=EW98nCiC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l12-20020a170906794c00b006db0682c8besi3178472ejo.832.2022.03.10.03.31.57; Thu, 10 Mar 2022 03:32:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=EW98nCiC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S239689AbiCJGBl (ORCPT + 99 others); Thu, 10 Mar 2022 01:01:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51622 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232317AbiCJGBi (ORCPT ); Thu, 10 Mar 2022 01:01:38 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4CBCD8F637; Wed, 9 Mar 2022 22:00:37 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 8780EB8251C; Thu, 10 Mar 2022 06:00:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E84C8C340E8; Thu, 10 Mar 2022 06:00:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1646892035; bh=r5cCxBx7p3YWGZryxH9n4PbKUVpUHmAMBZJNVrUytl0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=EW98nCiCh80jg8eCpPwOchY6rKiHkkT8EMEGyQkqhOwAT1+Q/CbpAjwr9OKyLEhun zHQw/Eqopv2RERq2CYPlEdDion4o6WaRzd9JbM3oH59QsJRDJT4yAkirttiyRNg9XF 39U+V03uCCv18VZ0FwGnspIVaL5zJ/QHzOWf0t2uM4vNCQVe6TZNRNttSpSocj8Z5s lUzdgFr0e+ZEQ1/mFvLUna73833TNcQVquJFRNWGFjqVH8JN37h30oDlDkg6GDo3pV afkUj3bJMJz0nmn7g7/ELusgjEALP3lQqf0rnfyp4maALraBbrIeaSOyH8FCJx59ZY J0v3L7fymZB7A== Date: Thu, 10 Mar 2022 07:59:50 +0200 From: Jarkko Sakkinen To: Dave Hansen Cc: Reinette Chatre , Haitao Huang , "Dhanraj, Vijay" , "dave.hansen@linux.intel.com" , "tglx@linutronix.de" , "bp@alien8.de" , "Lutomirski, Andy" , "mingo@redhat.com" , "linux-sgx@vger.kernel.org" , "x86@kernel.org" , "Christopherson,, Sean" , "Huang, Kai" , "Zhang, Cathy" , "Xing, Cedric" , "Huang, Haitao" , "Shanahan, Mark" , "hpa@zytor.com" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH V2 16/32] x86/sgx: Support restricting of enclave page permissions Message-ID: References: <2d2d3471-78ce-9faa-daf6-138078f5ffaa@intel.com> <6f65287a-f69c-971e-be2c-929e327e7ff9@intel.com> <19155cab-ecff-a8a6-f724-98c4535642ef@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Mar 10, 2022 at 07:43:42AM +0200, Jarkko Sakkinen wrote: > On Thu, Mar 03, 2022 at 01:44:14PM -0800, Dave Hansen wrote: > > On 3/3/22 13:23, Reinette Chatre wrote: > > > Unfortunately MAP_POPULATE is not supported by SGX VMAs because of their > > > VM_IO and VM_PFNMAP flags. When VMAs with such flags obtain this capability > > > then I believe that SGX would benefit. > > > > Some Intel folks asked for this quite a while ago. I think it's > > entirely doable: add a new vm_ops->populate() function that will allow > > ignoring VM_IO|VM_PFNMAP if present. > > > > Or, if nobody wants to waste all of the vm_ops space, just add an > > arch_vma_populate() or something which can call over into SGX. > > > > I'll happily review the patches if anyone can put such a beast together. > > Everyone would be better off, if EAUG's were done unconditionally for > mmap() after initialization. Nice property is that this needs no core mm > changes. > > The resource saving argument is at least a bit weak because you might use > EMODPR for the address range anyway. So you end up doing things just > slower. And to have good confidentiality, you actually probably want to > clear also dynamically added pages with EACCEPTCOPY (and zero page) when > you take them into use. > > I find it also a bit worrying that enclave has direct access to allocate > kernel resources and trigger ring-0 opcode. I don't like that part at > all. syscall/ioctl sets the correct barrier, as the host side should be > and is the resource manager, not the enclave. Actually, this should be ABI compatible too. I'd expect all kselftests continue work as they are. BR, Jarkko