so can the kernel (ring0) freely read/write to memory encrypted with MPK? I think so, yes. good luck with whatever happens next tho lol
By the way, MPK memory is not encrypted. The key is just an identifier for the requestor. If it doesn’t match the same identifier for the memory page, then an exception is raised.