since the mapping is private, other process will not get the changes of A's write
http://man7.org/linux/man-pages/man2/mmap.2.html (MAP_PRIVATE will ensure A's changes are not reflected)
Question
I have a question about shared library in linux. If a process maps a shared library with write permission, and writes to it, does it trigger copy-on-write?
for example, the memory mapping of process A has the following entries:
40321000-40336000 r-xp 00000000 b3:15 875 /system/lib/libm.so
40336000-40337000 r--p 00014000 b3:15 875 /system/lib/libm.so
40337000-40338000 rw-p 00015000 b3:15 875 /system/lib/libm.so
The 3rd entry has permission rw-p, which means it has write permission. So if process A writes to this section, is copy-on-write triggered? If it does, does it mean other processes that have the same mapping of the shared library will not see the data process A writes?
Jiawen
Solution
since the mapping is private, other process will not get the changes of A's write
http://man7.org/linux/man-pages/man2/mmap.2.html (MAP_PRIVATE will ensure A's changes are not reflected)