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.0 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,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 37319CA9EC0 for ; Mon, 28 Oct 2019 18:08:35 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id F2B8B20862 for ; Mon, 28 Oct 2019 18:08:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="XDc/2ESg" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F2B8B20862 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 8E7E06B0003; Mon, 28 Oct 2019 14:08:34 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8979B6B0006; Mon, 28 Oct 2019 14:08:34 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7AE316B0007; Mon, 28 Oct 2019 14:08:34 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0183.hostedemail.com [216.40.44.183]) by kanga.kvack.org (Postfix) with ESMTP id 598566B0003 for ; Mon, 28 Oct 2019 14:08:34 -0400 (EDT) Received: from smtpin18.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with SMTP id E3C798141 for ; Mon, 28 Oct 2019 18:08:33 +0000 (UTC) X-FDA: 76093978506.18.tub20_fc735c54fe45 X-HE-Tag: tub20_fc735c54fe45 X-Filterd-Recvd-Size: 3969 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf05.hostedemail.com (Postfix) with ESMTP for ; Mon, 28 Oct 2019 18:08:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=1Oii312J4rwKfjBtVwSgoriFHTTc3+9xh/Qx156700k=; b=XDc/2ESgjMpplBzpDrC0S7Jp1 0qNTtrxHoUFs0nJAAGBFV1U+sTNzXyMzk6FwQ8U2kqQqeTWcSpvbLIOfEcBFQzyb/2npOWiU9bu+S AZMyc3mzxjvJgKgUJx4zYZ+eHkI4/IvYoaQViQvUvwQlLhkC1PMP1DksUfid674VuAMnACmwOipl9 yByP1E3zbfKdH0E28vR3tA+5ICf8HAyoNxytN+AXycznam8Q0eMFdSxXCaPiKY82hNcz3UX6wooQP +Po1osJUqQ2E70MIa+ZVW3lYr/T/5vCvrqgDKkaSIINdKVbMlHcbonidtye3Ziud1pRsml4yT34QS ph8bCJQ8Q==; Received: from willy by bombadil.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1iP9R2-0003fP-VK; Mon, 28 Oct 2019 18:08:08 +0000 Date: Mon, 28 Oct 2019 11:08:08 -0700 From: Matthew Wilcox To: Dave Hansen Cc: Mike Rapoport , 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: <20191028180808.GA17669@bombadil.infradead.org> References: <1572171452-7958-1-git-send-email-rppt@kernel.org> <1572171452-7958-2-git-send-email-rppt@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.1 (2019-06-15) 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 10:12:44AM -0700, Dave Hansen wrote: > Some other random thoughts: > > * The page flag is probably not a good idea. It would be probably > better to set _PAGE_SPECIAL on the PTE and force get_user_pages() > into the slow path. > * This really stops being "normal" memory. You can't do futexes on it, > cant splice it. Probably need a more fleshed-out list of > incompatible features. > * As Kirill noted, each 4k page ends up with a potential 1GB "blast > radius" of demoted pages in the direct map. Not cool. This is > probably a non-starter as it stands. > * The global TLB flushes are going to eat you alive. They probably > border on a DoS on larger systems. > * Do we really want this user interface to dictate the kernel > implementation? In other words, do we really want MAP_EXCLUSIVE, > or do we want MAP_SECRET? One tells the kernel what do *do*, the > other tells the kernel what the memory *IS*. > * There's a lot of other stuff going on in this area: XPFO, SEV, MKTME, > Persistent Memory, where the kernel direct map is a liability in some > way. We probably need some kind of overall, architected solution > rather than five or ten things all poking at the direct map. Another random set of thoughts: - Should devices be permitted to DMA to/from MAP_SECRET pages? - How about GUP? Can I ptrace my way into another process's secret pages? - What if I splice() the page into a pipe?