mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 10:38:11 +00:00
Kernel: Add back missing ELF::Image validity check
If the image is not a valid ELF we should just fail ASAP.
This commit is contained in:
parent
4986f268a5
commit
c3eddbcb49
1 changed files with 5 additions and 2 deletions
|
@ -75,6 +75,11 @@ KResultOr<Process::LoadResult> Process::load_elf_object(FileDescription& object_
|
|||
return KResult(-ENOMEM);
|
||||
}
|
||||
|
||||
auto elf_image = ELF::Image(region->vaddr().as_ptr(), loader_metadata.size);
|
||||
|
||||
if (!elf_image.is_valid())
|
||||
return KResult(-ENOEXEC);
|
||||
|
||||
Region* master_tls_region { nullptr };
|
||||
size_t master_tls_size = 0;
|
||||
size_t master_tls_alignment = 0;
|
||||
|
@ -83,8 +88,6 @@ KResultOr<Process::LoadResult> Process::load_elf_object(FileDescription& object_
|
|||
|
||||
MM.enter_process_paging_scope(*this);
|
||||
String elf_name = object_description.absolute_path();
|
||||
auto elf_image = ELF::Image(region->vaddr().as_ptr(), loader_metadata.size);
|
||||
|
||||
ASSERT(!Processor::current().in_critical());
|
||||
|
||||
bool failed = false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue