diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2018-06-13 15:48:22 -0700 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2018-06-20 19:09:59 +0200 |
commit | bcd11afa7adad8d720e7ba5ef58bdcd9775cf45f (patch) | |
tree | 544a20dc4f36a1a69f39a4c982e7b6d46b80561b /drivers/watchdog/diag288_wdt.c | |
parent | 50896e180c6aa3a9c61a26ced99e15d602666a4c (diff) | |
download | blackbird-obmc-linux-bcd11afa7adad8d720e7ba5ef58bdcd9775cf45f.tar.gz blackbird-obmc-linux-bcd11afa7adad8d720e7ba5ef58bdcd9775cf45f.zip |
x86/speculation/l1tf: Change order of offset/type in swap entry
If pages are swapped out, the swap entry is stored in the corresponding
PTE, which has the Present bit cleared. CPUs vulnerable to L1TF speculate
on PTE entries which have the present bit set and would treat the swap
entry as phsyical address (PFN). To mitigate that the upper bits of the PTE
must be set so the PTE points to non existent memory.
The swap entry stores the type and the offset of a swapped out page in the
PTE. type is stored in bit 9-13 and offset in bit 14-63. The hardware
ignores the bits beyond the phsyical address space limit, so to make the
mitigation effective its required to start 'offset' at the lowest possible
bit so that even large swap offsets do not reach into the physical address
space limit bits.
Move offset to bit 9-58 and type to bit 59-63 which are the bits that
hardware generally doesn't care about.
That, in turn, means that if you on desktop chip with only 40 bits of
physical addressing, now that the offset starts at bit 9, there needs to be
30 bits of offset actually *in use* until bit 39 ends up being set, which
means when inverted it will again point into existing memory.
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 the limit of the offset is
hit (at 50 bits of offset - 62 bits of actual swap file coverage).
This is a preparatory change for the actual swap entry inversion to protect
against L1TF.
[ AK: Updated description and minor tweaks. Split into two parts ]
[ tglx: Massaged changelog ]
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Andi Kleen <ak@linux.intel.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Tested-by: Andi Kleen <ak@linux.intel.com>
Reviewed-by: Josh Poimboeuf <jpoimboe@redhat.com>
Acked-by: Michal Hocko <mhocko@suse.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Acked-by: Dave Hansen <dave.hansen@intel.com>
Diffstat (limited to 'drivers/watchdog/diag288_wdt.c')
0 files changed, 0 insertions, 0 deletions