aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuergen Gross <jgross@suse.com>2018-08-21 11:37:54 -0400
committerBoris Ostrovsky <boris.ostrovsky@oracle.com>2018-08-27 09:31:26 -0400
commitf7c90c2aa4004808dff777ba6ae2c7294dd06851 (patch)
tree73c9a3d2b1daf567501a9cc0eaad622607e36a32
parent75f2d3a0cef5cd8cd41772c9f8ada37dee9c9369 (diff)
x86/xen: don't write ptes directly in 32-bit PV guests
In some cases 32-bit PAE PV guests still write PTEs directly instead of using hypercalls. This is especially bad when clearing a PTE as this is done via 32-bit writes which will produce intermediate L1TF attackable PTEs. Change the code to use hypercalls instead. Signed-off-by: Juergen Gross <jgross@suse.com> Reviewed-by: Jan Beulich <jbeulich@suse.com> Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
-rw-r--r--arch/x86/xen/mmu_pv.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/arch/x86/xen/mmu_pv.c b/arch/x86/xen/mmu_pv.c
index 9e7012858420..9396b4d17064 100644
--- a/arch/x86/xen/mmu_pv.c
+++ b/arch/x86/xen/mmu_pv.c
@@ -434,14 +434,13 @@ static void xen_set_pud(pud_t *ptr, pud_t val)
434static void xen_set_pte_atomic(pte_t *ptep, pte_t pte) 434static void xen_set_pte_atomic(pte_t *ptep, pte_t pte)
435{ 435{
436 trace_xen_mmu_set_pte_atomic(ptep, pte); 436 trace_xen_mmu_set_pte_atomic(ptep, pte);
437 set_64bit((u64 *)ptep, native_pte_val(pte)); 437 __xen_set_pte(ptep, pte);
438} 438}
439 439
440static void xen_pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) 440static void xen_pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
441{ 441{
442 trace_xen_mmu_pte_clear(mm, addr, ptep); 442 trace_xen_mmu_pte_clear(mm, addr, ptep);
443 if (!xen_batched_set_pte(ptep, native_make_pte(0))) 443 __xen_set_pte(ptep, native_make_pte(0));
444 native_pte_clear(mm, addr, ptep);
445} 444}
446 445
447static void xen_pmd_clear(pmd_t *pmdp) 446static void xen_pmd_clear(pmd_t *pmdp)
@@ -1569,7 +1568,7 @@ static void __init xen_set_pte_init(pte_t *ptep, pte_t pte)
1569 pte = __pte_ma(((pte_val_ma(*ptep) & _PAGE_RW) | ~_PAGE_RW) & 1568 pte = __pte_ma(((pte_val_ma(*ptep) & _PAGE_RW) | ~_PAGE_RW) &
1570 pte_val_ma(pte)); 1569 pte_val_ma(pte));
1571#endif 1570#endif
1572 native_set_pte(ptep, pte); 1571 __xen_set_pte(ptep, pte);
1573} 1572}
1574 1573
1575/* Early in boot, while setting up the initial pagetable, assume 1574/* Early in boot, while setting up the initial pagetable, assume