提交 6f540f24 创建 作者: Austin Clements's avatar Austin Clements

Fix the zero page allocator

Since the underlying kmem allocator uses the first sizeof(struct run) bytes as metadata for freed runs, the zero pages put into the zero page allocator's kmem were coming back with the first few bytes non-zero. Fix this by explicitly zero'ing the run header of pages retrieved from kmem. usertests now passes the bss test. It still fails twofiles and forktest.
上级 a184838e
......@@ -80,6 +80,9 @@ zallocator::alloc(const char* name)
p = kalloc(name);
if (p != nullptr)
zpage(p);
} else {
// Zero the run header used by kmem
memset(p, 0, sizeof(struct run));
}
tryrefill();
return p;
......
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论