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=-8.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham 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 34ADAC47082 for ; Thu, 3 Jun 2021 20:08:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 11A2C611C9 for ; Thu, 3 Jun 2021 20:08:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229917AbhFCUJp (ORCPT ); Thu, 3 Jun 2021 16:09:45 -0400 Received: from mail.kernel.org ([198.145.29.99]:39250 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229661AbhFCUJo (ORCPT ); Thu, 3 Jun 2021 16:09:44 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id E333F613D7; Thu, 3 Jun 2021 20:07:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1622750879; bh=s+GFoK0CcrBhtHRxHPLs58CMRcGtBRU75Q3Rrs2tEbA=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=hm12yZR6aJD++LSXbEVDoVaaDp4Edic/IwebPvSU5I+y2YCRFV4OPm9HftXdpmFrO +MZidBr3cTy+FzpxVPLNcVG0jjqrcTTHVausfunIH3e8Ui6Ts55x3myPMSs+nFkp0r obr7D7OmrhRtQT5g+VMdlMCJkPI4BuD7JO+tsU+U9s55wHncTy/t9AAoIIpLrU3H9D joNT4xGVpJkt2++myelBF86017ZiTSz3yYdPFio4s4BVTxtJkd7rv0RdTXCrjhTvMe 1KDzUICIUSp1xBK9M9qPA5mDJtv0fiNQHLqQmkHQKTKLedVHlWSvZRRaMKKGT5SfvZ o3NzUJhnrhXIA== Subject: Re: Sealed memfd & no-fault mmap To: Simon Ser Cc: Linus Torvalds , Hugh Dickins , 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: <80c87e6b-6050-bf23-2185-ded408df4d0f@gmail.com> <36fc2485-11f1-5252-904d-f26b63a6cd58@gmail.com> <0464f8dd-d082-b246-83ff-609f0f48de59@gmail.com> <8By7yERxX_qlsLZuOeJihJqeU-pZtFxsS2zrQ1ssN6-NkyIRrv-r81Ux_PTcb8qy7QA1HmkRxTeixT5MaJs7NKk0rqxDC9Nu9DoTRmS0UHw=@emersion.fr> From: Ming Lin Message-ID: Date: Thu, 3 Jun 2021 13:07:56 -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: <8By7yERxX_qlsLZuOeJihJqeU-pZtFxsS2zrQ1ssN6-NkyIRrv-r81Ux_PTcb8qy7QA1HmkRxTeixT5MaJs7NKk0rqxDC9Nu9DoTRmS0UHw=@emersion.fr> 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 6/3/2021 6:01 AM, Simon Ser wrote: > > Regarding the requirements for Wayland: > > - The baseline requirement is being able to avoid SIGBUS for read-only mappings > of shm files. > - Wayland clients can expand their shm files. However the compositor doesn't > need to immediately access the new expanded region. The client will tell the > compositor what the new shm file size is, and the compositor will re-map it. > - Ideally, MAP_NOSIGBUS would work on PROT_WRITE + MAP_SHARED mappings (of > course, the no-SIGBUS behavior would be restricted to that mapping). The > use-case is writing back to client buffers e.g. for screen capture. From the > earlier discussions it seems like this would be complicated to implement. > This means we'll need to come up with a new libwayland API to allow > compositors to opt-in to the read-only mappings. This is sub-optimal but > seems doable. > - Ideally, MAP_SIGBUS wouldn't be restricted to shm. There are use-cases for > using it on ordinary files too, e.g. for sharing ICC profiles. But from the > earlier replies it seems very unlikely that this will become possible, and > making it work only on shm files would already be fantastic. In the new version of the patches, MAP_NOSIGBUS is not restricted to shmem. It can be used on ordinary files.