From: Andi Kleen <ak@linux.intel.com>
To: speck@linutronix.de
Subject: [MODERATED] Re: [PATCH v5 1/8] L1TFv4 6
Date: Thu, 24 May 2018 08:26:09 -0700 [thread overview]
Message-ID: <20180524152609.GO4486@tassilo.jf.intel.com> (raw)
In-Reply-To: <70cc1acf-95a1-6de4-7bc8-46dfd54c686a@linux.intel.com>
> BTW, this reminds me: Let's say we trust guest kernels. Do we need KVM
> code to _prevent_ guests running in 32-bit non-PAE mode? Wouldn't any
> 32-bit non-PAE guest effectively have the ability to read the bottom
> ~4GB of host memory?
If you really trust the guest kernel you need to also trust it to not
use PAE.
If the host has full flush mitigations there is no need to trust
the host kernel, and it can even use PAE.
>
> If we don't trust guest kernels, then what is the point of this patch? :)
See below.
>
> Problem:
>
> This patch is intended to protect against a 32-bit unprivileged guest
> application using PROT_NONE on normal guest memory to attack host memory.
No, it does not protect host memory, it protects memory inside the guest.
This is explained in detail in the earlier patch:
>>>
Q: Why does the guest need to be protected when the
HyperVisor already has L1TF mitigations?
A: Here's an example:
You have physical pages 1 2. They get mapped into a guest as
GPA 1 -> PA 2
GPA 2 -> PA 1
through EPT.
The L1TF speculation ignores the EPT remapping.
Now the guest kernel maps GPA 1 to process A and GPA 2 to process B,
and they belong to different users and should be isolated.
A sets the GPA 1 PA 2 PTE to PROT_NONE to bypass the EPT remapping
and gets read access to the underlying physical page. Which
in this case points to PA 2, so it can read process B's data,
if it happened to be in L1.
So we broke isolation inside the guest.
There's nothing the hypervisor can do about this. This
mitigation has to be done in the guest.
<<<
>
> Background:
>
> 32-bit 'unsigned long' PFNs can only point to 44 bits of memory
> (32+PAGE_SHIFT). We enforce this via __PHYSICAL_PAGE_MASK, but
> unfortunately our L1TF workaround bits are also limited by
> __PHYSICAL_PAGE_MASK as well.
>
> Example:
>
> Imagine a 32-bit PAE PTE pointing to memory at guest physical address 1GB:
>
> 0x0000000040000067
>
> Then the attacker calls mprotect(PROT_NONE). We invert the PTE's
> physical address bits (and add _PAGE_PROT_NONE), but only those bits set
> in __PHYSICAL_PAGE_MASK. We get:
>
> 0x00000fffbffff100
These three paragraphs are correct and I can add them.
-Andi
next prev parent reply other threads:[~2018-05-24 15:26 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-23 21:51 [MODERATED] [PATCH v5 0/8] L1TFv4 5 Andi Kleen
2018-05-23 21:51 ` [MODERATED] [PATCH v5 1/8] L1TFv4 6 Andi Kleen
2018-05-23 21:51 ` [MODERATED] [PATCH v5 2/8] L1TFv4 7 Andi Kleen
2018-05-23 21:51 ` [MODERATED] [PATCH v5 3/8] L1TFv4 2 Andi Kleen
2018-05-23 21:51 ` [MODERATED] [PATCH v5 4/8] L1TFv4 8 Andi Kleen
2018-05-23 21:51 ` [MODERATED] [PATCH v5 5/8] L1TFv4 0 Andi Kleen
2018-05-23 21:51 ` [MODERATED] [PATCH v5 6/8] L1TFv4 4 Andi Kleen
2018-05-23 21:51 ` [MODERATED] [PATCH v5 7/8] L1TFv4 3 Andi Kleen
2018-05-23 21:51 ` [MODERATED] [PATCH v5 8/8] L1TFv4 1 Andi Kleen
[not found] ` <20180523215658.63CAB61104@crypto-ml.lab.linutronix.de>
2018-05-23 22:22 ` [MODERATED] Re: [PATCH v5 5/8] L1TFv4 0 Borislav Petkov
[not found] ` <20180523215726.A931B61157@crypto-ml.lab.linutronix.de>
2018-05-23 22:50 ` [MODERATED] Re: [PATCH v5 8/8] L1TFv4 1 Dave Hansen
[not found] ` <20180523215737.7C50E61169@crypto-ml.lab.linutronix.de>
2018-05-23 23:15 ` [MODERATED] Re: [PATCH v5 1/8] L1TFv4 6 Dave Hansen
2018-05-23 23:52 ` Andrew Cooper
2018-05-24 9:09 ` Michal Hocko
2018-05-24 15:26 ` Andi Kleen [this message]
2018-05-24 17:00 ` Dave Hansen
[not found] ` <20180523215136.EB16B610ED@crypto-ml.lab.linutronix.de>
2018-05-24 3:34 ` [MODERATED] Re: [PATCH v5 4/8] L1TFv4 8 Josh Poimboeuf
[not found] ` <20180523215651.BFF82610ED@crypto-ml.lab.linutronix.de>
2018-05-24 4:04 ` [MODERATED] Re: [PATCH v5 6/8] L1TFv4 4 Josh Poimboeuf
2018-05-24 13:35 ` Andi Kleen
2018-05-24 15:45 ` Josh Poimboeuf
2018-05-24 16:53 ` Andi Kleen
2018-05-24 17:53 ` Josh Poimboeuf
2018-05-24 20:32 ` Andi Kleen
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=20180524152609.GO4486@tassilo.jf.intel.com \
--to=ak@linux.intel.com \
--cc=speck@linutronix.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.