PKU usage improvements for threads

From: Kees Cook
Date: Mon Aug 22 2022 - 16:40:34 EST


Hi!

I was hoping to start a conversation about PKU usage for threads in two
places, which Stephen Röttger brought to my attention, with the hope of
being able to use these in Chrome:

1) It appears to be a bug that a thread without the correct PK can make
VMAs covered by a separate PK, out from under other threads. (e.g. mmap
a new mapping to wipe out the defined PK for it.) It seems that PK checks
should be made when modifying VMAs.

2) It would be very helpful to have a mechanism for the signal stack to
be PK aware, in the sense that the kernel would switch to a predefined
PK. i.e. having a new interface to sigaltstack() which includes a PK.

Are either of these something the PKU authors have considered? (Or are
there some details we're missing in this area?)

Thanks!

-Kees

--
Kees Cook