[Vm-dev] Robust FFI with Memory Protection Keys
btc at openinworld.com
Sat Aug 4 15:40:46 UTC 2018
A problem with FFI is that if a callout segfaults, all of memory
including that of the Image is suspect, and execution of the Image terminates.
Occasionally I hunt around hoping to find technology to mitigate that problem.
Maybe this time in I found something... Memory Protection Keys 
Perhaps these could ensure Image memory safe when an FFI callout segfaults.
IIUC the main problem with protecting Image memory on every FFI callout
is the time it would take update the flags on every page of Image memory.
Would being able to change the protection of a massive number of pages
with one syscall make it feasible to wrap them around FFI callouts?
This may be useful at least where the FFI use is more about reuse of
existing functionality than about performance.
Or at least useful while someone is learning/experimenting with FFI for
the first time or while becoming familiar with some external library.
Further info at  & .
More information about the Vm-dev