mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: Sean Christopherson <seanjc@google.com>,
	kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
	 syzbot+db7bd0f41c2a7e82d4ba@syzkaller.appspotmail.com
Subject: [PATCH] KVM: Don't WARN on -EIO return from kvm_arch_vcpu_pre_fault_memory()
Date: Wed, 21 Oct 2026 19:13:49 -0700	[thread overview]
Message-ID: <20261022021349.296149-1-seanjc@google.com> (raw)

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


                 reply	other threads:[~2026-10-22  2:13 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261022021349.296149-1-seanjc@google.com \
    --to=seanjc@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=syzbot+db7bd0f41c2a7e82d4ba@syzkaller.appspotmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®