[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ce99c89d-f7ed-4d9d-b04d-4699245c55d1@intel.com>
Date: Thu, 14 Mar 2024 11:30:01 -0700
From: Dave Hansen <dave.hansen@...el.com>
To: Aruna Ramakrishna <aruna.ramakrishna@...cle.com>
Cc: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"x86@...nel.org" <x86@...nel.org>,
"dave.hansen@...ux.intel.com" <dave.hansen@...ux.intel.com>,
"tglx@...utronix.de" <tglx@...utronix.de>
Subject: Re: [RFC PATCH] x86/pkeys: update PKRU to enable pkey 0 before XSAVE
On 3/14/24 11:14, Aruna Ramakrishna wrote:
> I thought the PKRU value being reset in the signal handler was supposed
> to be the default behavior. In which case, this is a bug.
>
> "Signal Handler Behavior
> Each time a signal handler is invoked (including nested signals),
> the thread is temporarily given a new, default set of protection
> key rights that override the rights from the interrupted context.”
>
> (Ref: https://man7.org/linux/man-pages/man7/pkeys.7.html)
As the person who wrote those words, I can honestly say that there were
*ZERO* considerations for what the kernel's permissions were while
setting up the frame. I was assuming then and assume to this day that
it's practically impossible to turn off pkey-0 writes and get sane behavior.
If we want to lawyer-word the manpage, I'll just argue that "Each time a
signal handler is invoked" literally doesn't apply until the moment that
RIP is pointing back to userspace. :)
If this is truly about the manpage, then I'll happily amend the manpage
to say, "don't turn off pkey 0 access or else". I'd *MUCH* rather do
that than add more pkey munging to the kernel.
In other words, you're not going to spur me into action my thwapping me
with the manpage that I wrote. You've got to convince me that your new
use case is valid, this is the best way to support your new use case,
and that your implementation of the new feature is sane.
Powered by blists - more mailing lists