- Crazy idea: On Linux, parse /proc/self/maps to allow remapping
non-anonymous pages. Combined with mremap(2) or manual emulation, this allows mapping everything except for shared anonymous pages [and I can't imagine that a GPU driver would use those, especially given that the only way to make use of the SHARED flag is fork(2)].
Would this still work if the driver closed the FD after mmap-ing it?
Yes, procfs still displays the mapping in that case. Note that what's listed is the path (and inode), so we would reopen the path and then map it.