mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-04 23:30:20 +00:00
Kernel: Buffer an entire region when generating coredumps
This allows us to unlock the region tree lock early, to avoid keeping the lock while we are doing IO.
This commit is contained in:
parent
32a03cffeb
commit
5e11a512d6
Notes:
sideshowbarker
2024-07-17 07:35:59 +09:00
Author: https://github.com/timschumi
Commit: 5e11a512d6
Pull-request: https://github.com/SerenityOS/serenity/pull/14993
Reviewed-by: https://github.com/bgianfo
1 changed files with 5 additions and 1 deletions
|
@ -220,6 +220,8 @@ ErrorOr<void> Coredump::write_regions()
|
|||
if (region.access() == Memory::Region::Access::None)
|
||||
continue;
|
||||
|
||||
auto buffer = TRY(KBuffer::try_create_with_size("Coredump Region Copy Buffer"sv, region.page_count() * PAGE_SIZE));
|
||||
|
||||
TRY(m_process->address_space().with([&](auto& space) -> ErrorOr<void> {
|
||||
auto* real_region = space->region_tree().regions().find(region.vaddr().get());
|
||||
|
||||
|
@ -244,11 +246,13 @@ ErrorOr<void> Coredump::write_regions()
|
|||
// If the current page is not backed by a physical page, we zero it in the coredump file.
|
||||
return UserOrKernelBuffer::for_kernel_buffer(zero_buffer);
|
||||
}();
|
||||
TRY(m_description->write(src_buffer.value(), PAGE_SIZE));
|
||||
TRY(src_buffer.value().read(buffer->bytes().slice(i * PAGE_SIZE, PAGE_SIZE)));
|
||||
}
|
||||
|
||||
return {};
|
||||
}));
|
||||
|
||||
TRY(m_description->write(UserOrKernelBuffer::for_kernel_buffer(buffer->data()), buffer->size()));
|
||||
}
|
||||
|
||||
return {};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue