[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240611102243.47904-1-pbonzini@redhat.com>
Date: Tue, 11 Jun 2024 06:22:43 -0400
From: Paolo Bonzini <pbonzini@...hat.com>
To: linux-kernel@...r.kernel.org,
kvm@...r.kernel.org
Cc: Isaku Yamahata <isaku.yamahata@...el.com>,
Michael Roth <michael.roth@....com>
Subject: [PATCH] KVM: interrupt kvm_gmem_populate() on signals
kvm_gmem_populate() is a potentially lengthy operation that can involve
multiple calls to the firmware. Interrupt it if a signal arrives.
Fixes: 1f6c06b177513 ("KVM: guest_memfd: Add interface for populating gmem pages with user data")
Cc: Isaku Yamahata <isaku.yamahata@...el.com>
Cc: Michael Roth <michael.roth@....com>
Signed-off-by: Paolo Bonzini <pbonzini@...hat.com>
---
virt/kvm/guest_memfd.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/virt/kvm/guest_memfd.c b/virt/kvm/guest_memfd.c
index 9714add38852..3bfe1824ec2d 100644
--- a/virt/kvm/guest_memfd.c
+++ b/virt/kvm/guest_memfd.c
@@ -629,6 +629,11 @@ long kvm_gmem_populate(struct kvm *kvm, gfn_t start_gfn, void __user *src, long
gfn_t gfn = start_gfn + i;
kvm_pfn_t pfn;
+ if (signal_pending(current)) {
+ ret = -EINTR;
+ break;
+ }
+
ret = __kvm_gmem_get_pfn(file, slot, gfn, &pfn, &max_order, false);
if (ret)
break;
--
2.43.0
Powered by blists - more mailing lists