[PATCH 0/2] KVM: arm64: Fixes for SMC64 SYSTEM_RESET2 calls

Oliver Upton oupton at google.com
Fri Mar 18 12:38:29 PDT 2022


This series addresses a couple of issues with how KVM exposes SMC64
calls to its guest. It is currently possible for an AArch32 guest to
discover the SMC64 SYSTEM_RESET2 function (via
PSCI_1_0_FN_PSCI_FEATURES) and even make a call to it. SMCCC does not
allow for 64 bit calls to be made from a 32 bit state.

Patch 1 cleans up the way we filter SMC64 calls in PSCI. Using a switch
with case statements for each possibly-filtered function is asking for
trouble. Instead, pivot off of the bit that indicates the desired
calling convention. This plugs the PSCI_FEATURES hole for SYSTEM_RESET2.

Patch 2 adds a check to the PSCI v1.x call handler in KVM, bailing out
early if the guest is not allowed to use a particular function. This
closes the door on calls to 64-bit SYSTEM_RESET2 from AArch32.

My first crack at this [1] was missing the fix for direct calls to
SYSTEM_RESET2. Taking the patch out of that series and sending
separately.

Applies on top of today's kvmarm pull, commit:

  21ea45784275 ("KVM: arm64: fix typos in comments")

[1]: https://patchwork.kernel.org/project/kvm/patch/20220311174001.605719-3-oupton@google.com/

Oliver Upton (2):
  KVM: arm64: Generally disallow SMC64 for AArch32 guests
  KVM: arm64: Actually prevent SMC64 SYSTEM_RESET2 from AArch32

 arch/arm64/kvm/psci.c | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

-- 
2.35.1.894.gb6a874cedc-goog




More information about the linux-arm-kernel mailing list