linux-stable/arch/s390/kvm
Sean Christopherson 32b758d12c KVM: s390: Ensure kvm_arch_no_poll() is read once when blocking vCPU
[ Upstream commit 6f390916c4 ]

Wrap s390's halt_poll_max_steal with READ_ONCE and snapshot the result of
kvm_arch_no_poll() in kvm_vcpu_block() to avoid a mostly-theoretical,
largely benign bug on s390 where the result of kvm_arch_no_poll() could
change due to userspace modifying halt_poll_max_steal while the vCPU is
blocking.  The bug is largely benign as it will either cause KVM to skip
updating halt-polling times (no_poll toggles false=>true) or to update
halt-polling times with a slightly flawed block_ns.

Note, READ_ONCE is unnecessary in the current code, add it in case the
arch hook is ever inlined, and to provide a hint that userspace can
change the param at will.

Fixes: 8b905d28ee ("KVM: s390: provide kvm_arch_no_poll function")
Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Sean Christopherson <seanjc@google.com>
Message-Id: <20211009021236.4122790-4-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-03-08 19:12:34 +01:00
..
diag.c KVM: s390: restore old debugfs names 2021-07-27 16:59:00 -04:00
gaccess.c KVM: s390: Function documentation fixes 2021-09-28 17:56:54 +02:00
gaccess.h KVM: s390: split kvm_s390_real_to_abs 2021-03-24 10:30:30 +01:00
guestdbg.c KVM: s390: Add memcg accounting to KVM allocations 2020-12-10 13:36:05 +01:00
intercept.c KVM: s390: Function documentation fixes 2021-09-28 17:56:54 +02:00
interrupt.c KVM: s390: Clarify SIGP orders versus STOP/RESTART 2022-01-20 09:13:14 +01:00
irq.h KVM: s390: Remove redundant license text 2017-12-06 09:18:42 +01:00
Kconfig treewide: replace '---help---' in Kconfig files with 'help' 2020-06-14 01:57:21 +09:00
kvm-s390.c KVM: s390: Ensure kvm_arch_no_poll() is read once when blocking vCPU 2022-03-08 19:12:34 +01:00
kvm-s390.h KVM: s390: Clarify SIGP orders versus STOP/RESTART 2022-01-20 09:13:14 +01:00
Makefile KVM: stats: Add fd-based API to read binary stats data 2021-06-24 11:47:57 -04:00
priv.c KVM: s390: Fix handle_sske page fault handling 2021-11-18 19:16:42 +01:00
pv.c KVM: s390: pv: avoid stalls for kvm_s390_pv_init_vm 2021-11-18 19:16:40 +01:00
sigp.c KVM: s390: Clarify SIGP orders versus STOP/RESTART 2022-01-20 09:13:14 +01:00
trace-s390.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
trace.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
vsie.c KVM: s390: Enable specification exception interpretation 2021-08-27 18:35:20 +02:00