Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp4680667ybg; Tue, 29 Oct 2019 10:46:40 -0700 (PDT) X-Google-Smtp-Source: APXvYqxIp3D52N5cIuBwnxBxUaR1kH6epGgWEUNrVrUC3ujAzlGEH3un/vaiR2ooyhggP+EVelLH X-Received: by 2002:aa7:c358:: with SMTP id j24mr27765359edr.147.1572371200871; Tue, 29 Oct 2019 10:46:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572371200; cv=none; d=google.com; s=arc-20160816; b=PAsDMFQHFqJVR7BMcw/S69X0rHmUmBAhoNRFmBk1sCs8yF0mgBgqqXPyuimbU1pewV oiQgTV+5xwivyyVxNc/V2hyXpypsMtXicZYBDCFBJjdbIkubk4ADasmjTGr1PWHbOePk I3JKOJD2UBvxE58qefyw3yn2tfds6aqjGq+xhsWwqk1SGZnvlfo8JNWk6JQ7CSf8YvUf Eb6+R33jUeeu1WaQYk28beAPPWi6I7ZguXuhQI5/VHqU5f7stEp4Xw7ytqliQ4m2zUUV gQXbTleMCR3YNVZkj3m7LytTYXSy1rDzGZz/CF1YcKQ4AEUtvotgGE42JCrsoVpIeKlm R2gA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=8Lc7RK1RRaZFgqY5uzVOL/PnzLxdUh9YKE3XGldKNvc=; b=WtRLWmD9Y/LhsXJMY4B+YQJ05/sJSGae8V/zj9cxGc2NVeoiw0TCizD2TKqZKRVAPp Md/6tod5x0N7GuPq3RGmy9c89zaADowi949meZ22ApcK99BPJiC0mu+v6+J5IfM+Dj0K RSYbwvOnqE3wRszsktZ9R89ey2GTcbvDPEnX8D23l35a8e52kn6F0wAMlQJEH397rgFa L8VjpMojyDFyEhPa2B8fNNl9Zme/2WkQ7E3HsCSY7OxPaeLDXreuvPoH2wsj8mBowrCa uwg/YEQsRHlkyUsNeoFlA+IXT7w7EAICtB0hnlNqQ3Fi6RxeyyShF9tOdO32rJLe4MYv n0AQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=b76gBopG; 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 i5si10174622edj.107.2019.10.29.10.46.17; Tue, 29 Oct 2019 10:46:40 -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=b76gBopG; 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 S1732351AbfJ2JdE (ORCPT + 99 others); Tue, 29 Oct 2019 05:33:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:38974 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729916AbfJ2JdE (ORCPT ); Tue, 29 Oct 2019 05:33:04 -0400 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 Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Oct 28, 2019 at 02:44:23PM -0600, Andy Lutomirski wrote: > > > On Oct 27, 2019, at 4:17 AM, Mike Rapoport wrote: > > > > From: Mike Rapoport > > > > Hi, > > > > The patch below aims to allow applications to create mappins that have > > 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. > > > > I've only tested the basic functionality, the changes should be verified > > against THP/migration/compaction. Yet, I'd appreciate early feedback. > > I’ve contemplated the concept a fair amount, and I think you should > 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 play > better with the VM overall, and you won’t need a VM_ flag for it — 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 direct map fragmentation and defeats the ability to use exclusive memory mappings with the existing allocators, while mprotect() and madvise() do not. -- Sincerely yours, Mike.