{"record":{"id":"bdef3bdaa463e2b2","repo":"firecracker-microvm/firecracker","slug":"bzimage-load-always-yields-a-setup-header","errorCode":null,"errorMessage":"bzImage load always yields a setup header","messagePattern":"bzImage load always yields a setup header","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/vmm/src/arch/x86_64/mod.rs","lineNumber":542,"sourceCode":"            debug!(\"Kernel loaded using {boot_prot}\");\n\n            Ok(EntryPoint {\n                entry_addr: entry_point_addr,\n                protocol: boot_prot,\n                setup_header: None,\n            })\n        }\n        // Not an ELF image: fall back to the bzImage loader.\n        Err(KernelLoaderError::Elf(ElfError::InvalidElfMagicNumber)) => {\n            let bzimage_result =\n                BzImageLoader::load(guest_memory, None, &mut kernel_file, highmem_start)\n                    .map_err(ConfigurationError::KernelLoader)?;\n\n            // We jump to the 64-bit entry point, which only exists when the\n            // image advertises it via XLF_KERNEL_64 (boot protocol >= 2.12).\n            let hdr = bzimage_result\n                .setup_header\n                .expect(\"bzImage load always yields a setup header\");\n            if hdr.version < 0x020c || hdr.xloadflags & XLF_KERNEL_64 == 0 {\n                return Err(ConfigurationError::BzImageMissing64BitEntry);\n            }\n\n            // Enter at the 64-bit entry point (BZIMAGE_64BIT_ENTRY_OFFSET\n            // past the load address); the setup header seeds the zero page.\n            let entry_addr = bzimage_result\n                .kernel_load\n                .checked_add(BZIMAGE_64BIT_ENTRY_OFFSET)\n                .ok_or(ConfigurationError::KernelLoader(\n                    KernelLoaderError::MemoryOverflow,\n                ))?;\n\n            debug!(\"Kernel loaded using {} (bzImage)\", BootProtocol::LinuxBoot);\n\n            Ok(EntryPoint {\n                entry_addr,\n                protocol: BootProtocol::LinuxBoot,","sourceCodeStart":524,"sourceCodeEnd":560,"githubUrl":"https://github.com/firecracker-microvm/firecracker/blob/81b38b9dad6056d7a48073e95ac5a9aed51cb2ab/src/vmm/src/arch/x86_64/mod.rs#L524-L560","documentation":"Error \"bzImage load always yields a setup header\" thrown in firecracker-microvm/firecracker.","triggerScenarios":"Thrown at src/vmm/src/arch/x86_64/mod.rs:496 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["This indicates a logic error in the bzImage loader; the setup header must always be present after a successful load.","Verify the kernel image is a valid bzImage and was not truncated before loading."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"81b38b9dad6056d7a48073e95ac5a9aed51cb2ab","analyzedAt":"2026-08-19T05:27:02.517Z","contentChangedAt":"2026-08-19T05:27:02.517Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}