From: Andy Lutomirski <luto@kernel.org>
To: Dave Hansen <dave.hansen@intel.com>, Nadav Amit <namit@vmware.com>
Cc: Marius Hillenbrand <mhillenb@amazon.de>,
kvm list <kvm@vger.kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
Kernel Hardening <kernel-hardening@lists.openwall.com>,
Linux-MM <linux-mm@kvack.org>, Alexander Graf <graf@amazon.de>,
David Woodhouse <dwmw@amazon.co.uk>,
"the arch/x86 maintainers" <x86@kernel.org>,
Andy Lutomirski <luto@kernel.org>,
Peter Zijlstra <peterz@infradead.org>
Subject: Re: [RFC 00/10] Process-local memory allocations for hiding KVM secrets
Date: Wed, 12 Jun 2019 18:30:03 -0700 [thread overview]
Message-ID: <CALCETrXHbS9VXfZ80kOjiTrreM2EbapYeGp68mvJPbosUtorYA@mail.gmail.com> (raw)
In-Reply-To: <A542C98B-486C-4849-9DAC-2355F0F89A20@amacapital.net>
On Wed, Jun 12, 2019 at 1:27 PM Andy Lutomirski <luto@amacapital.net> wrote:
>
>
>
> > On Jun 12, 2019, at 12:55 PM, Dave Hansen <dave.hansen@intel.com> wrote:
> >
> >> On 6/12/19 10:08 AM, Marius Hillenbrand wrote:
> >> This patch series proposes to introduce a region for what we call
> >> process-local memory into the kernel's virtual address space.
> >
> > It might be fun to cc some x86 folks on this series. They might have
> > some relevant opinions. ;)
> >
> > A few high-level questions:
> >
> > Why go to all this trouble to hide guest state like registers if all the
> > guest data itself is still mapped?
> >
> > Where's the context-switching code? Did I just miss it?
> >
> > We've discussed having per-cpu page tables where a given PGD is only in
> > use from one CPU at a time. I *think* this scheme still works in such a
> > case, it just adds one more PGD entry that would have to context-switched.
>
> Fair warning: Linus is on record as absolutely hating this idea. He might change his mind, but it’s an uphill battle.
I looked at the patch, and it (sensibly) has nothing to do with
per-cpu PGDs. So it's in great shape!
Seriously, though, here are some very high-level review comments:
Please don't call it "process local", since "process" is meaningless.
Call it "mm local" or something like that.
We already have a per-mm kernel mapping: the LDT. So please nix all
the code that adds a new VA region, etc, except to the extent that
some of it consists of valid cleanups in and of itself. Instead,
please refactor the LDT code (arch/x86/kernel/ldt.c, mainly) to make
it use a more general "mm local" address range, and then reuse the
same infrastructure for other fancy things. The code that makes it
KASLR-able should be in its very own patch that applies *after* the
code that makes it all work so that, when the KASLR part causes a
crash, we can bisect it.
+ /*
+ * Faults in process-local memory may be caused by process-local
+ * addresses leaking into other contexts.
+ * tbd: warn and handle gracefully.
+ */
+ if (unlikely(fault_in_process_local(address))) {
+ pr_err("page fault in PROCLOCAL at %lx", address);
+ force_sig_fault(SIGSEGV, SEGV_MAPERR, (void __user *)address, current);
+ }
+
Huh? Either it's an OOPS or you shouldn't print any special
debugging. As it is, you're just blatantly leaking the address of the
mm-local range to malicious user programs.
Also, you should IMO consider using this mechanism for kmap_atomic().
Hi, Nadav!
next prev parent reply other threads:[~2019-06-13 16:56 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-12 17:08 [RFC 00/10] Process-local memory allocations for hiding KVM secrets Marius Hillenbrand
2019-06-12 17:08 ` [RFC 01/10] x86/mm/kaslr: refactor to use enum indices for regions Marius Hillenbrand
2019-06-12 17:08 ` [RFC 02/10] x86/speculation, mm: add process local virtual memory region Marius Hillenbrand
2019-06-12 17:08 ` [RFC 03/10] x86/mm, mm,kernel: add teardown for process-local memory to mm cleanup Marius Hillenbrand
2019-06-12 17:08 ` [RFC 04/10] mm: allocate virtual space for process-local memory Marius Hillenbrand
2019-06-12 17:08 ` [RFC 05/10] mm: allocate/release physical pages " Marius Hillenbrand
2019-06-12 17:08 ` [RFC 06/10] kvm/x86: add support for storing vCPU state in " Marius Hillenbrand
2019-06-12 17:08 ` [RFC 07/10] kvm, vmx: move CR2 context switch out of assembly path Marius Hillenbrand
2019-06-12 17:08 ` [RFC 08/10] kvm, vmx: move register clearing " Marius Hillenbrand
2019-06-12 17:08 ` [RFC 09/10] kvm, vmx: move gprs to process local memory Marius Hillenbrand
2019-06-12 17:08 ` [RFC 10/10] kvm, x86: move guest FPU state into " Marius Hillenbrand
2019-06-12 18:25 ` [RFC 00/10] Process-local memory allocations for hiding KVM secrets Sean Christopherson
2019-06-13 7:20 ` Alexander Graf
2019-06-13 10:54 ` Liran Alon
2019-06-12 19:55 ` Dave Hansen
2019-06-12 20:27 ` Andy Lutomirski
2019-06-12 20:41 ` Dave Hansen
2019-06-12 20:56 ` Andy Lutomirski
2019-06-13 1:30 ` Andy Lutomirski [this message]
2019-06-13 1:50 ` Nadav Amit
2019-06-13 16:16 ` Andy Lutomirski
2019-06-13 7:52 ` Alexander Graf
2019-06-13 16:13 ` Andy Lutomirski
2019-06-13 16:20 ` Dave Hansen
2019-06-13 17:29 ` Nadav Amit
2019-06-13 17:49 ` Dave Hansen
2019-06-13 20:05 ` Sean Christopherson
2019-06-14 14:21 ` Thomas Gleixner
2019-06-16 22:18 ` Andy Lutomirski
2019-06-16 22:28 ` Thomas Gleixner
2019-06-17 7:38 ` Alexander Graf
2019-06-17 15:50 ` Dave Hansen
2019-06-17 15:54 ` Andy Lutomirski
2019-06-17 16:03 ` Dave Hansen
2019-06-17 16:14 ` Andy Lutomirski
2019-06-17 16:53 ` Nadav Amit
2019-06-17 18:07 ` Dave Hansen
2019-06-17 18:45 ` Konrad Rzeszutek Wilk
2019-06-17 18:49 ` Dave Hansen
2019-06-17 18:53 ` Andy Lutomirski
2019-06-17 18:50 ` Nadav Amit
2019-06-17 18:55 ` Dave Hansen
2019-06-13 7:27 ` Alexander Graf
2019-06-13 14:19 ` Dave Hansen
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=CALCETrXHbS9VXfZ80kOjiTrreM2EbapYeGp68mvJPbosUtorYA@mail.gmail.com \
--to=luto@kernel.org \
--cc=dave.hansen@intel.com \
--cc=dwmw@amazon.co.uk \
--cc=graf@amazon.de \
--cc=kernel-hardening@lists.openwall.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhillenb@amazon.de \
--cc=namit@vmware.com \
--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;
as well as URLs for NNTP newsgroup(s).