This is neat, but the Linux kernel kind of has a built in mechanism for this — userfaultfd (see, the following for when the capability to implement CoW was added: https://lwn.net/Articles/777258/).
The article does highlight that the capability described is implemented in userspace, but quite a bit of what’s required to implement segfaults happens in kernel space. I’d argue that userfaultfd is equally in userspace to signal handlers.
Oh nice! I didn't really look into a linux implementation, as my initial curiosity was sated by the time I finished the windows version, but it's cool to know there's a more "proper" option there.
2 comments
[ 3.3 ms ] story [ 14.5 ms ] threadThe article does highlight that the capability described is implemented in userspace, but quite a bit of what’s required to implement segfaults happens in kernel space. I’d argue that userfaultfd is equally in userspace to signal handlers.