summaryrefslogtreecommitdiff
path: root/arch/arm64
diff options
context:
space:
mode:
authorOliver Upton <oliver.upton@linux.dev>2024-10-25 18:23:41 +0000
committerOliver Upton <oliver.upton@linux.dev>2024-10-31 19:00:39 +0000
commit18aeeeb57b93f5038ad9b1bac2102640e786b1d1 (patch)
tree63f68e3974a63cd73fd5297ed8bb20ef60a869d9 /arch/arm64
parenteb609638da5578c59fd28baf9825f1dd19b61d7a (diff)
downloadlwn-18aeeeb57b93f5038ad9b1bac2102640e786b1d1.tar.gz
lwn-18aeeeb57b93f5038ad9b1bac2102640e786b1d1.zip
KVM: arm64: nv: Allow coarse-grained trap combos to use complex traps
KVM uses a sanity-check to avoid infinite recursion in trap combinations that could potentially depend on itself. Narrow the scope of this sanity check to the exact CGT IDs that correspond w/ trap combos, opening the door to using 'complex' traps as part of a combination. Reviewed-by: Marc Zyngier <maz@kernel.org> Link: https://lore.kernel.org/r/20241025182354.3364124-7-oliver.upton@linux.dev Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
Diffstat (limited to 'arch/arm64')
-rw-r--r--arch/arm64/kvm/emulate-nested.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/arch/arm64/kvm/emulate-nested.c b/arch/arm64/kvm/emulate-nested.c
index 05b6435d02a9..da7ab14e036d 100644
--- a/arch/arm64/kvm/emulate-nested.c
+++ b/arch/arm64/kvm/emulate-nested.c
@@ -2021,7 +2021,8 @@ check_mcb:
cgids = coarse_control_combo[id - __MULTIPLE_CONTROL_BITS__];
for (int i = 0; cgids[i] != __RESERVED__; i++) {
- if (cgids[i] >= __MULTIPLE_CONTROL_BITS__) {
+ if (cgids[i] >= __MULTIPLE_CONTROL_BITS__ &&
+ cgids[i] < __COMPLEX_CONDITIONS__) {
kvm_err("Recursive MCB %d/%d\n", id, cgids[i]);
ret = -EINVAL;
}