浏览代码

Kernel: Protect looping over VMObject regions

We need to hold the memory manager lock so nobody else can modify
these lists while we're iterating them.
Tom 5 年之前
父节点
当前提交
bcbe2fe525
共有 1 个文件被更改,包括 1 次插入0 次删除
  1. 1 0
      Kernel/VM/MemoryManager.h

+ 1 - 0
Kernel/VM/MemoryManager.h

@@ -220,6 +220,7 @@ private:
 template<typename Callback>
 void VMObject::for_each_region(Callback callback)
 {
+    ScopedSpinLock lock(s_mm_lock);
     // FIXME: Figure out a better data structure so we don't have to walk every single region every time an inode changes.
     //        Perhaps VMObject could have a Vector<Region*> with all of his mappers?
     for (auto& region : MM.m_user_regions) {