Kernel: Assert on attempt to map private region backed by shared inode

If we find ourselves with a user-accessible, non-shared Region backed by
a SharedInodeVMObject, that's pretty bad news, so let's just panic the
kernel instead of getting abused.

There might be a better place for this kind of check, so I've added a
FIXME about putting more thought into that.
This commit is contained in:
Andreas Kling 2021-01-26 17:05:36 +01:00
parent a131927c75
commit 3ff88a1d77
Notes: sideshowbarker 2024-07-18 22:50:35 +09:00

View File

@ -378,6 +378,12 @@ bool Region::map(PageDirectory& page_directory)
{
ScopedSpinLock lock(s_mm_lock);
ScopedSpinLock page_lock(page_directory.get_lock());
// FIXME: Find a better place for this sanity check(?)
if (is_user_accessible() && !is_shared()) {
ASSERT(!vmobject().is_shared_inode());
}
set_page_directory(page_directory);
size_t page_index = 0;
while (page_index < page_count()) {