Skip to content

Commit 13b23cc

Browse files
jgross1gregkh
authored andcommitted
x86/xen: don't write ptes directly in 32-bit PV guests
commit f7c90c2 upstream. 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]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent d85c299 commit 13b23cc

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
@@ -425,14 +425,13 @@ static void xen_set_pud(pud_t *ptr, pud_t val)
425425
static void xen_set_pte_atomic(pte_t *ptep, pte_t pte)
426426
{
427427
trace_xen_mmu_set_pte_atomic(ptep, pte);
428-
set_64bit((u64 *)ptep, native_pte_val(pte));
428+
__xen_set_pte(ptep, pte);
429429
}
430430

431431
static void xen_pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
432432
{
433433
trace_xen_mmu_pte_clear(mm, addr, ptep);
434-
if (!xen_batched_set_pte(ptep, native_make_pte(0)))
435-
native_pte_clear(mm, addr, ptep);
434+
__xen_set_pte(ptep, native_make_pte(0));
436435
}
437436

438437
static void xen_pmd_clear(pmd_t *pmdp)
@@ -1543,7 +1542,7 @@ static void __init xen_set_pte_init(pte_t *ptep, pte_t pte)
15431542
pte = __pte_ma(((pte_val_ma(*ptep) & _PAGE_RW) | ~_PAGE_RW) &
15441543
pte_val_ma(pte));
15451544
#endif
1546-
native_set_pte(ptep, pte);
1545+
__xen_set_pte(ptep, pte);
15471546
}
15481547

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

0 commit comments

Comments
 (0)