Re: [PATCH v2 01/10] KVM: Reject user accesses to guest memory if current->mm != kvm->mm

From: James Houghton

Date: Thu Oct 01 2026 - 17:29:08 EST


On Thu, Oct 1, 2026 at 2:18 PM Sean Christopherson <seanjc@xxxxxxxxxx> wrote:
>
> On Thu, Oct 01, 2026, James Houghton wrote:
> > I wonder if it makes sense to add similar hardening to kvm_faultin_pfn().
> > What do you think?
>
> I'm not opposed to explicitly hardening kvm_faultin_pfn(), but I don't think it
> would add much value in practice. Far more arch code uses __kvm_faultin_pfn()
> directly, and that doesn't have a @vcpu or @vm pointer to do the check. We could
> obviously "fix" that, but nuking the memslots (patches 3-5) will prevent all but
> the most ridiculous bugs. Getting anywhere near __kvm_faultin_pfn() with the
> wrong mm would either mean KVM is doing something amazingly stupid during VM
> teardown, or I guess maybe the scheduler or preempt notifiers went off the rails?

Yeah, fair enough. It would be of pretty limited benefit. Thanks.