All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vlastimil Babka <vbabka@suse.cz>
To: speck@linutronix.de
Subject: [MODERATED] Re: [PATCH 2/8] L1TFv3 7
Date: Mon, 7 May 2018 13:45:42 +0200	[thread overview]
Message-ID: <0dc117ab-d6f2-67e7-c36e-4ee97bd56922@suse.cz> (raw)
In-Reply-To: <1bef0e393f925379b76cb689bfb3fdbfc052e716.1525403858.git.ak@linux.intel.com>

[-- Attachment #1: Type: text/plain, Size: 2154 bytes --]

On 05/04/2018 05:23 AM, speck for Andi Kleen wrote:
> From: Linus Torvalds <torvalds@linux-foundation.org>
> Subject:  x86, l1tf: Protect swap entries against L1TF
> 
> With L1 terminal fault the CPU speculates into unmapped PTEs, and
> resulting side effects allow to read the memory the PTE is pointing
> too, if its values are still in the L1 cache.
> 
> For swapped out pages Linux uses unmapped PTEs and stores a swap entry
> into them.
> 
> We need to make sure the swap entry is not pointing to valid memory,
> which requires setting higher bits (between bit 36 and bit 45) that
> are inside the CPUs physical address space, but outside any real
> memory.
> 
> To do this we invert the offset to make sure the higher bits are always
> set, as long as the swap file is not too big.
> 
> Here's a patch that switches the order of "type" and
> "offset" in the x86-64 encoding, in addition to doing the binary 'not' on
> the offset.
> 
> That means that now the offset is bits 9-58 in the page table, and that
> the offset is in the bits that hardware generally doesn't care about.

      ^ type

> That, in turn, means that if you have a desktop chip with only 40 bits of
> physical addressing, now that the offset starts at bit 9, you still have
> to have 30 bits of offset actually *in use* until bit 39 ends up being
> clear.
> 
> So that's 4 terabyte of swap space (because the offset is counted in
> pages, so 30 bits of offset is 42 bits of actual coverage). With bigger
> physical addressing, that obviously grows further, until you hit the limit
> of the offset (at 50 bits of offset - 62 bits of actual swap file
> coverage).
> 
> Note there is no workaround for 32bit !PAE, or on systems which
> have more than MAX_PA/2 memory. The later case is very unlikely
> to happen on real systems.
> 
> [updated description and minor tweaks by AK]
> 
> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
> Signed-off-by: Andi Kleen <ak@linux.intel.com>
> Tested-by: Andi Kleen <ak@linux.intel.com>
> Acked-by: Michal Hocko <mhocko@suse.com>

Acked-by: Vlastimil Babka <vbabka@suse.cz>


  reply	other threads:[~2018-05-07 11:45 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-04  3:23 [MODERATED] [PATCH 0/8] L1TFv3 4 Andi Kleen
2018-05-04  3:23 ` [MODERATED] [PATCH 1/8] L1TFv3 8 Andi Kleen
2018-05-04 13:42   ` [MODERATED] " Michal Hocko
2018-05-04 14:07     ` Andi Kleen
2018-05-04  3:23 ` [MODERATED] [PATCH 2/8] L1TFv3 7 Andi Kleen
2018-05-07 11:45   ` Vlastimil Babka [this message]
2018-05-04  3:23 ` [MODERATED] [PATCH 3/8] L1TFv3 1 Andi Kleen
2018-05-04  3:55   ` [MODERATED] " Linus Torvalds
2018-05-04 13:42   ` Michal Hocko
2018-05-07 12:38   ` Vlastimil Babka
2018-05-07 13:41     ` Andi Kleen
2018-05-07 18:01       ` Thomas Gleixner
2018-05-07 18:21         ` [MODERATED] " Andi Kleen
2018-05-07 20:03           ` Thomas Gleixner
2018-05-04  3:23 ` [MODERATED] [PATCH 4/8] L1TFv3 6 Andi Kleen
2018-05-04  3:23 ` [MODERATED] [PATCH 5/8] L1TFv3 2 Andi Kleen
2018-05-04  3:23 ` [MODERATED] [PATCH 6/8] L1TFv3 0 Andi Kleen
2018-05-04  3:23 ` [MODERATED] [PATCH 7/8] L1TFv3 5 Andi Kleen
2018-05-04 13:43   ` [MODERATED] " Michal Hocko
2018-05-04 14:11     ` Andi Kleen
2018-05-04 14:21       ` Michal Hocko
2018-05-04  3:23 ` [MODERATED] [PATCH 8/8] L1TFv3 3 Andi Kleen
2018-05-04 14:19   ` [MODERATED] " Andi Kleen
2018-05-04 14:34     ` Michal Hocko
2018-05-04 15:53       ` Andi Kleen
2018-05-04 16:26         ` Michal Hocko
2018-05-04 22:15   ` Dave Hansen
2018-05-05  3:55     ` Andi Kleen
2018-05-04  3:54 ` [MODERATED] Re: [PATCH 0/8] L1TFv3 4 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=0dc117ab-d6f2-67e7-c36e-4ee97bd56922@suse.cz \
    --to=vbabka@suse.cz \
    --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.