[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e7454046-c071-888d-f673-276f9c24d9d3@gmail.com>
Date: Mon, 31 May 2021 14:13:28 -0700
From: Ming Lin <minggr@...il.com>
To: Hugh Dickins <hughd@...gle.com>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Simon Ser <contact@...rsion.fr>
Cc: Peter Xu <peterx@...hat.com>,
"Kirill A. Shutemov" <kirill@...temov.name>,
Matthew Wilcox <willy@...radead.org>,
Dan Williams <dan.j.williams@...el.com>,
"Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>,
Will Deacon <will@...nel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
David Herrmann <dh.herrmann@...il.com>,
"linux-mm@...ck.org" <linux-mm@...ck.org>,
Greg Kroah-Hartman <greg@...ah.com>,
"tytso@....edu" <tytso@....edu>
Subject: Re: Sealed memfd & no-fault mmap
On 5/29/2021 4:36 PM, Ming Lin wrote:
> On 5/29/2021 1:15 PM, Hugh Dickins wrote:
>
>>
>> I believe the correct behaviour would be to unmap the nofault page
>> then, allowing the proper page to be faulted in after. That is
>> certainly doable (the old mm/filemap_xip.c used to do so), but might
>> get into some awkward race territory, with filesystem dependence
>> (reminiscent of hole punch, in reverse). shmem could operate that
>> way, and be the better for it: but I wouldn't want to add that,
>> without also cleaning away all the shmem_recalc_inode() stuff.
OK, I borrowed code from filemap_xip.c and implemented this behavior.
Simon,
Before I send out the patches for review, would you mind have a quick test?
https://github.com/minggr/linux, branch shmem_no_sigbus
In Wayland compositors, you only need to pass in MAP_NOSIGBUS in mmap().
For example,
//fd should be received from Wayland compositors client
#define MAP_NOSIGBUS 0x200000
addr = mmap(NULL, size, PROT_READ, MAP_SHARED|MAP_NOSIGBUS, fd, offset)
Thanks,
Ming
Powered by blists - more mailing lists