* [PATCH v1 1/1] s390/pgtable: Unconditionally clear _PAGE_UNUSED
@ 2026-06-12 14:50 Claudio Imbrenda
0 siblings, 0 replies; only message in thread
From: Claudio Imbrenda @ 2026-06-12 14:50 UTC (permalink / raw)
To: linux-kernel
Cc: kvm, linux-s390, borntraeger, frankja, david, seiden, nrb,
schlameuss, gra, hca, gerald.schaefer, gor, agordeev, svens
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 <imbrenda@linux.ibm.com>
---
arch/s390/include/asm/pgtable.h | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/arch/s390/include/asm/pgtable.h b/arch/s390/include/asm/pgtable.h
index 2c6cee8241e0..9174aa02b699 100644
--- a/arch/s390/include/asm/pgtable.h
+++ b/arch/s390/include/asm/pgtable.h
@@ -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);
--
2.54.0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-06-12 14:50 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-12 14:50 [PATCH v1 1/1] s390/pgtable: Unconditionally clear _PAGE_UNUSED Claudio Imbrenda
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®