]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
KVM: SEV: Disallow pinning more pages than exist in the system
authorSean Christopherson <seanjc@google.com>
Fri, 13 Mar 2026 00:33:00 +0000 (17:33 -0700)
committerSean Christopherson <seanjc@google.com>
Fri, 3 Apr 2026 16:37:25 +0000 (09:37 -0700)
commit6d71f9349d9bf09bf82309bdc46704b4b6f6b314
treec3614b0a639e94a67bf669b0a2df7f2a58b87f33
parent12a8ff869ddc284f95fe111ababab166b05e1c57
KVM: SEV: Disallow pinning more pages than exist in the system

Explicitly disallow pinning more pages for an SEV VM than exist in the
system to defend against absurd userspace requests without relying on
somewhat arbitrary kernel functionality to prevent truly stupid KVM
behavior.  E.g. even with the INT_MAX check, userspace can request that
KVM pin nearly 8TiB of memory, regardless of how much RAM exists in the
system.

Opportunistically rename "locked" to a more descriptive "total_npages".

Reviewed-by: Liam Merwick <liam.merwick@oracle.com>
Tested-by: Liam Merwick <liam.merwick@oracle.com>
Link: https://patch.msgid.link/20260313003302.3136111-4-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
arch/x86/kvm/svm/sev.c