projects
/
profile
/
common
/
kernel-common.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
b716357
)
KVM: s390/mm: try a cow on read only pages for key ops
author
Christian Borntraeger
<borntraeger@de.ibm.com>
Tue, 19 Aug 2014 14:19:35 +0000
(16:19 +0200)
committer
Greg Kroah-Hartman
<gregkh@linuxfoundation.org>
Sun, 5 Oct 2014 21:52:17 +0000
(14:52 -0700)
commit
ab3f285f227fec62868037e9b1b1fd18294a83b8
upstream.
The PFMF instruction handler blindly wrote the storage key even if
the page was mapped R/O in the host. Lets try a COW before continuing
and bail out in case of errors.
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Reviewed-by: Dominik Dingel <dingel@linux.vnet.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/s390/mm/pgtable.c
patch
|
blob
|
history
diff --git
a/arch/s390/mm/pgtable.c
b/arch/s390/mm/pgtable.c
index
3584ed9
..
e309c5c
100644
(file)
--- a/
arch/s390/mm/pgtable.c
+++ b/
arch/s390/mm/pgtable.c
@@
-810,11
+810,21
@@
int set_guest_storage_key(struct mm_struct *mm, unsigned long addr,
pte_t *ptep;
down_read(&mm->mmap_sem);
+retry:
ptep = get_locked_pte(current->mm, addr, &ptl);
if (unlikely(!ptep)) {
up_read(&mm->mmap_sem);
return -EFAULT;
}
+ if (!(pte_val(*ptep) & _PAGE_INVALID) &&
+ (pte_val(*ptep) & _PAGE_PROTECT)) {
+ pte_unmap_unlock(*ptep, ptl);
+ if (fixup_user_fault(current, mm, addr, FAULT_FLAG_WRITE)) {
+ up_read(&mm->mmap_sem);
+ return -EFAULT;
+ }
+ goto retry;
+ }
new = old = pgste_get_lock(ptep);
pgste_val(new) &= ~(PGSTE_GR_BIT | PGSTE_GC_BIT |