Test 32-bit ljmp emulation
PATCH 1/1 Test 32-bit ljmp emulation
em_jmp_far and em_ret_far assumed that setting IP can only fail in 64 bit mode, but syzkaller proved otherwise (and SDM agrees). This test exercises the bug.
--- lib/x86/desc.h | 1 + lib/x86/processor.h | 5 +++ x86/cstart64.S | 1 + x86/emulator.c | 108 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 115 insertions(+)
lib/x86/desc.h +1 -0
@@ -142,6 +142,7 @@ void set_intr_task_gate(int vec, void *fn);void setup_tss32 (void );#else extern tss64_t tss; +extern gdt_entry_t gdt64[];#endif unsigned exception_vector (void );
lib/x86/processor.h +5 -0
@@ -46,6 +46,11 @@ struct descriptor_table_ptr {ulong base; } __attribute__((packed)); +struct far_pointer32 { +u32 offset; +u16 selector; +} __attribute__((packed)); +static inline void barrier (void ) { asmvolatile ("" : : :"memory" );
x86/cstart64.S +1 -0
@@ -7,6 +7,7 @@ boot_idt = 0 .globl idt_descr .globl tss_descr .globl gdt64_desc +.globl gdt64 ipi_vector = 0x20
x86/emulator.c +108 -0
132 lines not on this page · raw message
Signature · 1 line
2.8.0.rc3.226.g39d4020
PATCH v2 1/1 Test 32-bit ljmp emulation
em_jmp_far and em_ret_far assumed that setting IP can only fail in 64 bit mode, but syzkaller proved otherwise (and SDM agrees). This test exercises the bug.
Signed-off-by Jim Mattson <[email protected]>
--- lib/x86/desc.h | 1 + lib/x86/processor.h | 5 +++ x86/cstart64.S | 1 + x86/emulator.c | 110 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 117 insertions(+)
lib/x86/desc.h +1 -0
@@ -142,6 +142,7 @@ void set_intr_task_gate(int vec, void *fn);void setup_tss32 (void );#else extern tss64_t tss; +extern gdt_entry_t gdt64[];#endif unsigned exception_vector (void );
lib/x86/processor.h +5 -0
@@ -46,6 +46,11 @@ struct descriptor_table_ptr {ulong base; } __attribute__((packed)); +struct far_pointer32 { +u32 offset; +u16 selector; +} __attribute__((packed)); +static inline void barrier (void ) { asmvolatile ("" : : :"memory" );
x86/cstart64.S +1 -0
@@ -7,6 +7,7 @@ boot_idt = 0 .globl idt_descr .globl tss_descr .globl gdt64_desc +.globl gdt64 ipi_vector = 0x20
x86/emulator.c +110 -0
134 lines not on this page · raw message
Signature · 1 line
2.8.0.rc3.226.g39d4020