Commit 379c54e8 authored by Christian Borntraeger's avatar Christian Borntraeger Committed by Greg Kroah-Hartman

KVM: s390/mm: Fix storage key corruption during swapping

commit 3e03d4c4 upstream.

Since 3.12 or more precisely  commit 0944fe3f ("s390/mm:
implement software referenced bits") guest storage keys get
corrupted during paging. This commit added another valid->invalid
translation for page tables - namely ptep_test_and_clear_young.
We have to transfer the storage key into the pgste in that case.
Signed-off-by: default avatarChristian Borntraeger <borntraeger@de.ibm.com>
Acked-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent b44f41fa
...@@ -1115,7 +1115,7 @@ static inline int ptep_test_and_clear_young(struct vm_area_struct *vma, ...@@ -1115,7 +1115,7 @@ static inline int ptep_test_and_clear_young(struct vm_area_struct *vma,
unsigned long addr, pte_t *ptep) unsigned long addr, pte_t *ptep)
{ {
pgste_t pgste; pgste_t pgste;
pte_t pte; pte_t pte, oldpte;
int young; int young;
if (mm_has_pgste(vma->vm_mm)) { if (mm_has_pgste(vma->vm_mm)) {
...@@ -1123,12 +1123,13 @@ static inline int ptep_test_and_clear_young(struct vm_area_struct *vma, ...@@ -1123,12 +1123,13 @@ static inline int ptep_test_and_clear_young(struct vm_area_struct *vma,
pgste = pgste_ipte_notify(vma->vm_mm, ptep, pgste); pgste = pgste_ipte_notify(vma->vm_mm, ptep, pgste);
} }
pte = *ptep; oldpte = pte = *ptep;
ptep_flush_direct(vma->vm_mm, addr, ptep); ptep_flush_direct(vma->vm_mm, addr, ptep);
young = pte_young(pte); young = pte_young(pte);
pte = pte_mkold(pte); pte = pte_mkold(pte);
if (mm_has_pgste(vma->vm_mm)) { if (mm_has_pgste(vma->vm_mm)) {
pgste = pgste_update_all(&oldpte, pgste, vma->vm_mm);
pgste = pgste_set_pte(ptep, pgste, pte); pgste = pgste_set_pte(ptep, pgste, pte);
pgste_set_unlock(ptep, pgste); pgste_set_unlock(ptep, pgste);
} else } else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment