aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorMartin Schwidefsky <schwidefsky@de.ibm.com>2013-10-07 16:15:29 +0200
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2013-10-15 13:47:57 +0200
commitaf0ebc40a81c694ad25f034383c13a233c4a2f55 (patch)
treeffb3ad6513106ae0c0a4d5f8d2f85bbcf35d4c54 /arch
parentMerge tag 'vfio-v3.12-rc5' of git://github.com/awilliam/linux-vfio (diff)
downloadlinux-dev-af0ebc40a81c694ad25f034383c13a233c4a2f55.tar.xz
linux-dev-af0ebc40a81c694ad25f034383c13a233c4a2f55.zip
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>
Diffstat (limited to 'arch')
-rw-r--r--arch/s390/include/asm/pgtable.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/arch/s390/include/asm/pgtable.h b/arch/s390/include/asm/pgtable.h
index 9b60a36c348d..2204400d0bd5 100644
--- a/arch/s390/include/asm/pgtable.h
+++ b/arch/s390/include/asm/pgtable.h
@@ -748,7 +748,9 @@ static inline void pgste_set_key(pte_t *ptep, pgste_t pgste, pte_t entry)
static inline void pgste_set_pte(pte_t *ptep, pte_t entry)
{
- if (!MACHINE_HAS_ESOP && (pte_val(entry) & _PAGE_WRITE)) {
+ if (!MACHINE_HAS_ESOP &&
+ (pte_val(entry) & _PAGE_PRESENT) &&
+ (pte_val(entry) & _PAGE_WRITE)) {
/*
* Without enhanced suppression-on-protection force
* the dirty bit on for all writable ptes.