소스 검색

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.
Andreas Kling 4 년 전
부모
커밋
3ff88a1d77
1개의 변경된 파일6개의 추가작업 그리고 0개의 파일을 삭제
  1. 6 0
      Kernel/VM/Region.cpp

+ 6 - 0
Kernel/VM/Region.cpp

@@ -378,6 +378,12 @@ bool Region::map(PageDirectory& page_directory)
 {
 {
     ScopedSpinLock lock(s_mm_lock);
     ScopedSpinLock lock(s_mm_lock);
     ScopedSpinLock page_lock(page_directory.get_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);
     set_page_directory(page_directory);
     size_t page_index = 0;
     size_t page_index = 0;
     while (page_index < page_count()) {
     while (page_index < page_count()) {