Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp546796pxj; Thu, 3 Jun 2021 13:10:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyX+9XSuvDaThseimJYBGIhozVUp+JWMBr/qWdhvm2v9E4z5OMgYwaT0/Iq8SfFXBErhUb3 X-Received: by 2002:a05:6402:1c11:: with SMTP id ck17mr1194454edb.102.1622751007743; Thu, 03 Jun 2021 13:10:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622751007; cv=none; d=google.com; s=arc-20160816; b=Bu9OSK35YFnYOUo01hktRfipUzoAWO4xmUKBqtxroijbxtzniXHfLDZy67SlOCGF86 yOBLDlTO6WbVrVpyTvVt1D41uelBt4dU6KoKVcGrHEGkJhc1aRSq3bw95hY7zZ1mACOu winJk0dvGh/8TOQN1CHnIpdqwJ8Nki4qUd/kDznbOX8Vkt2De56YeelNh5buBG5S2Wp9 qPNkx+s3dGpBn8C2fc05o6mGIWUzbhKzop/E8IFcXX7lqt/Ccs105l8GZgNco5xa7DiZ AhzHY7qmDsGmwIRf7XXgEA/B08r8q6auCI01PvalhNZ21KcS7yY50Aw4aUH9N0Gs7Z98 jjnQ== 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=RhNXDRi8nTdUJ8gQl3NSFYbkx6zHipcyom8QBRtDZxo=; b=A1Jcbnytu+Xyx6xc3+A5RvtLdj5u/u+WGMPWNCEm/4eAggISCx5l7oRsYAbvv7jszV BEJv4Fu5ROOuA6X8VK7U2IPgIE37Eh6eGnwFg4J9I/VYfrY6Oz3dH8A/9cJl+KfiE+/B x4k7IA2uMfYDSZRphuQsbVmnE9iCfr685PlQGoLN4YmZUmnSza9xMUnnO1Zz1adjuRby B4/qWJPBHOrk5xBUORfIDl4xu7wbz1fOgzjAu3ETRIWQEKD/sVfgpmejtoylgMX8p70H zRTynxmj6K9pS1AmW3yUKntGTp1BqwB0N+axSko0cMHl1669ZC3qqSMJ/fq52BVD8QTM IxEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=hm12yZR6; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o17si2784787eju.179.2021.06.03.13.09.42; Thu, 03 Jun 2021 13:10:07 -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=@kernel.org header.s=k20201202 header.b=hm12yZR6; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229882AbhFCUJo (ORCPT + 99 others); Thu, 3 Jun 2021 16:09:44 -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.