]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: x86: Fix BUILD_BUG() in __cpuid_entry_get_reg() w/ CONFIG_UBSAN=y
authorSean Christopherson <sean.j.christopherson@intel.com>
Wed, 25 Mar 2020 19:12:59 +0000 (12:12 -0700)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 31 Mar 2020 14:51:45 +0000 (10:51 -0400)
commit6cb771c6c61f09ab3fe02064395bb0337eaadee1
tree1b3419b6d27fe9f655ad6856713268b56d2e0f58
parentdb2b7ae5bbfe633a10d57bffba3e668595234cdb
KVM: x86: Fix BUILD_BUG() in __cpuid_entry_get_reg() w/ CONFIG_UBSAN=y

Take the target reg in __cpuid_entry_get_reg() instead of a pointer to a
struct cpuid_reg.  When building with -fsanitize=alignment (enabled by
CONFIG_UBSAN=y), some versions of gcc get tripped up on the pointer and
trigger the BUILD_BUG().

Reported-by: Randy Dunlap <rdunlap@infradead.org>
Fixes: a1bd380487895 ("KVM: x86: Do host CPUID at load time to mask KVM cpu caps")
Fixes: cc08dd0c7148f ("KVM: x86: Introduce cpuid_entry_{get,has}() accessors")
Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Message-Id: <20200325191259.23559-1-sean.j.christopherson@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/cpuid.c
arch/x86/kvm/cpuid.h