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 0080BC433B4 for ; Wed, 5 May 2021 10:21:41 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 3B70261157 for ; Wed, 5 May 2021 10:21:40 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3B70261157 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=emersion.fr Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 8578C6B006C; Wed, 5 May 2021 06:21:39 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7F4CA6B006E; Wed, 5 May 2021 06:21:39 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6BDDA6B0070; Wed, 5 May 2021 06:21:39 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0232.hostedemail.com [216.40.44.232]) by kanga.kvack.org (Postfix) with ESMTP id 501D36B006C for ; Wed, 5 May 2021 06:21:39 -0400 (EDT) Received: from smtpin03.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id EFD86181AF5C2 for ; Wed, 5 May 2021 10:21:38 +0000 (UTC) X-FDA: 78106785876.03.AEE6756 Received: from mail2.protonmail.ch (mail2.protonmail.ch [185.70.40.22]) by imf15.hostedemail.com (Postfix) with ESMTP id 2BA64A00038A for ; Wed, 5 May 2021 10:21:30 +0000 (UTC) Date: Wed, 05 May 2021 10:21:16 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=emersion.fr; s=protonmail3; t=1620210093; bh=3RksiCH8cPtPlWk0to7nyL1y138c0K4MSYx/+808EYk=; h=Date:To:From:Cc:Reply-To:Subject:In-Reply-To:References:From; b=L1Pf1yT46Pzxfe9OzxG4g/ti/bt8/pX5+BOv5cn5Hz1sSX9ArWdWJg04JoFgxBkwa lDfZzBVdd1Sav2gpsHuJn2YY4i6ttsQ+Nt0Csvk03Dwi3hl977iSpRboqdkcK/J2Mu C3aENO9x9pWrufKsAjf4NtiQ6ipf9+sfrJWQhfxPRA6DF1JxscCIxyAp066yD0sFv/ YcqRgPcCB7L3QDz4wCB8zNm6DX9HIJ1Uu44qS+A0vmsW5g1Y5PTRFOkn48UUStNFkN 0l5iHCe2E18xiuCdXN40ST7SqCOwtbKPTnnJmWeBTROq3wFUS66UiV/lPYniRgrmL2 1ykVAgbWiw+ew== To: Linus Torvalds From: Simon Ser Cc: 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" Reply-To: Simon Ser Subject: Re: Sealed memfd & no-fault mmap Message-ID: In-Reply-To: References: <20210429154807.hptls4vnmq2svuea@box> <20210429183836.GF8339@xz-x1> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=emersion.fr header.s=protonmail3 header.b=L1Pf1yT4; dmarc=pass (policy=none) header.from=emersion.fr; spf=pass (imf15.hostedemail.com: domain of contact@emersion.fr designates 185.70.40.22 as permitted sender) smtp.mailfrom=contact@emersion.fr X-Stat-Signature: zgx7sb7mhuu1fyktckzup4nzf91b5aph X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 2BA64A00038A Received-SPF: none (emersion.fr>: No applicable sender policy available) receiver=imf15; identity=mailfrom; envelope-from=""; helo=mail2.protonmail.ch; client-ip=185.70.40.22 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1620210090-103502 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 Tuesday, May 4th, 2021 at 6:08 PM, Linus Torvalds wrote: > On Tue, May 4, 2021 at 2:29 AM Simon Ser contact@emersion.fr wrote: > > > The remaining 10% is when the compositor needs a writable mapping for > > things like screen capture. It doesn't seem like a SIGBUS handler can > > be avoided in this case then=E2=80=A6 Oh well. > > So as Peter Xu mentioned, if we made it a "per inode" thing, we > probably could make such an inode do the zero page fill on its own, > and it might be ok for certain cases even for shared mappings. > However, realistically I think it's a horrible idea for the generic > situation, because I think that basically requires the filesystem > itself to buy into it. And we have something like 60+ different > filesystems. > > Is there some very specific and targeted pattern for that "shared > mapping" case? For example, if it's always a shared anonymous mapping > with no filesystem backing, then that would possibly be a simpler case > than the "random arbitrary shared file descriptor". Yes. I don't know of any Wayland client using buffers with real filesystem backing. I think the main cases are: - shm_open(3) immediately followed by shm_unlink(3). On Linux, this is implemented with /dev/shm which is a tmpfs. - Abusing /tmp or /run's tmpfs by creating a file there and unlinking it immediately afterwards. Kind of similar to the first case. - memfd_create(2) on Linux. Is this enough to make it work on shared memory mappings? Is it important that the mapping is anonymous? Thanks, Simon