mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dave Hansen <dave.hansen@intel.com>
To: Andy Lutomirski <luto@kernel.org>
Cc: Sean Christopherson <sean.j.christopherson@intel.com>,
	LKML <linux-kernel@vger.kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
	X86 ML <x86@kernel.org>, Jann Horn <jannh@google.com>
Subject: Re: [PATCH] x86/pkeys: Explicitly treat PK #PF on kernel address as a bad area
Date: Wed, 5 Sep 2018 14:35:41 -0700	[thread overview]
Message-ID: <6529a46e-ae83-5ff2-0152-1d5783f271c3@intel.com> (raw)
In-Reply-To: <CALCETrUKJ2qYVZRhDQEbVRPkgtj9VEdxc83ON9nAK-S52s7qmg@mail.gmail.com>

On 09/04/2018 02:27 PM, Andy Lutomirski wrote:
> Also, I doubt it matters right here, but !X86_PF_USER isn't quite the
> same thing as "originating from kernel code" -- it can also be user
> code that does a CPL0 access due to exception delivery or access to a
> descriptor table.  Which you saw plenty of times while debugging
> PTI... :)  I doubt any of those should be spurious, though.

Yeah, you're talking about "implicit supervisor access".  Right?

I definitely saw those during KAISER/KPTI development.  But, it's
probably worth noting that the code that we have that _looks_ for these:

>         /*
>          * It's safe to allow irq's after cr2 has been saved and the
>          * vmalloc fault has been handled.
>          *
>          * User-mode registers count as a user access even for any
>          * potential system fault or CPU buglet:
>          */
>         if (user_mode(regs)) {
>                 local_irq_enable();
>                 error_code |= X86_PF_USER;
>                 flags |= FAULT_FLAG_USER;

is in the user address space handling portion of the code.  So, it's
really not useful for any of the _known_ implicit supervisor-mode
accesses.  I think it can only get triggered in the case of hardware or
software bugs.

  reply	other threads:[~2018-09-05 21:35 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-07 17:29 Sean Christopherson
2018-08-07 18:28 ` Dave Hansen
2018-08-30 10:40   ` Thomas Gleixner
2018-08-30 23:33     ` Dave Hansen
2018-08-31  2:38   ` Jann Horn
2018-08-31  3:08     ` Andy Lutomirski
2018-09-04 19:50 ` Sean Christopherson
2018-09-04 19:56   ` Andy Lutomirski
2018-09-04 21:21     ` Dave Hansen
2018-09-04 21:27       ` Andy Lutomirski
2018-09-05 21:35         ` Dave Hansen [this message]
2018-09-05 21:39           ` Andy Lutomirski

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=6529a46e-ae83-5ff2-0152-1d5783f271c3@intel.com \
    --to=dave.hansen@intel.com \
    --cc=hpa@zytor.com \
    --cc=jannh@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mingo@redhat.com \
    --cc=sean.j.christopherson@intel.com \
    --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®