Re: [PATCH] KVM: Protect vcpu->pid dereference via debugfs with RCU

From: Sean Christopherson
Date: Thu Jun 01 2023 - 21:21:40 EST


On Sat, 11 Feb 2023 01:07:19 +0000, Sean Christopherson wrote:
> Wrap the vcpu->pid dereference in the debugfs hook vcpu_get_pid() with
> proper RCU read (un)lock. Unlike the code in kvm_vcpu_ioctl(),
> vcpu_get_pid() is not a simple access; the pid pointer is passed to
> pid_nr() and fully dereferenced if the pointer is non-NULL.
>
> Failure to acquire RCU could result in use-after-free of the old pid if
> a different task invokes KVM_RUN and puts the last reference to the old
> vcpu->pid between vcpu_get_pid() reading the pointer and dereferencing it
> in pid_nr().
>
> [...]

Applied to kvm-x86 generic, thanks!

[1/1] KVM: Protect vcpu->pid dereference via debugfs with RCU
https://github.com/kvm-x86/linux/commit/76021e96d781

--
https://github.com/kvm-x86/linux/tree/next
https://github.com/kvm-x86/linux/tree/fixes