Verified Commit fe3607d4 authored by Jeremy Soller's avatar Jeremy Soller
Browse files

ld_so: Zero mapped memory and panic on unsupported relocation

parent 8ba70792
...@@ -193,6 +193,7 @@ impl Linker { ...@@ -193,6 +193,7 @@ impl Linker {
{ {
return Err(Error::Malformed(format!("failed to map {}", elf_name))); return Err(Error::Malformed(format!("failed to map {}", elf_name)));
} }
ptr::write_bytes(ptr as *mut u8, 0, size);
slice::from_raw_parts_mut(ptr as *mut u8, size) slice::from_raw_parts_mut(ptr as *mut u8, size)
}; };
println!(" mmap {:p}, {:#x}", mmap.as_mut_ptr(), mmap.len()); println!(" mmap {:p}, {:#x}", mmap.as_mut_ptr(), mmap.len());
...@@ -404,7 +405,7 @@ impl Linker { ...@@ -404,7 +405,7 @@ impl Linker {
} }
reloc::R_X86_64_IRELATIVE => (), // Handled below reloc::R_X86_64_IRELATIVE => (), // Handled below
_ => { _ => {
println!( panic!(
" {} unsupported", " {} unsupported",
reloc::r_to_str(rel.r_type, elf.header.e_machine) reloc::r_to_str(rel.r_type, elf.header.e_machine)
); );
......
Supports Markdown
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