[UBUNTU 20.04] KVM: PV: ext call delivered twice when receiver in PSW wait
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Ubuntu on IBM z Systems |
Fix Released
|
Medium
|
Skipper Bug Screeners | ||
linux (Ubuntu) |
Invalid
|
Undecided
|
Unassigned | ||
Focal |
Fix Released
|
Medium
|
Canonical Kernel Team |
Bug Description
SRU Justification:
==================
[Impact]
* In a secure execution guest, the external interrupt for the SIGP
external call order is delivered twice to a VCPU even though it was
only sent once.
* Under PV (protected virtualization), external call interrupts are
delivered by the SIGP interpretation facility, without KVM's
involvement.
But, if the receiving CPU is in enabled wait, KVM needs to wake the
receiving CPU such that the interrupt can be delivered.
Hence, in this case, the SIGP external call order causes
an interception.
* In response, KVM only needs to wake the receiving VCPU.
Interrupt delivery is then handled by the SIGP interpretation facility.
* KVM wrongly assumed it also needs to request injection for the
external call interrupt after the respective intercept, causing the
interrupt to be delivered twice:
* once through the SIGP interpretation facility
* and once through the interrupt injection control by KVM.
* Solution is to add appropriate special handling for 108 external
call intercepts.
[Fix]
* c3f0e5fd2d33 c3f0e5fd2d33d80
"KVM: s390: pv: don't present the ecall interrupt twice"
[Test Case]
* Have an Secure Execution (PV) environment setup on an
IBM z15 or LinuxONE III LPAR using Ubuntu Server 20.04 (latest).
* Apply kvm-unit-test submitted upstream:
"[kvm-unit-tests PATCH v1 0/4] s390x: add tests for SIGP call \
orders in enabled wait"
* Run the smp_PV kvm-unit-test: ./run_tests.sh smp_PV
* Check logs/smp_PV.log.
If system is affected, the following line can be found:
"ABORT: smp: psw wait: ecall: Unexpected external call interrupt \
(code 0x1202): on cpu 1 at 0x11958"
* If the system is not affected, the line should look like this:
"PASS: smp: psw wait: ecall: received"
[Regression Potential / What can go wrong]
* The handle_
in case 'ret' is not handled correctly.
* trace_kvm_
now after the if condition.
* In worst case the external interrupt could not be delivered
at all or still too often.
[Other]
* The fix/patch c3f0e5fd2d33 got upstream accepted with kernel v6.0,
so it not only needs to be applied to 20.04/5.4, but also to 22.04/5.15
and 22.10/5.19.
* But the patch got properly tagged for upstream stable:
Cc: <email address hidden> # 5.7
Fixes: da24a0cc58ed ("KVM: s390: protvirt: Instruction emulation")
* And with that it got already picked up and is included in:
22.04 with Ubuntu-5.15.0-53.59 (currently in jammy-proposed)
22.10 with Ubuntu-5.19.0-16.16 means incl. in the release kernel.
* So the only Ubuntu release that is affected is 20.04/focal.
__________
Description: KVM: PV: ext call delivered twice when receiver in PSW wait
Symptom: In a secure execution guest, the external interrupt for the
SIGP external call order is delivered twice to a VCPU even
Problem: Under PV, external call interrupts are delivered by the SIGP
in this case, the SIGP external call order causes an
KVM wrongfuly assumed it also needs to request injection for the
the interrupt to be delivered twice: once through the SIGP
Solution: Add appropriate special handling for 108 external call
Reproduction: 0. Apply kvm-unit-test submitted upstream
1. Run the smp_PV kvm-unit-test:
2. Check logs/smp_PV.log. If system is affected, the following
Preventive: yes
Author: Nico Boehr <email address hidden>
Component: kernel
tags: | added: architecture-s39064 bugnameltc-199408 severity-medium targetmilestone-inin--- |
Changed in ubuntu: | |
assignee: | nobody → Skipper Bug Screeners (skipper-screen-team) |
affects: | ubuntu → linux (Ubuntu) |
description: | updated |
description: | updated |
Changed in linux (Ubuntu Focal): | |
status: | In Progress → Fix Committed |
Changed in ubuntu-z-systems: | |
status: | In Progress → Fix Committed |
tags: |
added: targetmilestone-inin2004 removed: targetmilestone-inin--- |
Changed in ubuntu-z-systems: | |
status: | Fix Committed → Fix Released |
tags: |
added: verification-done-focal removed: verification-needed-focal |
tags: |
added: verification-done-focal removed: verification-needed-focal |
------- Comment From <email address hidden> 2022-11-08 05:32 EDT------- c5a5a8b5e5d2bab 2841709cc8 /git.kernel. org/pub/ scm/linux/ kernel/ git/torvalds/ linux.git/ commit/ ?id=c3f0e5fd2d3 3d80c5a5a8b5e5d 2bab2841709cc8
Fix is upstream available:
Upstream-ID: c3f0e5fd2d33d80
Link: https:/