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_INVALID,DKIM_SIGNED, 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 21527CA9EC4 for ; Tue, 29 Oct 2019 09:33:06 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D9DD021479 for ; Tue, 29 Oct 2019 09:33:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="b76gBopG" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D9DD021479 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 76C1B6B0005; Tue, 29 Oct 2019 05:33:05 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 71C946B0006; Tue, 29 Oct 2019 05:33:05 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 633366B0007; Tue, 29 Oct 2019 05:33:05 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0209.hostedemail.com [216.40.44.209]) by kanga.kvack.org (Postfix) with ESMTP id 3D91A6B0005 for ; Tue, 29 Oct 2019 05:33:05 -0400 (EDT) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with SMTP id DAE792485 for ; Tue, 29 Oct 2019 09:33:04 +0000 (UTC) X-FDA: 76096308288.20.mind08_5510ba789a531 X-HE-Tag: mind08_5510ba789a531 X-Filterd-Recvd-Size: 3446 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf37.hostedemail.com (Postfix) with ESMTP for ; Tue, 29 Oct 2019 09:33:04 +0000 (UTC) Received: from rapoport-lnx (190.228.71.37.rev.sfr.net [37.71.228.190]) (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 B280420659; Tue, 29 Oct 2019 09:32:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1572341583; bh=ESgihE2mJ4D11bv8ffgzhtfjRAPEzR6CfHa6NOhpS28=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=b76gBopGQtasuYSgygtwkzaQ/4y91+5mDJkP7lN2pFY2n6fz9mc9YFalNKWYcRl2C WFKNMuLjHFlOk1UesDi1bFfh6LiIOp+zEI/cwbSJOHuCVbiEaKTjUfTLO2jMo+HXwn 0gx/OPrRM6GrjhsxjLqLrlCKVB4dW71GENjTlkYs= Date: Tue, 29 Oct 2019 10:32:55 +0100 From: Mike Rapoport To: Andy Lutomirski Cc: linux-kernel@vger.kernel.org, Alexey Dobriyan , Andrew Morton , Andy Lutomirski , Arnd Bergmann , Borislav Petkov , Dave Hansen , James Bottomley , Peter Zijlstra , Steven Rostedt , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , linux-api@vger.kernel.org, linux-mm@kvack.org, x86@kernel.org, Mike Rapoport Subject: Re: [PATCH RFC] mm: add MAP_EXCLUSIVE to create exclusive user mappings Message-ID: <20191029093254.GE18773@rapoport-lnx> References: <1572171452-7958-1-git-send-email-rppt@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) Content-Transfer-Encoding: quoted-printable 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 Mon, Oct 28, 2019 at 02:44:23PM -0600, Andy Lutomirski wrote: >=20 > > On Oct 27, 2019, at 4:17 AM, Mike Rapoport wrote: > >=20 > > =EF=BB=BFFrom: Mike Rapoport > >=20 > > Hi, > >=20 > > The patch below aims to allow applications to create mappins that hav= e > > pages visible only to the owning process. Such mappings could be used= to > > store secrets so that these secrets are not visible neither to other > > processes nor to the kernel. > >=20 > > I've only tested the basic functionality, the changes should be verif= ied > > against THP/migration/compaction. Yet, I'd appreciate early feedback. >=20 > I=E2=80=99ve contemplated the concept a fair amount, and I think you sh= ould > consider a change to the API. In particular, rather than having it be a > MAP_ flag, make it a chardev. You can, at least at first, allow only > MAP_SHARED, and admins can decide who gets to use it. It might also pl= ay > better with the VM overall, and you won=E2=80=99t need a VM_ flag for i= t =E2=80=94 you > can just wire up .fault to do the right thing. I think mmap()/mprotect()/madvise() are the natural APIs for such interface. Switching to a chardev doesn't solve the major problem of dire= ct map fragmentation and defeats the ability to use exclusive memory mapping= s with the existing allocators, while mprotect() and madvise() do not. --=20 Sincerely yours, Mike.