提交 f40606b1 编写于 作者: R Radim Krčmář 提交者: Paolo Bonzini

KVM: x86: handle SMBASE as physical address in RSM

GET_SMSTATE depends on real mode to ensure that smbase+offset is treated
as a physical address, which has already caused a bug after shuffling
the code.  Enforce physical addressing.
Signed-off-by: NRadim Krčmář <rkrcmar@redhat.com>
Reported-by: NLaszlo Ersek <lersek@redhat.com>
Tested-by: NLaszlo Ersek <lersek@redhat.com>
Cc: stable@vger.kernel.org
Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
上级 7a036a6f
...@@ -2272,8 +2272,8 @@ static int emulator_has_longmode(struct x86_emulate_ctxt *ctxt) ...@@ -2272,8 +2272,8 @@ static int emulator_has_longmode(struct x86_emulate_ctxt *ctxt)
#define GET_SMSTATE(type, smbase, offset) \ #define GET_SMSTATE(type, smbase, offset) \
({ \ ({ \
type __val; \ type __val; \
int r = ctxt->ops->read_std(ctxt, smbase + offset, &__val, \ int r = ctxt->ops->read_phys(ctxt, smbase + offset, &__val, \
sizeof(__val), NULL); \ sizeof(__val)); \
if (r != X86EMUL_CONTINUE) \ if (r != X86EMUL_CONTINUE) \
return X86EMUL_UNHANDLEABLE; \ return X86EMUL_UNHANDLEABLE; \
__val; \ __val; \
...@@ -2484,8 +2484,7 @@ static int em_rsm(struct x86_emulate_ctxt *ctxt) ...@@ -2484,8 +2484,7 @@ static int em_rsm(struct x86_emulate_ctxt *ctxt)
/* /*
* Get back to real mode, to prepare a safe state in which to load * Get back to real mode, to prepare a safe state in which to load
* CR0/CR3/CR4/EFER. Also this will ensure that addresses passed * CR0/CR3/CR4/EFER.
* to read_std/write_std are not virtual.
* *
* CR4.PCIDE must be zero, because it is a 64-bit mode only feature. * CR4.PCIDE must be zero, because it is a 64-bit mode only feature.
*/ */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册