mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-03 07:07:23 +00:00
Kernel: Pass "shared" flag to Region constructor
Before this change, we would sometimes map a region into the address space with !is_shared(), and then moments later call set_shared(true). I found this very confusing while debugging, so this patch makes us pass the initial shared flag to the Region constructor, ensuring that it's in the correct state by the time we first map the region.
This commit is contained in:
@@ -238,12 +238,11 @@ KResultOr<Process::LoadResult> Process::load_elf_object(FileDescription& object_
|
||||
prot |= PROT_WRITE;
|
||||
if (program_header.is_executable())
|
||||
prot |= PROT_EXEC;
|
||||
auto* region = allocate_region_with_vmobject(program_header.vaddr().offset(load_offset), program_header.size_in_memory(), *vmobject, program_header.offset(), elf_name, prot);
|
||||
auto* region = allocate_region_with_vmobject(program_header.vaddr().offset(load_offset), program_header.size_in_memory(), *vmobject, program_header.offset(), elf_name, prot, true);
|
||||
if (!region) {
|
||||
ph_load_result = KResult(-ENOMEM);
|
||||
return IterationDecision::Break;
|
||||
}
|
||||
region->set_shared(true);
|
||||
if (program_header.offset() == 0)
|
||||
load_base_address = (FlatPtr)region->vaddr().as_ptr();
|
||||
return IterationDecision::Continue;
|
||||
|
||||
Reference in New Issue
Block a user