mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-27 14:43:58 +08:00
s390/kvm: simplify set_guest_storage_key
Git commitab3f285f22
"KVM: s390/mm: try a cow on read only pages for key ops" added a fixup_user_fault to set_guest_storage_key force a copy on write if the page is mapped read-only. This is supposed to fix the problem of differing storage keys for shared mappings, e.g. the empty_zero_page. But if the storage key is set before the pte is mapped the storage key update is done on the pgste. A later fault will happily map the shared page with the key from the pgste. Eventually git commit2faee8ff9d
"s390/mm: prevent and break zero page mappings in case of storage keys" fixed this problem for the empty_zero_page. The commit makes sure that guests enabled for storage keys will not use the empty_zero_page at all. As the call to fixup_user_fault in set_guest_storage_key depends on the order of the storage key operation vs. the fault that maps the pte it does not really fix anything. Just remove it. Reviewed-by: Dominik Dingel <dingel@linux.vnet.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
This commit is contained in:
parent
993e068108
commit
443a813304
@ -809,30 +809,13 @@ int set_guest_storage_key(struct mm_struct *mm, unsigned long addr,
|
||||
spinlock_t *ptl;
|
||||
pgste_t old, new;
|
||||
pte_t *ptep;
|
||||
bool unlocked;
|
||||
|
||||
down_read(&mm->mmap_sem);
|
||||
retry:
|
||||
unlocked = false;
|
||||
ptep = get_locked_pte(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);
|
||||
/*
|
||||
* We do not really care about unlocked. We will retry either
|
||||
* way. But this allows fixup_user_fault to enable userfaultfd.
|
||||
*/
|
||||
if (fixup_user_fault(current, mm, addr, FAULT_FLAG_WRITE,
|
||||
&unlocked)) {
|
||||
up_read(&mm->mmap_sem);
|
||||
return -EFAULT;
|
||||
}
|
||||
goto retry;
|
||||
}
|
||||
|
||||
new = old = pgste_get_lock(ptep);
|
||||
pgste_val(new) &= ~(PGSTE_GR_BIT | PGSTE_GC_BIT |
|
||||
|
Loading…
Reference in New Issue
Block a user