Messages in this thread | | | Subject | Re: Sealed memfd & no-fault mmap | From | Ming Lin <> | Date | Mon, 31 May 2021 14:13:28 -0700 |
| |
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
| |