mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] KVM: Don't WARN on -EIO return from kvm_arch_vcpu_pre_fault_memory()
@ 2026-10-22  2:13 Sean Christopherson
  0 siblings, 0 replies; only message in thread
From: Sean Christopherson @ 2026-10-22  2:13 UTC (permalink / raw)
  To: Paolo Bonzini
  Cc: Sean Christopherson, kvm, linux-kernel, syzbot+db7bd0f41c2a7e82d4ba

Drop the WARN on arch code returning -EIO when pre-faulting memory, as the
WARN is user-triggerable and completely unwarranted.  In all likelihood,
the WARN was added due to a misinterpretation of review feedback, and was
overlooked in subsequent review rounds.

The WARN showed up in v5 of the original pre-faulting series without any
real explanation.  v5 did add -EIO as a documented error code[1]:

  v4->v5:
    - add EIO as possible error

in response to Xiaoyao's review[2]:

  > +   case RET_PF_CONTINUE:
  > +   case RET_PF_INVALID:
  > +   default:
  > +           WARN_ON_ONCE(r);
  > +           return -EIO;

  Need to update patch 1 for -EIO

  > +   }

but that review was just talking about the documentation.  And at the time,
KVM x86 already WARN()'d when returning -EIO, so having common KVM also
WARN() added no value, i.e. wasn't at all justified.

Link: https://lore.kernel.org/all/20240710174031.312055-1-pbonzini@redhat.com [1]
Link: https://lore.kernel.org/all/d5a6e125-bff4-4d82-ae65-b99d9cb10e90@intel.com [2]
Reported-by: syzbot+db7bd0f41c2a7e82d4ba@syzkaller.appspotmail.com
Closes: https://lore.kernel.org/all/6ac316c7.01314a6c.556a8.000d.GAE@google.com
Fixes: bc1a5cd00211 ("KVM: Add KVM_PRE_FAULT_MEMORY vcpu ioctl to pre-populate guest memory")
Cc: stable@vger.kernel.org
Tested-by: syzbot+db7bd0f41c2a7e82d4ba@syzkaller.appspotmail.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
---
 virt/kvm/kvm_main.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index a97aa5b92616..af13d689482b 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -4461,10 +4461,7 @@ static int kvm_vcpu_pre_fault_memory(struct kvm_vcpu *vcpu,
 		}
 
 		r = kvm_arch_vcpu_pre_fault_memory(vcpu, range);
-		if (WARN_ON_ONCE(r == 0 || r == -EIO))
-			break;
-
-		if (r < 0)
+		if (WARN_ON_ONCE(!r) || r < 0)
 			break;
 
 		range->size -= r;

base-commit: 814607cd40df80d5727957adaa857e0feca43497
-- 
2.56.0.218.g1ec904b173-goog


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-10-22  2:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-22  2:13 [PATCH] KVM: Don't WARN on -EIO return from kvm_arch_vcpu_pre_fault_memory() Sean Christopherson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®