From a4c52dd6fa17ba8bb0a3d6a08de46c61035f693c Mon Sep 17 00:00:00 2001 From: Alexander Potapenko Date: Fri, 23 Jan 2026 18:28:30 +0100 Subject: executor: implement dynamic L2 page table allocation in SYZOS Enable the SYZOS guest (L1) to dynamically allocate memory for nested L2 page tables, replacing the previous rigid static layout. Move the mem_region and syzos_boot_args struct definitions to the guest header (common_kvm_amd64_syzos.h) to allow the guest to parse the memory map injected by the host. Introduce a bump allocator, guest_alloc_page(), which targets the X86_SYZOS_ADDR_UNUSED heap. This allocator relies on a new struct syzos_globals located at X86_SYZOS_ADDR_GLOBALS to track the allocation offset. Refactor setup_l2_page_tables() to allocate intermediate paging levels (PDPT, PD, PT) via guest_alloc_page() instead of using fixed contiguous offsets relative to the PML4. This allows for disjoint memory usage and supports future recursion requirements. --- executor/common_kvm_amd64.h | 12 ------------ 1 file changed, 12 deletions(-) (limited to 'executor/common_kvm_amd64.h') diff --git a/executor/common_kvm_amd64.h b/executor/common_kvm_amd64.h index 12bc8958d..a181e302e 100644 --- a/executor/common_kvm_amd64.h +++ b/executor/common_kvm_amd64.h @@ -215,18 +215,6 @@ static void setup_64bit_idt(struct kvm_sregs* sregs, char* host_mem, uintptr_t g #define MEM_REGION_FLAG_NO_HOST_MEM (1 << 6) #define MEM_REGION_FLAG_REMAINING (1 << 7) -struct mem_region { - uint64 gpa; - int pages; - uint32 flags; -}; - -struct syzos_boot_args { - uint32 region_count; - uint32 reserved; - struct mem_region regions[]; -}; - // SYZOS guest virtual memory layout (must be in sync with executor/kvm.h): static const struct mem_region syzos_mem_regions[] = { // AMD64 fixed data structures (5 pages: Zero, GDT, PML4, PDP, PD). -- cgit mrf-deployment