1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-15 09:54:57 +00:00

Kernel: Fix crash on cat /proc/PID/vmobjects

A Region starts at an offset into a VMObject, and if that offset is
non-zero, we need to subtract it from the VMObject page index here.

Fixes #2803.
This commit is contained in:
Andreas Kling 2020-07-15 16:21:12 +02:00
parent 0781868092
commit 396291b356

View file

@ -575,9 +575,12 @@ Optional<KBuffer> procfs$pid_vmobjects(InodeIdentifier identifier)
region.vmobject().ref_count());
for (size_t i = 0; i < region.vmobject().page_count(); ++i) {
auto& physical_page = region.vmobject().physical_pages()[i];
bool should_cow = false;
if (i >= region.first_page_index() && i <= region.last_page_index())
should_cow = region.should_cow(i - region.first_page_index());
builder.appendf("P%x%s(%u) ",
physical_page ? physical_page->paddr().get() : 0,
region.should_cow(i) ? "!" : "",
should_cow ? "!" : "",
physical_page ? physical_page->ref_count() : 0);
}
builder.appendf("\n");