Skip to content

Commit f7c90c2

Browse files
jgross1Boris Ostrovsky
authored andcommitted
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 <[email protected]> Reviewed-by: Jan Beulich <[email protected]> Signed-off-by: Boris Ostrovsky <[email protected]>
1 parent 75f2d3a commit f7c90c2

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

arch/x86/xen/mmu_pv.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -434,14 +434,13 @@ static void xen_set_pud(pud_t *ptr, pud_t val)
434434
static void xen_set_pte_atomic(pte_t *ptep, pte_t pte)
435435
{
436436
trace_xen_mmu_set_pte_atomic(ptep, pte);
437-
set_64bit((u64 *)ptep, native_pte_val(pte));
437+
__xen_set_pte(ptep, pte);
438438
}
439439

440440
static void xen_pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
441441
{
442442
trace_xen_mmu_pte_clear(mm, addr, ptep);
443-
if (!xen_batched_set_pte(ptep, native_make_pte(0)))
444-
native_pte_clear(mm, addr, ptep);
443+
__xen_set_pte(ptep, native_make_pte(0));
445444
}
446445

447446
static void xen_pmd_clear(pmd_t *pmdp)
@@ -1569,7 +1568,7 @@ static void __init xen_set_pte_init(pte_t *ptep, pte_t pte)
15691568
pte = __pte_ma(((pte_val_ma(*ptep) & _PAGE_RW) | ~_PAGE_RW) &
15701569
pte_val_ma(pte));
15711570
#endif
1572-
native_set_pte(ptep, pte);
1571+
__xen_set_pte(ptep, pte);
15731572
}
15741573

15751574
/* Early in boot, while setting up the initial pagetable, assume

0 commit comments

Comments
 (0)