- 论坛徽章:
- 11
|
如下:- We have always just done a COW if it's read-only - even if it's shared.
- The point being that if a process mapped did a read-only mapping, and a
- tracer wants to modify memory, the tracer is always allowed to do so, but
- it's _not_ going to write anything back to the filesystem. Writing
- something back to an executable just because the user happened to mmap it
- with MAP_SHARED (but read-only) _and_ the user had the right to write to
- that fd is _not_ ok.
复制代码 既然是 COW, 也基本上是修改只自己可见, 因此也不应该写入磁盘。
问题是, COW 页面是如何避免自己被写入磁盘的?
看代码, 只不过是新分配一个页面, 修改页表属性而可写; 但这个页面仍然和 vma 相连接, vma 依然保存着 vm_file, vm_file 依然有 inode, inode 依然有 i_mapping, i_mapping 依然有个 a_ops, 这里面就有何 writepage 了。。。。。。而且, 似乎没有哪里有信息说明这个页面不应该被 writepage, 那么。。。。。。。。。。。。
|
|