KVM: arm64: Fix missing ESR_ELx.IL in syndrome injection
Status from this message: Applied to fixes, thanks!
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v2 Latest7 patches 9 repliesApplied
- v17 patches 10 repliesSuperseded
Patches in v2 Applied
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/7 | KVM: arm64: Set ESR_ELx.IL for injected undefined exceptions at EL2arch/ | +1 | 0 replies | |
| 2/7 | KVM: arm64: Unconditionally set IL for injected undefined exceptionsarch/ | +1 | 1 reply | |
| 3/7 | KVM: arm64: Unconditionally set IL for injected abort exceptionsarch/ | +3 | 1 reply | |
| 4/7 | KVM: arm64: Set IL for injected FPAC exceptions during ERET emulationarch/ | +1 | 3 replies | |
| 5/7 | KVM: arm64: Set IL for emulated SError injectionarch/ | +1 | 1 reply | |
| 6/7 | KVM: arm64: Set IL for nested SError injectionarch/ | +1 | 1 reply | |
| 7/7 | KVM: arm64: Set IL in fake ESR for pKVM memory sharing exitarch/ | +2 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.
Cover letter [PATCH v2 0/7] KVM: arm64: Fix missing ESR_ELx.IL in syndrome injection
Hi folks,
After sashiko caught the missing IL bug [1], I did an audit of all ESR syndrome construction sites in KVM/arm64 as Marc suggested. This series is the result of that audit.
The ARM architecture mandates ESR_ELx.IL=1 for several exception classes regardless of instruction length: EC=Unknown, Instruction Aborts, Data Aborts with ISV=0, and SError. For FPAC (EC=0x1C), IL reflects instruction length, but FPAC can only be generated by A64 instructions, so IL must also be 1.
Patch 1 is the bug sashiko found: inject_undef64() in the pKVM hyp (EL2) path never set IL. Patch 2 makes the same fix to inject_undef64() in the normal host path, where IL was derived from the triggering trap's instruction length. No instruction that reaches undef injection has a 16-bit encoding, so patch 2 has no functional change today. Patch 3 makes the matching fix to inject_abt64(). Unlike undef injection, abort injection is reachable from a 16-bit T32 instruction (a 32-bit EL0 task under an AArch64 EL1 guest), so the old code there injects an abort with IL=0.
Patch 4 fixes the FPAC syndrome constructed during nested ERET emulation, which did not set IL.
Patches 5-6 fix SError injection in the emulated and nested paths, neither of which set IL.
Patch 7 fixes a fake ESR used to exit to the host. The host does not read IL there, so it is not guest-visible.
Changes since v1 [2]:
- Patch 4: keep IL by masking it through from the trapped ERET's ESR instead of OR-ing the bit in. The ERET trap (EC=0x1A) always reports IL=1, so this preserves the source syndrome rather than adding the bit unconditionally (Marc).
- Rebased on v7.1.
Cheers,
/fuad
[1] https://lore.kernel.org/all/[email protected]/
[2] https://lore.kernel.org/all/[email protected]/
Fuad Tabba (7):
KVM: arm64: Set ESR_ELx.IL for injected undefined exceptions at EL2
KVM: arm64: Unconditionally set IL for injected undefined exceptions
KVM: arm64: Unconditionally set IL for injected abort exceptions
KVM: arm64: Set IL for injected FPAC exceptions during ERET emulation
KVM: arm64: Set IL for emulated SError injection
KVM: arm64: Set IL for nested SError injection
KVM: arm64: Set IL in fake ESR for pKVM memory sharing exit
arch/arm64/kvm/emulate-nested.c | 4 ++-- arch/arm64/kvm/hyp/nvhe/pkvm.c | 3 ++- arch/arm64/kvm/hyp/nvhe/sys_regs.c | 2 +- arch/arm64/kvm/inject_fault.c | 18 +++++------------- 4 files changed, 10 insertions(+), 17 deletions(-)
Signature · 1 line
2.54.0.1189.g8c84645362-goog