linux/arch/s390/kvm
Claudio Imbrenda faa2f72cb3 KVM: s390: pv: leak the topmost page table when destroy fails
Each secure guest must have a unique ASCE (address space control
element); we must avoid that new guests use the same page for their
ASCE, to avoid errors.

Since the ASCE mostly consists of the address of the topmost page table
(plus some flags), we must not return that memory to the pool unless
the ASCE is no longer in use.

Only a successful Destroy Secure Configuration UVC will make the ASCE
reusable again.

If the Destroy Configuration UVC fails, the ASCE cannot be reused for a
secure guest (either for the ASCE or for other memory areas). To avoid
a collision, it must not be used again. This is a permanent error and
the page becomes in practice unusable, so we set it aside and leak it.
On failure we already leak other memory that belongs to the ultravisor
(i.e. the variable and base storage for a guest) and not leaking the
topmost page table was an oversight.

This error (and thus the leakage) should not happen unless the hardware
is broken or KVM has some unknown serious bug.

Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
Fixes: 29b40f105e ("KVM: s390: protvirt: Add initial vm and cpu lifecycle handling")
Reviewed-by: Janosch Frank <frankja@linux.ibm.com>
Link: https://lore.kernel.org/r/20220628135619.32410-2-imbrenda@linux.ibm.com
Message-Id: <20220628135619.32410-2-imbrenda@linux.ibm.com>
Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
2022-07-13 14:42:11 +00:00
..
diag.c KVM: s390: restore old debugfs names 2021-07-27 16:59:00 -04:00
gaccess.c KVM: s390: Don't indicate suppression on dirtying, failing memop 2022-05-20 16:38:42 +02:00
gaccess.h KVM: s390: Add vm IOCTL for key checked guest absolute memory access 2022-02-14 16:12:57 +01:00
guestdbg.c KVM: s390: Add memcg accounting to KVM allocations 2020-12-10 13:36:05 +01:00
intercept.c KVM: s390: Honor storage keys when accessing guest memory 2022-02-14 16:12:57 +01:00
interrupt.c KVM: s390: drop unexpected word 'and' in the comments 2022-07-11 11:29:51 +02:00
irq.h KVM: s390: Remove redundant license text 2017-12-06 09:18:42 +01:00
Kconfig KVM: Use interval tree to do fast hva lookup in memslots 2021-12-08 04:24:32 -05:00
kvm-s390.c KVM: s390/pci: enable zPCI for interpretive execution 2022-07-11 11:28:57 +02:00
kvm-s390.h KVM: s390/pci: enable zPCI for interpretive execution 2022-07-11 11:28:57 +02:00
Makefile KVM: s390: pci: add basic kvm_zdev structure 2022-07-11 09:54:27 +02:00
pci.c KVM: s390: add KVM_S390_ZPCI_OP to manage guest zPCI devices 2022-07-11 09:54:38 +02:00
pci.h KVM: s390/pci: fix include duplicates 2022-07-13 10:10:02 +02:00
priv.c s390/ptrace: move short psw definitions to ptrace header file 2022-05-06 20:45:15 +02:00
pv.c KVM: s390: pv: leak the topmost page table when destroy fails 2022-07-13 14:42:11 +00:00
sigp.c KVM: s390: Clarify SIGP orders versus STOP/RESTART 2021-12-17 14:52:47 +01:00
trace-s390.h
trace.h
vsie.c KVM: Add helpers to wrap vcpu->srcu_idx and yell if it's abused 2022-04-21 13:16:11 -04:00