Re: [RFC 23/37] KVM: s390: protvirt: Make sure prefix is always protected

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 24.10.19 13:40, Janosch Frank wrote:
Signed-off-by: Janosch Frank <frankja@xxxxxxxxxxxxx>
---
  arch/s390/kvm/kvm-s390.c | 9 +++++++++
  1 file changed, 9 insertions(+)

diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
index eddc9508c1b1..17a78774c617 100644
--- a/arch/s390/kvm/kvm-s390.c
+++ b/arch/s390/kvm/kvm-s390.c
@@ -3646,6 +3646,15 @@ static int kvm_s390_handle_requests(struct kvm_vcpu *vcpu)
  		rc = gmap_mprotect_notify(vcpu->arch.gmap,
  					  kvm_s390_get_prefix(vcpu),
  					  PAGE_SIZE * 2, PROT_WRITE);
+		if (!rc && kvm_s390_pv_is_protected(vcpu->kvm)) {
+			rc = uv_convert_to_secure(vcpu->arch.gmap,
+						  kvm_s390_get_prefix(vcpu));
+			WARN_ON_ONCE(rc && rc != -EEXIST);
+			rc = uv_convert_to_secure(vcpu->arch.gmap,
+						  kvm_s390_get_prefix(vcpu) + PAGE_SIZE);
+			WARN_ON_ONCE(rc && rc != -EEXIST);
+			rc = 0;
+		}

... what if userspace reads the prefix pages just after these calls? validity? :/

  		if (rc) {
  			kvm_make_request(KVM_REQ_MMU_RELOAD, vcpu);
  			return rc;


--

Thanks,

David / dhildenb





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Kernel Development]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Info]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Linux Media]     [Device Mapper]

  Powered by Linux