]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: x86: smm: number of GPRs in the SMRAM image depends on the image format
authorMaxim Levitsky <mlevitsk@redhat.com>
Tue, 25 Oct 2022 12:47:32 +0000 (15:47 +0300)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 28 Oct 2022 10:10:30 +0000 (06:10 -0400)
commit36693a0bf44a0693be1cdac443c448a18175536a
treeb9b0ef36715305cf7aaec067d78ece54eca06a05
parent691365f6d0d42b2ca7698554e30bbe8333579e22
KVM: x86: smm: number of GPRs in the SMRAM image depends on the image format

On 64 bit host, if the guest doesn't have X86_FEATURE_LM, KVM will
access 16 gprs to 32-bit smram image, causing out-ouf-bound ram
access.

On 32 bit host, the rsm_load_state_64/enter_smm_save_state_64
is compiled out, thus access overflow can't happen.

Fixes: 772d3a86614517 ("KVM: x86: Reduce the number of emulator GPRs to '8' for 32-bit KVM")
Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
Reviewed-by: Sean Christopherson <seanjc@google.com>
Message-Id: <20221025124741.228045-15-mlevitsk@redhat.com>
Cc: stable@vger.kernel.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/emulate.c