Re: [PATCH RFC 0/9] PKS write protected page tables

Ira Weiny
2021-05-06T00:00:45Z

On Tue, May 04, 2021 at 11:25:31PM -0700, Kees Cook wrote:
> On Tue, May 04, 2021 at 05:30:23PM -0700, Rick Edgecombe wrote:
>
> > Performance impacts
> > ===================
> > Setting direct map permissions on whatever random page gets allocated for a
> > page table would result in a lot of kernel range shootdowns and direct map
> > large page shattering. So the way the PKS page table memory is created is
> > similar to this module page clustering series[2], where a cache of pages is
> > replenished from 2MB pages such that the direct map permissions and associated
> > breakage is localized on the direct map. In the PKS page tables case, a PKS
> > key is pre-applied to the direct map for pages in the cache.
> >
> > There would be some costs of memory overhead in order to protect the direct
> > map page tables. There would also be some extra kernel range shootdowns to
> > replenish the cache on occasion, from setting the PKS key on the direct map of
> > the new pages. I don’t have any actual performance data yet.
>
> What CPU models are expected to have PKS?

Supervisor Memory Protection Keys (PKS) is a feature which is found on Intel’s
Sapphire Rapids (and later) “Scalable Processor” Server CPUs. It will also be
available in future non-server Intel parts.

Also qemu has some support as well.

https://www.qemu.org/2021/04/30/qemu-6-0-0/

Ira