s390/pgtable: Unconditionally clear _PAGE_UNUSED
PATCH 1/1 s390/pgtable: Unconditionally clear _PAGE_UNUSED
When setting ptes with set_ptes(), unconditionally clear the _PAGE_UNUSED flag.
The flag has only sense when the pte is being unmapped to be swapped, it will be set by KVM when unmapping unused pages. Setting it in any other way does not make sense and can lead to guest corruption.
Fixes c98175b7917f ("KVM: s390: Add gmap_helper_set_unused()")
Signed-off-by Claudio Imbrenda <[email protected]>
--- arch/s390/include/asm/pgtable.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
arch/s390/include/asm/pgtable.h +1 -2
@@ -1332,8 +1332,7 @@ pgprot_t pgprot_writecombine(pgprot_t prot);static inline void set_ptes (struct mm_struct *mm,unsigned long addr,pte_t *ptep,pte_t entry,unsigned int nr) { -if (pte_present (entry)) - entry =clear_pte_bit (entry,__pgprot (_PAGE_UNUSED)); + entry =clear_pte_bit (entry,__pgprot (_PAGE_UNUSED));page_table_check_ptes_set (mm, addr, ptep, entry, nr);for (;;) {set_pte (ptep, entry);
Signature · 1 line
2.54.0