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=-1.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 2A729C35254 for ; Sat, 8 Feb 2020 17:41:30 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C3E2421775 for ; Sat, 8 Feb 2020 17:41:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="1WsJ7Y9D" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C3E2421775 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 3638B6B0005; Sat, 8 Feb 2020 12:41:29 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 2C56E6B0006; Sat, 8 Feb 2020 12:41:29 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1666C6B0007; Sat, 8 Feb 2020 12:41:29 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0082.hostedemail.com [216.40.44.82]) by kanga.kvack.org (Postfix) with ESMTP id ED63E6B0005 for ; Sat, 8 Feb 2020 12:41:28 -0500 (EST) Received: from smtpin12.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id A51A7181AC9CC for ; Sat, 8 Feb 2020 17:41:28 +0000 (UTC) X-FDA: 76467676656.12.robin51_6429f653c5d43 X-HE-Tag: robin51_6429f653c5d43 X-Filterd-Recvd-Size: 3938 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf01.hostedemail.com (Postfix) with ESMTP for ; Sat, 8 Feb 2020 17:41:28 +0000 (UTC) Received: from hump (unknown [185.189.199.88]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id ABF6921741; Sat, 8 Feb 2020 17:40:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581183687; bh=M5iGyv9f4kxeousKItvHS+SWTdXy1QHRukV9utRFi0I=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=1WsJ7Y9DO7oleGTs2z3bbQ6ik8fmcjNcOtCstN9UfZluoPeE40jiSTGKrjieyy+KV yxp7IlExIl3Lqyi2TpfXtmmHMwPYhOD7Jid6tI5lAdjlhjaHDrZl3fXxWSOiTRv8PV XbTKA7gKNny+Ei/c18DC3J4eljlDYsLLnS28ibDg= Date: Sat, 8 Feb 2020 19:39:22 +0200 From: Mike Rapoport To: Dave Hansen Cc: linux-kernel@vger.kernel.org, Alan Cox , Andrew Morton , Andy Lutomirski , Christopher Lameter , Dave Hansen , James Bottomley , "Kirill A. Shutemov" , Matthew Wilcox , Peter Zijlstra , "Reshetova, Elena" , Thomas Gleixner , Tycho Andersen , linux-api@vger.kernel.org, linux-mm@kvack.org Subject: Re: [RFC PATCH] mm: extend memfd with ability to create "secret" memory areas Message-ID: <20200208173922.GA15879@hump> References: <20200130162340.GA14232@rapoport-lnx> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Thu, Feb 06, 2020 at 10:51:13AM -0800, Dave Hansen wrote: > On 1/30/20 8:23 AM, Mike Rapoport wrote: > > include/linux/memfd.h | 9 ++ > > include/uapi/linux/magic.h | 1 + > > include/uapi/linux/memfd.h | 6 + > > mm/Kconfig | 4 + > > mm/Makefile | 1 + > > mm/memfd.c | 10 +- > > mm/secretmem.c | 244 +++++++++++++++++++++++++++++++++++++ > > 7 files changed, 273 insertions(+), 2 deletions(-) > > It seems pretty self-contained and relatively harmless. > > But, how much work is it going to be to tell the rest of the kernel that > page_to_virt() doesn't work any more? Why page_to_virt() won't work anymore? Or you refer to that the kernel code won't be able to access the page contents? > Do we need to make kmap() work on these? I don't think we need to make kmap() work on these. The idea is to prevent kernel from accessing such memory areas. > I guess fixing vm_normal_page() would fix a lot of that. > > In general, my concern about creating little self-contained memory types > is that they will get popular and folks will start wanting more features > from them. For instance, what if I want NUMA affinity, migration, or > large page mappings that are secret? Sure, why not :) Well, this is true for any feature: it may become popular, people will start using it and it will add more complexity. My goal is to design this thing keeping in mind that all the above (and probably more) will be requested sooner or later. > Can these pages work as guest memory? Actually, this is one of the driving usecases. I believe that people that use mem=X to limit kernel control of the memory and the manage the remaining memory for the guests can switch to fd-based approach. > Who would the first users of this thing be? We were thinking about using such areas to store small secrets, e.g. with openssl_malloc(). Another usecase is the VM memory. -- Sincerely yours, Mike.