Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3232280pxj; Tue, 1 Jun 2021 00:09:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwMQYWgKxRo2dpz1XK+pDoFIm0fVK4QasNivq1aOeWKPsIG2lyZIt6i8KyT/zGg5YJ5VU+K X-Received: by 2002:a5e:a902:: with SMTP id c2mr19966673iod.80.1622531392773; Tue, 01 Jun 2021 00:09:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622531392; cv=none; d=google.com; s=arc-20160816; b=JRsksQmBXJzq6vLAYYLTWfrpLpZ8XxdC1/KcuCqs7gPF0EI2768Uehchq2MDsYu35o SK1bSj9PFy+BkCrzVx99VdzQ9hiaFRd7q7dJEu1a9hISgZwS/+sadwUsF+jNY3+vN2hd O+NAuZ3ncbuiQxcgiEZZTQsG8gSFWd9neE/jx6+tY0suz2+vTxA9ktv2ODFJcy/Wr0+4 aOw1qSAbSqdcQrdTsHVi/qlOP5K3OvQoJ1P19b+GBfz4VBZ2x0fMXTiGBcTw0ARaKFCh jDmZRY3lRmYkSAtV5+naI2902GeUSvCB/jWJRJfI9snoOR88aGnJtwYeY7vBYhGBxtTr Wmeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=WR3r+ydE1Ns9ygBtsSiaRQAr3k4CSXyTaNQimiETYP8=; b=AI2eKFukPK3FZkhhtYEf4fzQ/I5HWLqZt5tW/OFoTWhDKPZNVOHaXDk85ojAFqJTFz 5sAZ8JHQJ5KYXCKMbcMidU8nTtMzOFUXLmOKcJGLYZYcLsEdpKPxJarD2/BZFCWaSpbk 870N+LDvth3ykOgncNzdFH+3BEdBJor36q68vyn3EPz1cSqeOi//IyEgnKntZG+gsp7C SzuYaHvwku86afLrczpHhexFhCQAXXfQ38xJEtL/TBoKCI8fiELZ37STojJy8lRzXiUl EI0xwryn2XwlYzxFgCVz3xg1ikeNQAt1Gl57LN5Po5Pwe5EVBlFnP/uetGNiONed0yMg qjCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=rADtEdgm; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j1si15874415ila.134.2021.06.01.00.09.39; Tue, 01 Jun 2021 00:09:52 -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=@gmail.com header.s=20161025 header.b=rADtEdgm; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231928AbhFAHKg (ORCPT + 99 others); Tue, 1 Jun 2021 03:10:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38538 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229984AbhFAHKf (ORCPT ); Tue, 1 Jun 2021 03:10:35 -0400 Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C1252C061574 for ; Tue, 1 Jun 2021 00:08:53 -0700 (PDT) Received: by mail-pj1-x1036.google.com with SMTP id l10-20020a17090a150ab0290162974722f2so1317994pja.2 for ; Tue, 01 Jun 2021 00:08:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=WR3r+ydE1Ns9ygBtsSiaRQAr3k4CSXyTaNQimiETYP8=; b=rADtEdgmCPtVLRAUh7JzJ/+vJ/3a3Z1925ItFXCUt1JdcoRqbluar+SxAJkeNGME3G r6qIdWLJWEpE6Jn78SyAM9FWY4GMw2aAKDiSCKOsgLvQ01hF8cGqRW3/6w4dS6ytehw5 b1PAfiIQPxR0pX9Hg6YhWqwhvVeChw36xrZe51unywzExo1yYu2u3129udOQbNftNXyF z6fbrGXM3H15zKCJmj4Mzf9ivA6KOvhTHQZeMkZQqZDFh0jHVfBC+C8RCDVM/2Tx1+Hk ugIXoiMbg2Jvj1KoRVFlrVToos5TjOrXYb6ZmVj8O/gd+49Cj/uxfF2JkiOjcvUFWtuS D1rA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=WR3r+ydE1Ns9ygBtsSiaRQAr3k4CSXyTaNQimiETYP8=; b=URnPCB4RC/Dknm+BniCLDfbhc0WzWNiTpKWYosGl9KlP1L+DI/hHyDXlX0upH1HMMr 9RKcAJ7OccaKuTveJ/+VRnlt8ESdv3g7i8j9aGAKsroZK88MjhqwcNAorl3fQV6dt/8p tj6cRIN1E4fUlLZmkQ1oN+K0qq51uPZoXs38K1k6U+iw56QXe7/6BmhnGrjm/R21iZHC Acj58WNofnpETcDTpyBCayTzemfDOJsJstaTOtM3hE2OSwskB0pRKgZ+CVfjsmSp9tVb ldC7atcLNg6+oQB2IbvMbKUrglaI6pf/AR4F31guou9CUrH+gUYUSrgox/VFV+5hINrs qhNg== X-Gm-Message-State: AOAM533LBg+HSi9xMzt+Oa3yCUifN4BZNGWm11aAHjfdKpR0jMZBzBLS I9ePHq8eHPcZjSxLqwc0Q5k= X-Received: by 2002:a17:90a:8991:: with SMTP id v17mr3327483pjn.132.1622531332783; Tue, 01 Jun 2021 00:08:52 -0700 (PDT) Received: from [192.168.0.15] (c-73-158-171-241.hsd1.ca.comcast.net. [73.158.171.241]) by smtp.gmail.com with ESMTPSA id c128sm12728998pfa.189.2021.06.01.00.08.49 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 01 Jun 2021 00:08:51 -0700 (PDT) Subject: Re: Sealed memfd & no-fault mmap To: Linus Torvalds Cc: Hugh Dickins , 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" References: <7718ec5b-0a9e-ffa6-16f2-bc0b6afbd9ab@gmail.com> <80c87e6b-6050-bf23-2185-ded408df4d0f@gmail.com> <36fc2485-11f1-5252-904d-f26b63a6cd58@gmail.com> From: Ming Lin Message-ID: <0464f8dd-d082-b246-83ff-609f0f48de59@gmail.com> Date: Tue, 1 Jun 2021 00:08:48 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 5/31/2021 11:24 PM, Linus Torvalds wrote: > On Mon, May 31, 2021 at 11:13 AM Ming Lin wrote: >> >> OK, I borrowed code from filemap_xip.c and implemented this behavior. > > I think that "unmap page" is too complicated and fragile. > > The only page that could possibly validly be unmapped is a stale zero > page, but that code in shmem_unmap_nofault_page() seems to try to > handle other cases too (ie that whole page_remove_rmap() - afaik a > zero page has no rmap). > > I get the feeling that the simpler thing to do is to just say "if you > use MAP_NOSIGBUS, and you access pages that don't have a backing > store, you will get zero pages, and they will NOT BE SYNCHRONIZED with > the backing store possibly later being updated". > > IOW, just document the fact that a MAP_NOSIGBUS mapping isn't coherent > wrt shmem contents that are expanded and filled in later. > > Don't try to "fix" it - because any user that uses MAP_NOSIGBUS had > better just accept that it's not compatible with expanding the shmem > backing store later. > > Keep it simple and stupid. Hmm? Simon, Is this "simple" solution good enough for Wayland compositor use case?