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

From: Robert Kueffner
Date: Fri Sep 08 2023 - 11:43:52 EST


> There are tons of complicated ways to fix this. But the easiest way is
> just to say that you need to keep PKRU set so that the signal frame can
> be written at any time.

Just for completeness sake, the signal frame was actually written successfully since I moved the stack pointer to pkey-1 associated memory before any exceptions, details in unix.stackexchange I <https://unix.stackexchange.com/questions/755160/memory-protection-keys-exception-handler-crashes-if-pkey0-is-write-disabled> posted in the beginning.
And it’s probably that the kernel wants to write something else into pkey-0 associated memory.

I understand that there is no easy solution, so my idea of isolating a user from corrupting pkey-0 memory is probably moot.

Thanks Dave, that helped me a lot to understand the problem