Skip to content

Commit af0ebc4

Browse files
author
Martin Schwidefsky
committed
s390/mm,kvm: fix software dirty bits vs. kvm for old machines
For machines without enhanced supression on protection the software dirty bit code forces the pte dirty bit and clears the page protection bit in pgste_set_pte. This is done for all pte types, the check for present ptes is missing. As a result swap ptes and other not-present ptes can get corrupted. Add a check for the _PAGE_PRESENT bit to pgste_set_pte before modifying the pte value. Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
1 parent 1e52db6 commit af0ebc4

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

arch/s390/include/asm/pgtable.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -748,7 +748,9 @@ static inline void pgste_set_key(pte_t *ptep, pgste_t pgste, pte_t entry)
748748

749749
static inline void pgste_set_pte(pte_t *ptep, pte_t entry)
750750
{
751-
if (!MACHINE_HAS_ESOP && (pte_val(entry) & _PAGE_WRITE)) {
751+
if (!MACHINE_HAS_ESOP &&
752+
(pte_val(entry) & _PAGE_PRESENT) &&
753+
(pte_val(entry) & _PAGE_WRITE)) {
752754
/*
753755
* Without enhanced suppression-on-protection force
754756
* the dirty bit on for all writable ptes.

0 commit comments

Comments
 (0)