by mrpf1ster · 1y ago · 0 comments
(This isn't the theoretical ivory tower kind of UB. Operating systems regularly remap a page that hasn't yet been written to.)
1. Initially map the not-yet-written page to a read-only page full of zeros (the same one for all allocations: only one exists in the whole system).
2. When a write takes place, copy-on-write clone that page to a newly allocated zero-filled-page, then allow the write to proceed.