]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commit
KVM: x86: Add more protection against undefined behavior in rsvd_bits()
authorSean Christopherson <seanjc@google.com>
Wed, 13 Jan 2021 20:45:15 +0000 (12:45 -0800)
committerPaolo Bonzini <pbonzini@redhat.com>
Mon, 25 Jan 2021 23:52:06 +0000 (18:52 -0500)
commiteb79cd00ce25974c21f34f1eeb92a580ff572971
tree49e1ba395906d96346e471dd430d76d8fdd1a744
parenta10f373ad3c760dd40b41e2f69a800ee7b8da15e
KVM: x86: Add more protection against undefined behavior in rsvd_bits()

Add compile-time asserts in rsvd_bits() to guard against KVM passing in
garbage hardcoded values, and cap the upper bound at '63' for dynamic
values to prevent generating a mask that would overflow a u64.

Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Sean Christopherson <seanjc@google.com>
Message-Id: <20210113204515.3473079-1-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/mmu.h