userfaultfd: wp: undo write proctection in unregister

After a userfaultfd unregister, make sure the range doesn't disable
write in ptes.

v1: From: Shaohua Li <>

v2: the unregister ioctl marking the memory writable if run on an
anonymous region won't actually do much. We can leave it there as
placeholder as it's valid code, but it's not worth running right
now. It's intended as an optimization to reduce the number of minor
faults, but as currently implemented it looks a noop.

Signed-off-by: Andrea Arcangeli <>
1 file changed