Skip to content

Commit

Permalink
Kernel: Mark read-only PT_LOAD mappings as shared regions
Browse files Browse the repository at this point in the history
This makes Region::clone() do the right thing for these now that we
differentiate based on Region::is_shared().
  • Loading branch information
awesomekling committed Mar 1, 2020
1 parent ecfde59 commit 5c2a296
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Kernel/Process.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -887,8 +887,10 @@ int Process::do_exec(NonnullRefPtr<FileDescription> main_program_description, Ve
prot |= PROT_WRITE;
if (is_executable)
prot |= PROT_EXEC;
if (auto* region = allocate_region_with_vmobject(vaddr.offset(totally_random_offset), size, *vmobject, offset_in_image, String(name), prot))
if (auto* region = allocate_region_with_vmobject(vaddr.offset(totally_random_offset), size, *vmobject, offset_in_image, String(name), prot)) {
region->set_shared(true);
return region->vaddr().as_ptr();
}
return nullptr;
};
loader->alloc_section_hook = [&](VirtualAddress vaddr, size_t size, size_t alignment, bool is_readable, bool is_writable, const String& name) -> u8* {
Expand Down

0 comments on commit 5c2a296

Please sign in to comment.