public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Willy Tarreau <w@1wt.eu>
To: Dave Hansen <dave.hansen@intel.com>
Cc: linux-kernel@vger.kernel.org, x86@kernel.org, tglx@linutronix.de,
	gnomes@lxorguk.ukuu.org.uk, torvalds@linux-foundation.org,
	Ingo Molnar <mingo@kernel.org>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Borislav Petkov <bp@alien8.de>,
	Josh Poimboeuf <jpoimboe@redhat.com>,
	Andy Lutomirski <luto@kernel.org>
Subject: Re: [PATCH RFC 3/4] x86/pti: don't mark the user PGD with _PAGE_NX.
Date: Mon, 8 Jan 2018 18:17:07 +0100	[thread overview]
Message-ID: <20180108171707.GG10913@1wt.eu> (raw)
In-Reply-To: <57039ac1-efe2-2f97-386f-dab0b90f64a5@intel.com>

[ expanded the Cc list a bit ]

On Mon, Jan 08, 2018 at 09:03:36AM -0800, Dave Hansen wrote:
> On 01/08/2018 08:12 AM, Willy Tarreau wrote:
> > Since we're going to keep running on the same PGD when returning to
> > userspace for certain performance-critical tasks, we'll need the user
> > pages to be executable. So this code disables the extra protection
> > that was added consisting in marking user pages _PAGE_NX so that this
> > pgd remains usable for userspace.
> > 
> > Note: it isn't necessarily the best approach, but one way or another
> >       if we want to be able to return to userspace from the kernel,
> >       we'll have to have this executable anyway. Another approach
> >       might consist in using another pgd for userland+kernel but
> >       the current core really looks like an extra careful measure
> >       to catch early bugs if any.
> 
> I don't like this.

This is the purpose of the review.

> I think the prctl() should apply to an entire process, not to a thread.

As I mentionned in another mail, I didn't know how to do it, even less
how to do it fast enough so that we didn't add more cycles to the syscall
code.

> If it applies to a process, you can unpoison the PGD.  I even had code
> to do this in an earlier version of the (whole system) runtime PTI
> on/off stuff.
> 
> Why are you even posting half-baked hacks like this now?  Is there
> something super-pressing about this set that we need to lock in a new
> ABI now?

No need to lock in or whatever. It's just that a number of us simply
cannot use the current protection due to the huge cost it comes with
for their specific workload, and having to choose between performance
or protection remains a problem. Having a bit more available time and
being directly concerned by this problem I tried to propose something
to 1) see if there was any hope and 2) possibly help things move forward
in this direction. The patches are marked RFC, they're for discussing,
not for merging.

Willy

  reply	other threads:[~2018-01-08 17:17 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-08 16:12 [PATCH RFC 0/4] Per-task PTI activation Willy Tarreau
2018-01-08 16:12 ` [PATCH RFC 1/4] x86/thread_info: add TIF_NOPTI to disable PTI per task Willy Tarreau
2018-01-08 16:57   ` Thomas Gleixner
2018-01-08 17:03     ` Willy Tarreau
2018-01-08 17:14       ` Ingo Molnar
2018-01-08 16:12 ` [PATCH RFC 2/4] x86/arch_prctl: add ARCH_GET_NOPTI and ARCH_SET_NOPTI to enable/disable PTI Willy Tarreau
2018-01-08 16:49   ` Peter Zijlstra
2018-01-08 16:56     ` Willy Tarreau
2018-01-08 17:02   ` Thomas Gleixner
2018-01-08 17:10     ` Willy Tarreau
2018-01-08 17:17     ` Ingo Molnar
2018-01-08 17:26       ` Thomas Gleixner
2018-01-08 17:46         ` Ingo Molnar
2018-01-08 17:05   ` Ingo Molnar
2018-01-08 17:19     ` Peter Zijlstra
2018-01-08 17:26       ` Ingo Molnar
2018-01-08 17:50   ` Borislav Petkov
2018-01-08 17:54   ` Linus Torvalds
2018-01-08 18:22     ` Willy Tarreau
2018-01-08 20:49       ` Thomas Gleixner
2018-01-08 21:03         ` Willy Tarreau
2018-01-08 20:35     ` Willy Tarreau
2018-01-08 16:12 ` [PATCH RFC 3/4] x86/pti: don't mark the user PGD with _PAGE_NX Willy Tarreau
2018-01-08 17:03   ` Dave Hansen
2018-01-08 17:17     ` Willy Tarreau [this message]
2018-01-08 17:23       ` Dave Hansen
2018-01-08 17:30         ` Peter Zijlstra
2018-01-08 17:49           ` Willy Tarreau
2018-01-08 17:21     ` Ingo Molnar
2018-01-08 23:05     ` Andy Lutomirski
2018-01-08 23:09       ` Kees Cook
2018-01-09  4:22       ` Willy Tarreau
2018-01-08 17:05   ` Thomas Gleixner
2018-01-08 17:28     ` Dave Hansen
2018-01-08 17:50       ` Ingo Molnar
2018-01-08 18:25         ` Alan Cox
2018-01-08 18:35           ` Ingo Molnar
2018-01-08 18:35           ` Linus Torvalds
2018-01-08 18:44         ` Dave Hansen
2018-01-08 16:12 ` [PATCH RFC 4/4] x86/entry/pti: don't switch PGD on tasks holding flag TIF_NOPTI Willy Tarreau
2018-01-08 17:11   ` Ingo Molnar
2018-01-08 17:20   ` Dave Hansen
2018-01-08 18:12     ` Willy Tarreau
2018-01-08 23:01   ` Andy Lutomirski
2018-01-08 16:59 ` [PATCH RFC 0/4] Per-task PTI activation Dave Hansen
2018-01-08 17:06   ` Willy Tarreau
2018-01-08 17:17     ` Dave Hansen
2018-01-08 17:13   ` Ingo Molnar
2018-01-09 15:31 ` Eric W. Biederman
2018-01-09 16:02   ` Willy Tarreau
2018-01-09 18:11     ` Zhi Wang
2018-01-09 21:07     ` Eric W. Biederman
2018-01-09 21:57       ` Willy Tarreau

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=20180108171707.GG10913@1wt.eu \
    --to=w@1wt.eu \
    --cc=a.p.zijlstra@chello.nl \
    --cc=bp@alien8.de \
    --cc=dave.hansen@intel.com \
    --cc=gnomes@lxorguk.ukuu.org.uk \
    --cc=jpoimboe@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mingo@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --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