Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp3972168ybg; Mon, 28 Oct 2019 23:42:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqx2iSR44BvltJK+/Su+uoWquQpDate20UGt1zoh8vJOb7GK5dAj3bhasPgqL+TU9dMmfaNx X-Received: by 2002:a17:907:2139:: with SMTP id qo25mr1625734ejb.207.1572331366361; Mon, 28 Oct 2019 23:42:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572331366; cv=none; d=google.com; s=arc-20160816; b=CGMTBXKdSmUI90sJA0LsQ9RNMfT23iZIvAbjmGCxOCeBdtjbrb6NJvdPXVzyo0c3nh ijjjtuJYnCy4Bb23swJV0NJFU2Yd0LTpJ1E9qINsZFTHFuR4XseLNjFHIcD5PwJ8Lpt/ oPck8d4XO42IVxdCmF3KLGpWwoMxHLP9K2Jw8X3iklnR+jgKQrFtv2SJRrWq3i20Q+Jj /tSUTiS9px53pxkLtP4HaLzykr/Wu2A6FI/fdjlK4qA2mYMeU+Y7Uio1moPowCIB+/Qx AJmpmy/cY2mXz85D4BJ3OekJBHy+1on1hom1JcjheoJtUBE3QrIEtdMvCwOUVC04p0A5 EJ0A== 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-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=1Oii312J4rwKfjBtVwSgoriFHTTc3+9xh/Qx156700k=; b=tHZ23FCjzfYRTVig4NOjxuKCSfYLBZfXRJraR2+je/c356chp8rCOjzirayJ0sAoZK B9vrg31c1dRWu2x+2/u4lYCLMJmqbZV6N2ZbCW4HBLeAP55ZVT18OQsvNIi+Cyp2oavi V0FfRHq/pcR+oHuCACrgwkckT/d74IGWDYyyu1MFVM2JTGa4Zqz4gSC8dMQ0bCGaqw6e b8ZYLtrfxgnWU5kYV5evwneGu/xC4vA9UpoDHtg9dy8njPAKyTIg/2cVA9kIDdazpA1m 0IT0LrlP5gEPUYA08Sj1vpID8nWk0n2OO/uWyT8ZfzQvxBQ4nzplKzOd90BrsXHYKiRB GJVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b="XDc/2ESg"; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id cw1si7529494ejb.117.2019.10.28.23.42.23; Mon, 28 Oct 2019 23:42:46 -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=fail header.i=@infradead.org header.s=bombadil.20170209 header.b="XDc/2ESg"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391112AbfJ1SIL (ORCPT + 99 others); Mon, 28 Oct 2019 14:08:11 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:34260 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730690AbfJ1SIL (ORCPT ); Mon, 28 Oct 2019 14:08:11 -0400 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) 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 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?