lkml.org 
[lkml]   [2021]   [May]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: Sealed memfd & no-fault mmap
From
Date
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

\
 
 \ /
  Last update: 2021-05-31 23:13    [W:0.097 / U:2.916 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site