Patch "x86/mm: Fix __swp_entry_to_pte() for Xen PV guests" has been added to the 5.10-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    x86/mm: Fix __swp_entry_to_pte() for Xen PV guests

to the 5.10-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     x86-mm-fix-__swp_entry_to_pte-for-xen-pv-guests.patch
and it can be found in the queue-5.10 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 007fafcff383149f46dba3c47dc37afd7e29db32
Author: Juergen Gross <jgross@xxxxxxxx>
Date:   Mon Mar 6 13:32:59 2023 +0100

    x86/mm: Fix __swp_entry_to_pte() for Xen PV guests
    
    [ Upstream commit 0f88130e8a6fd185b0aeb5d8e286083735f2585a ]
    
    Normally __swp_entry_to_pte() is never called with a value translating
    to a valid PTE. The only known exception is pte_swap_tests(), resulting
    in a WARN splat in Xen PV guests, as __pte_to_swp_entry() did
    translate the PFN of the valid PTE to a guest local PFN, while
    __swp_entry_to_pte() doesn't do the opposite translation.
    
    Fix that by using __pte() in __swp_entry_to_pte() instead of open
    coding the native variant of it.
    
    For correctness do the similar conversion for __swp_entry_to_pmd().
    
    Fixes: 05289402d717 ("mm/debug_vm_pgtable: add tests validating arch helpers for core MM features")
    Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
    Signed-off-by: Borislav Petkov (AMD) <bp@xxxxxxxxx>
    Link: https://lore.kernel.org/r/20230306123259.12461-1-jgross@xxxxxxxx
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/arch/x86/include/asm/pgtable_64.h b/arch/x86/include/asm/pgtable_64.h
index 56d0399a0cd16..dd520b44e89cc 100644
--- a/arch/x86/include/asm/pgtable_64.h
+++ b/arch/x86/include/asm/pgtable_64.h
@@ -235,8 +235,8 @@ static inline void native_pgd_clear(pgd_t *pgd)
 
 #define __pte_to_swp_entry(pte)		((swp_entry_t) { pte_val((pte)) })
 #define __pmd_to_swp_entry(pmd)		((swp_entry_t) { pmd_val((pmd)) })
-#define __swp_entry_to_pte(x)		((pte_t) { .pte = (x).val })
-#define __swp_entry_to_pmd(x)		((pmd_t) { .pmd = (x).val })
+#define __swp_entry_to_pte(x)		(__pte((x).val))
+#define __swp_entry_to_pmd(x)		(__pmd((x).val))
 
 extern int kern_addr_valid(unsigned long addr);
 extern void cleanup_highmap(void);



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux