mirror of
https://github.com/RGBCube/serenity
synced 2025-05-20 13:25:08 +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:
parent
0781868092
commit
396291b356
1 changed files with 4 additions and 1 deletions
|
@ -575,9 +575,12 @@ Optional<KBuffer> procfs$pid_vmobjects(InodeIdentifier identifier)
|
||||||
region.vmobject().ref_count());
|
region.vmobject().ref_count());
|
||||||
for (size_t i = 0; i < region.vmobject().page_count(); ++i) {
|
for (size_t i = 0; i < region.vmobject().page_count(); ++i) {
|
||||||
auto& physical_page = region.vmobject().physical_pages()[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) ",
|
builder.appendf("P%x%s(%u) ",
|
||||||
physical_page ? physical_page->paddr().get() : 0,
|
physical_page ? physical_page->paddr().get() : 0,
|
||||||
region.should_cow(i) ? "!" : "",
|
should_cow ? "!" : "",
|
||||||
physical_page ? physical_page->ref_count() : 0);
|
physical_page ? physical_page->ref_count() : 0);
|
||||||
}
|
}
|
||||||
builder.appendf("\n");
|
builder.appendf("\n");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue