Re: [PATCH V10 14/44] mm/pkeys: Introduce pks_set_readwrite()

From: Edgecombe, Rick P
Date: Tue May 10 2022 - 18:26:52 EST


On Tue, 2022-05-10 at 15:08 -0700, Kees Cook wrote:
> > Kees would you prefer pks_set_nowrite() as a name?
>
> I think nowrite is the better name (in the sense that "read-only" can
> sometimes imply non-executable).

I agree with this here. Read-only is a bad name for not writable.
Especially if you try talking about "execute-only" memory which is
"read-only" (not writable) and "not readable". Very confusing.

>
> > >
> > > With these changes it should be possible to protect the kernel's
> > > page
> > > table entries from "stray" writes. :)
> >
> > Yes, Rick has done some great work in that area.
>
> Oh! I would _love_ to see this series. I was trying to scope the work
> yesterday but gave up after I couldn't figure out the qemu PKS trick.
> :)

I would still like to get back to it, but other work has bumped it for
now.

v1:
https://lore.kernel.org/lkml/20210505003032.489164-1-rick.p.edgecombe@xxxxxxxxx/#r

v2:
https://lore.kernel.org/lkml/20210830235927.6443-1-rick.p.edgecombe@xxxxxxxxx/#r

Mostly it fit together pretty easily, but there was memory overhead
required to protect the page tables that map the direct map fully
(unless a better solution can be found).