Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp846140pxj; Fri, 28 May 2021 18:05:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz2c8dtvTYf2ikCAhok1S0GpnvlMN25fna72A580uhkmArC47tFIBvmOSBt75LEpG7D27z3 X-Received: by 2002:a05:6602:14cd:: with SMTP id b13mr9271079iow.163.1622250308432; Fri, 28 May 2021 18:05:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622250308; cv=none; d=google.com; s=arc-20160816; b=pWNztDOj/xilLP9kuj9bOC40P9aujo0ntyKxrTNscmtKJ+GjCy61hPydiGCczYS9FN oyvDCuwml6vZqwRnKHABZlLBn5LXlKom4k+STzmjyHEUcgtY6136S39HTInt4TleiOvz RB9FpuLdy6j3ikeoFK0pS+Pk23pQINN7vBYByKHFiEDBmhH1B/qlUsxw/YZCX4ubbIPc PzHOvXyb8CS30VtfDuKZI5SWopQUK7tPGhXn1d/UKoV66yZXb4dgmMtyydQQOnJN5UuB 23cEE9xfMT2LvdhK0e98VK2H1Srz+Y9eDuDzMd92jJ1OdyVSXBigwI/lfps/HOxKQkHu 4mlA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=7TLJbSas3WgGftLzXCIE9XnAPM6dN/gE8iir4vdPP+w=; b=St2dibAvwFsEupOWNUFVTBNYkCzbl+ZgISDc2pFPxlAWycPlSW42a8Ac7oIPu/tz+7 vAn1Jxw2W4/2xIfoascffOGn13OJmWzViTNkaqBlo4rl6OQ98/ofoK/BO2TduXiKsAj3 knSBO04PXYhXAqYTfWL756S0eG7kPmLcmtL0A3U3C81aGNxM0KekVVCNeNyyT5yfjCmJ qTr6Y5XBFxTMHDmIDPMd96vFb3jxbM+OS+ldAEVJbrhs9cPWuwS2EpcdizwysE9utwQV 8LrjaFBHyz8vXOn7B/ls2xrUmK3D9r0vu8AOiexeePzyzzbZ6u/uJooBeP4MzmSeYxmN qHtQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=cT4KvaZv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c22si7168224ioo.82.2021.05.28.18.04.52; Fri, 28 May 2021 18:05:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=cT4KvaZv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229597AbhE2BFz (ORCPT + 99 others); Fri, 28 May 2021 21:05:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60640 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229541AbhE2BFz (ORCPT ); Fri, 28 May 2021 21:05:55 -0400 Received: from mail-lj1-x22d.google.com (mail-lj1-x22d.google.com [IPv6:2a00:1450:4864:20::22d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 990A9C061574 for ; Fri, 28 May 2021 18:04:18 -0700 (PDT) Received: by mail-lj1-x22d.google.com with SMTP id a4so7433746ljd.5 for ; Fri, 28 May 2021 18:04:18 -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=nbO0dpVLvz8B3suqOGCnho5bFLV7xSGLoLgcJpXNjMiKlUtjhw/T778k3jy8AI/zaL lAZ34MLwkN2YD843mL23o3XivGGEEH8wCxrEQtF5f03Et7irmLvdV/jZT3kNB1QZcZyl I3nM5JMwK8ykX1BySdLUgqWdQLcSWxSjGpf1YejpX12NN/PKokkBdNOzNGBVR/L2uGdl 98PaYG8ToauacF0UcsQqIDtph6WhY7vZczuuD9TZqfdjdVZsnMLV0oRocnxDvYnehOMi dUIki+IGnXJ0tokPPqrGJ6pjmM/lPJNshVEZlNLtTgC5LdPg9hXIZltrSoPg3IkHSLdf OO0Q== X-Gm-Message-State: AOAM53323pbkQSx9oqyGE0C4/BBmjo74EQ1Uf2Mmd6+lPEbe4qhqcLQq /sjazOqT4jUV8GYgUAABhCRmSYen3Rp0iFIH X-Received: by 2002:a2e:7319:: with SMTP id o25mr192406ljc.38.1622250256551; Fri, 28 May 2021 18:04:16 -0700 (PDT) Received: from mail-lf1-f49.google.com (mail-lf1-f49.google.com. [209.85.167.49]) by smtp.gmail.com with ESMTPSA id n7sm683666ljj.109.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-f49.google.com with SMTP id q7so7842777lfr.6 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" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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