The docs for AMD's implementation of protection keys showed up[1].
Welcome to the party!
It all looks fine, except for this nugget:
The MPK mechanism is ignored in the following cases:
... for pages marked in the paging structures as read-only
(R/W=0) or as supervisor addresses (U/S=0)
That R/W=0 would mean that you can't access-disable read-only pages,
which seems a bit goofy. It's certainly a feature that I could imagine
folks wanting to have. Read-only pages might happen in unexpected
places for things like mmap(PROT_WRITE)'d files or even CoW pages after
fork().
Is this an error in the docs?
1. https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.amd.com%2Fsystem%2Ffiles%2FTechDocs%2F24593.pdf&data=02%7C01%7Csuravee.suthikulpanit%40amd.com%7C9ea21438bce6488589a308d7ec720d0d%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637237847630823928&sdata=LZLQjvlVT5xSnjyRt0alN0lHleh8VD7Sxx53RL1UrX0%3D&reserved=0