mirror of
https://github.com/qemu/qemu.git
synced 2026-07-08 17:46:17 +00:00
target/i386: user: do not set up a valid LDT on reset
In user-mode emulation, QEMU uses the default setting of the LDT base
and limit, which places it at the bottom 64K of virtual address space.
However, by default there is no LDT at all in Linux processes, and
therefore the limit should be 0.
This is visible as a NULL pointer dereference in LSL and LAR instructions
when they try to read the LDT at an unmapped address.
Resolves: #1376
Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit 58aa1d08bb)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
This commit is contained in:
committed by
Michael Tokarev
parent
5adcdce946
commit
c88a40041f
@@ -5906,7 +5906,11 @@ static void x86_cpu_reset(DeviceState *dev)
|
||||
|
||||
env->idt.limit = 0xffff;
|
||||
env->gdt.limit = 0xffff;
|
||||
#if defined(CONFIG_USER_ONLY)
|
||||
env->ldt.limit = 0;
|
||||
#else
|
||||
env->ldt.limit = 0xffff;
|
||||
#endif
|
||||
env->ldt.flags = DESC_P_MASK | (2 << DESC_TYPE_SHIFT);
|
||||
env->tr.limit = 0xffff;
|
||||
env->tr.flags = DESC_P_MASK | (11 << DESC_TYPE_SHIFT);
|
||||
|
||||
Reference in New Issue
Block a user