Hi,
I did the following experiment wrt mmap and qemu (v2.3) and noticed a strange behavior.
Can anyone explain if this is expected (or perhaps a bug?).
I have a program which opens a file and mmaps the file contents into a private memory space.
If MAP_PRIVATE is used, ideally the mmap-ed region contents even if changed, must never be written back to the disk.
In my example, the driver program does NOT do any writing at all.
It simply opens a read-only file and creates a new read-only mmap-ed space supported by that file.
However, I do the writing differently from my QEMU emulation.
I catch the mmap address returned in helper_sysret() and also capture the translated host virtual address (X) corresponding to that.
Then corrupt the data from X to say X + 10 addresses. I notice that this causes the original file to be corrupted as well.
So ideally the contents written must never reach the disk right? Since it is equivalent to a write (from driver program) in MAP_PRIVATE region.
Let me know if you want the actual source code diff for reproducing this.
Thanks,
Viswesh