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: X86 ML <x86@kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Borislav Petkov <bp@alien8.de>, Brian Gerst <brgerst@gmail.com>,
	David Laight <David.Laight@aculab.com>,
	Kees Cook <keescook@chromium.org>,
	Peter Zijlstra <peterz@infradead.org>,
	"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Subject: Re: [PATCH PTI v2 6/6] x86/pti: Put the LDT in its own PGD if PTI is on
Date: Mon, 11 Dec 2017 11:32:53 -0800	[thread overview]
Message-ID: <57f0c2d6-4006-f882-e444-e39903f573ec@intel.com> (raw)
In-Reply-To: <CALCETrU6V0LJwTTJFbgmq-BvG5MpDXnXTGhB8O8_dJfU=4kFSw@mail.gmail.com>

On 12/11/2017 10:40 AM, Andy Lutomirski wrote:
>> Also, from a high level, this does increase the overhead of KPTI in a
>> non-trivial way, right?  It costs us three more page table pages per
>> process allocated at fork() and freed at exit() and a new TLB flush.
> Yeah, but no one will care.  modify_ldt() is used for DOSEMU, Wine,
> and really old 32-bit programs.

The heavyweight part of map_ldt_struct() (and unmap) looks to run
whenever we have KPTI enabled.  I'm missing how it gets avoided for the
non-DOSEMU cases.

I thought there would be a "fast path" where we just use the normal
clear_LDT() LDT from the cpu_entry_area and don't have to do any of
this, but I'm missing where that happens.  Do we need a check in
(un)map_ldt_struct() for !mm->context.ldt?

Just to make sure I understand this: We now have two places that LDTs
live in virtual space:

1. The "plain" one that we get from clear_LDT() which lives in the
   cpu_entry_area.  (No additional overhead when doing this)
2. The new one under the special PGD that's only used for modify_ldt()
   and is fairly slow.  (plenty of overhead, but nobody cares).

  reply	other threads:[~2017-12-11 19:32 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-11  6:47 [PATCH PTI v2 0/6] Clean up pgd handling and fix VSYSCALL and LDT Andy Lutomirski
2017-12-11  6:47 ` [PATCH PTI v2 1/6] x86/pti: Vastly simplify pgd synchronization Andy Lutomirski
2017-12-11  6:47 ` [PATCH PTI v2 2/6] Revert "x86/mm/pti: Disable native VSYSCALL" Andy Lutomirski
2017-12-11  6:47 ` [PATCH PTI v2 3/6] x86/vsyscall/64: Explicitly set _PAGE_USER in the pagetable hierarchy Andy Lutomirski
2017-12-11 13:39   ` Ingo Molnar
2017-12-11 16:01     ` Andy Lutomirski
2017-12-11 16:24       ` Ingo Molnar
2017-12-11  6:47 ` [PATCH PTI v2 4/6] x86/vsyscall/64: Warn and fail vsyscall emulation in NATIVE mode Andy Lutomirski
2017-12-11  6:47 ` [PATCH PTI v2 5/6] x86/pti: Map the vsyscall page if needed Andy Lutomirski
2017-12-11  6:47 ` [PATCH PTI v2 6/6] x86/pti: Put the LDT in its own PGD if PTI is on Andy Lutomirski
2017-12-11 17:49   ` Dave Hansen
2017-12-11 18:40     ` Andy Lutomirski
2017-12-11 19:32       ` Dave Hansen [this message]
2017-12-11 19:39         ` Andy Lutomirski
2017-12-11 19:47           ` Dave Hansen
2017-12-11 20:06             ` Andy Lutomirski
2017-12-11  6:54 ` [PATCH PTI v2 0/6] Clean up pgd handling and fix VSYSCALL and LDT Andy Lutomirski
2017-12-12 16:01   ` Kirill A. Shutemov

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=57f0c2d6-4006-f882-e444-e39903f573ec@intel.com \
    --to=dave.hansen@intel.com \
    --cc=David.Laight@aculab.com \
    --cc=bp@alien8.de \
    --cc=brgerst@gmail.com \
    --cc=keescook@chromium.org \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=peterz@infradead.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

Powered by JetHome