mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-01 21:59:07 +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:
parent
ce1bf3724e
commit
2f1b4b8a81
Notes:
sideshowbarker
2024-07-17 22:41:14 +09:00
Author: https://github.com/BertalanD
Commit: 2f1b4b8a81
Pull-request: https://github.com/SerenityOS/serenity/pull/11318
Reviewed-by: https://github.com/IdanHo
Reviewed-by: https://github.com/bgianfo ✅
1 changed files with 12 additions and 0 deletions
|
@ -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;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue