summaryrefslogtreecommitdiff
path: root/tools/perf/scripts/python/bin/stackcollapse-report
diff options
context:
space:
mode:
authorSean Christopherson <seanjc@google.com>2026-10-30 14:20:49 -0700
committerSean Christopherson <seanjc@google.com>2026-11-09 15:39:45 -0800
commit2520694e60489136300df56d157fb5e04051eea5 (patch)
treeb98d3d4b407bcf35e6354f05ed3719b244328789 /tools/perf/scripts/python/bin/stackcollapse-report
parent7475ea8b58616b33c04afb976cf0fbaad9dd63fb (diff)
KVM: Reject user accesses to guest memory if current->mm != kvm->mm
Reject user accesses to guest memory, which are supposed to be done only in the context of KVM_RUN or similar operations, if the current address space is not the VM's (host userspace) address space. If KVM writes to guest memory after the owning host process has exited, or if the VM is being destroyed in the context of a different process, then writing using the wrong address space will corrupt a different process' memory. Reject the access but don't WARN() or KVM_BUG_ON() event though attempting to access guest memory with a mismatched address space is a blatant KVM bug, because unfortunately KVM is buggy. On KVM VMX, when a vCPU is destroyed while L2 is active, KVM synthesizes a nested VM-Exit to force the vCPU out of L2 in order to free the nested VMX assets, and a side effect of a nested VM-Exit is that it flushes the cached shadow VMCS12 back to guest memory: vmx_vcpu_free() |-> nested_vmx_free_vcpu() |-> vmx_leave_nested() |-> nested_vmx_vmexit(vcpu, -1, 0, 0) |-> nested_flush_cached_shadow_vmcs12() |-> kvm_write_guest_cached() |-> __copy_to_user(ghc->hva, ...) Fix the bug broadly even though the "real" bug is that KVM abuses the nested VM-Exit flow for non-architectural purposes, as there may be other such violations lurking. For now, punt on fixing individual bugs and hardening the common flows, e.g. with WARNs. Opportunistically provide wrappers in anticipation of adding more checks and hardening, i.e. growing the logic beyond checking current->mm. Fixes: 61ada7488ffd ("KVM: nVMX: Cache shadow vmcs12 on VMEntry and flush to memory on VMExit") Cc: stable@vger.kernel.org Reported-by: Jim Mattson <jmattson@google.com> Closes: https://lore.kernel.org/all/20260908132838.2116068-1-jmattson@google.com Reviewed-by: James Houghton <jthoughton@google.com> Tested-by: syzbot@syzkaller.appspotmail.com Link: https://patch.msgid.link/20261030212112.2598640-2-seanjc@google.com Signed-off-by: Sean Christopherson <seanjc@google.com>
Diffstat (limited to 'tools/perf/scripts/python/bin/stackcollapse-report')
0 files changed, 0 insertions, 0 deletions