Commit 386ee525 authored by Jonathan Schwender's avatar Jonathan Schwender Committed by Stefan Lankes
Browse files

loader_main: Assert that elf contains entrypoint



If the elf header doesn't contain an entrypoint (the value is zero), then well just jump to the start of the elf file, which should be avoided.
Thus we add an assertion to check for this.
Signed-off-by: default avatarJonathan Schwender <schwenderjonathan@gmail.com>
parent c8169f93
......@@ -37,6 +37,7 @@ pub unsafe extern "C" fn loader_main() -> ! {
let app = arch::find_kernel();
let elf = elf::Elf::parse(&app).expect("Unable to parse ELF file");
assert_ne!(elf.entry, 0, "Goblin failed to find entry point of the kernel in the Elf header");
let mem_size = check_kernel_elf_file(&elf);
let (kernel_location, entry_point) = load_kernel(&elf, app.as_ptr() as u64, mem_size);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment