mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-06 16:45:03 +00:00
Kernel: Exclude PROT_NONE regions from coredumps
As PROT_NONE regions can't be accessed by processes, and their only real use is for reserving ranges of virtual memory, there's no point in including them in coredumps.
This commit is contained in:
committed by
Brian Gianforcaro
parent
ce1bf3724e
commit
2f1b4b8a81
@@ -51,6 +51,9 @@ Coredump::Coredump(NonnullRefPtr<Process> process, NonnullRefPtr<OpenFileDescrip
|
||||
if (looks_like_userspace_heap_region(*region))
|
||||
continue;
|
||||
#endif
|
||||
|
||||
if (region->access() == Memory::Region::Access::None)
|
||||
continue;
|
||||
++m_num_program_headers;
|
||||
}
|
||||
++m_num_program_headers; // +1 for NOTE segment
|
||||
@@ -128,6 +131,9 @@ ErrorOr<void> Coredump::write_program_headers(size_t notes_size)
|
||||
continue;
|
||||
#endif
|
||||
|
||||
if (region->access() == Memory::Region::Access::None)
|
||||
continue;
|
||||
|
||||
ElfW(Phdr) phdr {};
|
||||
|
||||
phdr.p_type = PT_LOAD;
|
||||
@@ -177,6 +183,9 @@ ErrorOr<void> Coredump::write_regions()
|
||||
continue;
|
||||
#endif
|
||||
|
||||
if (region->access() == Memory::Region::Access::None)
|
||||
continue;
|
||||
|
||||
region->set_readable(true);
|
||||
region->remap();
|
||||
|
||||
@@ -254,6 +263,9 @@ ErrorOr<void> Coredump::create_notes_regions_data(auto& builder) const
|
||||
continue;
|
||||
#endif
|
||||
|
||||
if (region->access() == Memory::Region::Access::None)
|
||||
continue;
|
||||
|
||||
ELF::Core::MemoryRegionInfo info {};
|
||||
info.header.type = ELF::Core::NotesEntryHeader::Type::MemoryRegionInfo;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user