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=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,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 53804C4708E for ; Sat, 29 May 2021 01:04:20 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C75D061284 for ; Sat, 29 May 2021 01:04:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C75D061284 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 41EB76B0036; Fri, 28 May 2021 21:04:19 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3CF336B006E; Fri, 28 May 2021 21:04:19 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2234D6B0070; Fri, 28 May 2021 21:04:19 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0090.hostedemail.com [216.40.44.90]) by kanga.kvack.org (Postfix) with ESMTP id E3D8A6B0036 for ; Fri, 28 May 2021 21:04:18 -0400 (EDT) Received: from smtpin38.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 6B850C5B3 for ; Sat, 29 May 2021 01:04:18 +0000 (UTC) X-FDA: 78192472596.38.827B38A Received: from mail-lj1-f179.google.com (mail-lj1-f179.google.com [209.85.208.179]) by imf20.hostedemail.com (Postfix) with ESMTP id 0F8562DD for ; Sat, 29 May 2021 01:04:05 +0000 (UTC) Received: by mail-lj1-f179.google.com with SMTP id a4so664783ljq.9 for ; Fri, 28 May 2021 18:04:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=7TLJbSas3WgGftLzXCIE9XnAPM6dN/gE8iir4vdPP+w=; b=cT4KvaZvwGtBiIbawe3+jc+1fkoXYslUfHrH0H1cWQVUQtZ8xjL4of9SedIBqdqfgE v5DjrX/q6IKN6mpuDaSMMJX0vLxRm068wOWlW92ubPAZ+GCoYUGjQnWb+haOFa5jGnsR +pBMWH3gJ6rquFqZoRFYr0mL6CA+Nn24/gQzM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=7TLJbSas3WgGftLzXCIE9XnAPM6dN/gE8iir4vdPP+w=; b=IE+TCKTytE/hYltBFtcSUbZyO0B1qpMiYsMfX/+A6x6/T3va7AYYxvhgHs0/ILe60q glcrSLFPhjuzl1q6mIwqowMQ6hHS0or0qs/PWHHrP78zpCWKTBnTngYSPQAUF7Vf4Bao ieZT9+5BWaKK40EKYmJH37MBdzoEHotb+C+8sl8AMLgLEF/5EFdtO7mElPMNNog8lRoR kUY4izBwkTNyB06xqd4xkA5GDPhkHI1SNO4t5I6PpiEqW2KyCohglNVWpiw773UtukY4 QZTChgxjBp9BBoOr1wX0mb0CNbLf1zXTdYqwf0kTC1sQhbZR5lIzG5cu50vBAR8EYlKy wKXQ== X-Gm-Message-State: AOAM532wRHiYDOAvQ97Tv5EGDHFSjS8ErOfdw0J8zbpNBExF4fSe1TXB tMZiszzGhOF41B/TFNqtr1OrzEI02WXhJEAC X-Google-Smtp-Source: ABdhPJwIdBV7/Yi0HXwxUxb/bLvCMc4zsenjTagjUFSWTwTmHhfVlnoewFNVUnE19eTOlcKBnblTWg== X-Received: by 2002:a2e:8506:: with SMTP id j6mr8714490lji.178.1622250255933; Fri, 28 May 2021 18:04:15 -0700 (PDT) Received: from mail-lf1-f52.google.com (mail-lf1-f52.google.com. [209.85.167.52]) by smtp.gmail.com with ESMTPSA id s17sm157475lfp.184.2021.05.28.18.04.14 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 28 May 2021 18:04:15 -0700 (PDT) Received: by mail-lf1-f52.google.com with SMTP id e17so7875871lfb.2 for ; Fri, 28 May 2021 18:04:14 -0700 (PDT) X-Received: by 2002:a05:6512:1095:: with SMTP id j21mr7376406lfg.40.1622250254392; Fri, 28 May 2021 18:04:14 -0700 (PDT) MIME-Version: 1.0 References: <20210429154807.hptls4vnmq2svuea@box> <20210429183836.GF8339@xz-x1> <7718ec5b-0a9e-ffa6-16f2-bc0b6afbd9ab@gmail.com> In-Reply-To: <7718ec5b-0a9e-ffa6-16f2-bc0b6afbd9ab@gmail.com> From: Linus Torvalds Date: Fri, 28 May 2021 15:03:58 -1000 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: Sealed memfd & no-fault mmap To: "Lin, Ming" , Hugh Dickins Cc: Simon Ser , Peter Xu , "Kirill A. Shutemov" , Matthew Wilcox , Dan Williams , "Kirill A. Shutemov" , Will Deacon , Linux Kernel Mailing List , David Herrmann , "linux-mm@kvack.org" , Greg Kroah-Hartman , "tytso@mit.edu" Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 0F8562DD Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=google header.b=cT4KvaZv; dmarc=none; spf=pass (imf20.hostedemail.com: domain of torvalds@linuxfoundation.org designates 209.85.208.179 as permitted sender) smtp.mailfrom=torvalds@linuxfoundation.org X-Rspamd-Server: rspam03 X-Stat-Signature: m31r17axqpp1kjthztjayf5zyrd73bmx X-HE-Tag: 1622250245-720529 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 Fri, May 28, 2021 at 7:07 AM Lin, Ming wrote: > > Does something like following draft patch on the right track? No, I don't think this can work: > + _dst_pte = pte_mkspecial(pfn_pte(my_zero_pfn(dst_addr), > + vma->vm_page_prot)); You can't just blindly insert the zero pfn - for a shared write mapping, that would actually allow writes to the zeropage. That would be horrible. So it would have to do all the same things that it does for a page that is inside the inode size. I do also dislike how it's a per-inode flag - so it would affect other mappings of the same shared memory segment too. But considering that the page would have to be part of the page cache for that shmem inode, that may be inevitable. But it sure does smell a bit. Oh, and if we make this kind of magic shmem extension, Hugh Dickins should be part of the conversation too. Hugh, you probably saw the original on linux-mm, but I'm adding you explicitly to the participants here. .. and if you didn't see the background, here it is https://lore.kernel.org/linux-mm/vs1Us2sm4qmfvLOqNat0-r16GyfmWzqUzQ4KHbXJwEcjhzeoQ4sBTxx7QXDG9B6zk5AeT7FsNb3CSr94LaKy6Novh1fbbw8D_BBxYsbPLms=@emersion.fr/ for your edification.. Linus