Re: Memory protection keys: Signal handlers crash if pkey0 is write-disabled

From: Dave Hansen
Date: Thu Sep 07 2023 - 17:31:18 EST


On 9/7/23 14:22, Robert Kueffner wrote:
> Is there some way to make this work, or is it generally not possible
> to successfully handle exceptions if WD0=true?

It's theoretically possible, but it's in a grey area. The kernel can't
easily try to respect PKRU *and* override it for things like decoding
userspace instructions.

PKRU should get reset to a value that permits reads and writes to pkey-0
before the signal frame is created. But you're obviously tripping over
it anyway.

I assume that *something* is trying to access pkey-0-protected memory.
Any idea what that is? Which entity is doing that access and what are
they accessing? The page fault tracepoints might come in handy.