AMD / Memory Protection Keys

From: Dave Hansen
Date: Wed Apr 29 2020 - 15:18:10 EST


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://www.amd.com/system/files/TechDocs/24593.pdf