aboutsummaryrefslogtreecommitdiffstats
path: root/executor
diff options
context:
space:
mode:
authorAlexander Potapenko <glider@google.com>2026-02-10 18:41:02 +0100
committerAlexander Potapenko <glider@google.com>2026-02-11 07:33:38 +0000
commit065bb22876f32a7784830f2493373c2148343a40 (patch)
tree281343e331b911d727099d3127a7f289033569f3 /executor
parenteb08a15462c45530d2146e76f04a1a22c6541903 (diff)
executor: fix x86 L1 SYZOS GDT setup
Moving setup_pg_table() before setup_gdt_64() prevents the page table initialization from accidentally erasing the newly created Global Descriptor Table (GDT). If the GDT is zeroed out, the CPU hardware cannot fetch the necessary code segment descriptors to deliver interrupts or exceptions, leading to unhandled #GP or #DF crashes.
Diffstat (limited to 'executor')
-rw-r--r--executor/common_kvm_amd64.h3
1 files changed, 1 insertions, 2 deletions
diff --git a/executor/common_kvm_amd64.h b/executor/common_kvm_amd64.h
index 2c9c12a9d..cb9499a81 100644
--- a/executor/common_kvm_amd64.h
+++ b/executor/common_kvm_amd64.h
@@ -515,10 +515,9 @@ static void setup_gdt_ldt_pg(struct kvm_syz_vm* vm, int cpufd, int cpu_id)
// RSP0 is at offset +4 bytes in a 64-bit TSS.
*(volatile uint64*)(l1_tss + 4) = X86_SYZOS_ADDR_STACK0;
+ setup_pg_table(vm);
setup_gdt_64(gdt);
-
syzos_setup_idt(vm, &sregs);
- setup_pg_table(vm);
sregs.cr0 = X86_CR0_PE | X86_CR0_NE | X86_CR0_PG;
sregs.cr4 |= X86_CR4_PAE | X86_CR4_OSFXSR;