1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 11:08:11 +00:00

Kernel: Allocate shared memory regions immediately

Lazily committed shared memory was not working in situations where one
process would write to the memory and another would only read from it.

Since the reading process would never cause a write fault in the shared
region, we'd never notice that the writing process had added real
physical pages to the VMObject. This happened because the lazily
committed pages were marked "present" in the page table.

This patch solves the issue by always allocating shared memory up front
and not trying to be clever about it.
This commit is contained in:
Andreas Kling 2021-01-02 16:49:19 +01:00
parent 5dae85afe7
commit fe6b3f99d1
3 changed files with 8 additions and 2 deletions

View file

@ -52,7 +52,7 @@ int Process::sys$shbuf_create(int size, void** buffer)
return -EINVAL;
size = PAGE_ROUND_UP(size);
auto vmobject = AnonymousVMObject::create_with_size(size, AllocationStrategy::Reserve);
auto vmobject = AnonymousVMObject::create_with_size(size, AllocationStrategy::AllocateNow);
if (!vmobject)
return -ENOMEM;