diff options
| author | Zeng Chi <zengchi@kylinos.cn> | 2026-08-27 19:22:00 +0800 |
|---|---|---|
| committer | Sean Christopherson <seanjc@google.com> | 2026-09-11 15:41:56 -0700 |
| commit | 7d2a727f44d833c5f5771e61fc721359f01a0b6f (patch) | |
| tree | 2bd05471672a245ce3519f1973b99d78e959a383 /tools/perf/scripts/python/parallel-perf.py | |
| parent | d4b7fb647204f0c81dfeae2d1a708e4d858e0c94 (diff) | |
KVM: Mask off the address space ID in kvm_set_internal_memslot() check
kvm_set_internal_memslot() is supposed to reject memslot IDs that belong
to userspace, i.e. IDs below KVM_USER_MEM_SLOTS, but it compares the raw
"slot" field, which packs both the address space ID and the memslot ID
(as_id << 16 | id). For any address space other than 0, the packed value
is always >= 65536, which is larger than KVM_USER_MEM_SLOTS, and so the
sanity check is a nop regardless of the actual memslot ID.
E.g. x86 sets internal memslots for every address space, including SMM,
so the check would silently accept a userspace memslot ID for the SMM
address space while rejecting the same ID for the normal address space.
Extract the memslot ID the same way kvm_vm_ioctl_set_memory_region() and
kvm_set_memory_region() do, so that the check covers all address spaces.
No in-tree caller trips the check; this only makes the sanity check
effective for all address spaces.
Fixes: 156bffdb2b49 ("KVM: Add a dedicated API for setting KVM-internal memslots")
Signed-off-by: Zeng Chi <zengchi@kylinos.cn>
Link: https://patch.msgid.link/20260827112200.866476-1-zeng_chi911@163.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
Diffstat (limited to 'tools/perf/scripts/python/parallel-perf.py')
0 files changed, 0 insertions, 0 deletions
