KVM: x86: Don't WARN if userspace mucks with RCX during string I/O exit

Replace a WARN with a comment to call out that userspace can modify RCX
during an exit to userspace to handle string I/O. KVM doesn't actually
support changing the rep count during an exit, i.e. the scenario can be
ignored, but the WARN needs to go as it's trivial to trigger from
userspace.

Cc: stable@vger.kernel.org
Fixes: 3b27de271839 ("KVM: x86: split the two parts of emulator_pio_in")
Signed-off-by: Sean Christopherson <seanjc@google.com>
Message-Id: <20211025201311.1881846-2-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

authored by Sean Christopherson and committed by Paolo Bonzini d07898ea 777ab82d

+7 -2
+7 -2
arch/x86/kvm/x86.c
··· 7122 7122 unsigned short port, void *val, unsigned int count) 7123 7123 { 7124 7124 if (vcpu->arch.pio.count) { 7125 - /* Complete previous iteration. */ 7125 + /* 7126 + * Complete a previous iteration that required userspace I/O. 7127 + * Note, @count isn't guaranteed to match pio.count as userspace 7128 + * can modify ECX before rerunning the vCPU. Ignore any such 7129 + * shenanigans as KVM doesn't support modifying the rep count, 7130 + * and the emulator ensures @count doesn't overflow the buffer. 7131 + */ 7126 7132 } else { 7127 7133 int r = __emulator_pio_in(vcpu, size, port, count); 7128 7134 if (!r) ··· 7137 7131 /* Results already available, fall through. */ 7138 7132 } 7139 7133 7140 - WARN_ON(count != vcpu->arch.pio.count); 7141 7134 complete_emulator_pio_in(vcpu, val); 7142 7135 return 1; 7143 7136 }