mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dave Hansen <dave.hansen@intel.com>
To: Aruna Ramakrishna <aruna.ramakrishna@oracle.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"x86@kernel.org" <x86@kernel.org>,
	"dave.hansen@linux.intel.com" <dave.hansen@linux.intel.com>,
	"tglx@linutronix.de" <tglx@linutronix.de>
Subject: Re: [RFC PATCH] x86/pkeys: update PKRU to enable pkey 0 before XSAVE
Date: Thu, 14 Mar 2024 11:30:01 -0700	[thread overview]
Message-ID: <ce99c89d-f7ed-4d9d-b04d-4699245c55d1@intel.com> (raw)
In-Reply-To: <349322E5-5E6C-48D5-BA12-1CF47CE82930@oracle.com>

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.



  reply	other threads:[~2024-03-14 18:30 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-14 17:29 Aruna Ramakrishna
2024-03-14 17:54 ` Dave Hansen
2024-03-14 18:14   ` Aruna Ramakrishna
2024-03-14 18:30     ` Dave Hansen [this message]
2024-03-15  4:47       ` Aruna Ramakrishna
2024-03-18 17:32         ` Matthias Neugschwandtner
2024-03-15 17:36     ` Thomas Gleixner
2024-03-15 18:06       ` Aruna Ramakrishna
2024-03-15 18:43       ` Aruna Ramakrishna
2024-03-15 23:05         ` Thomas Gleixner
2024-03-18 17:25           ` Aruna Ramakrishna

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ce99c89d-f7ed-4d9d-b04d-4699245c55d1@intel.com \
    --to=dave.hansen@intel.com \
    --cc=aruna.ramakrishna@oracle.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®