I was testing the libc mmap() on my host linux and on
the user-mode linux running on top of the host linux, and it
looks to me that the function behaves differently with the
mmap(0, 100, PROT_READ, MAP_SHARED, fd, 0);
If I try to write the returned pointer from the host linux,
the process causes a segmentation fault, as the pages are
read-only. From UM-linux instead, the write succeeds and
the process terminates normally. The mmap-ed file is not
affected by the write though, so I guess the UM-linux
forces a copy-on-write in this case... any reason for this
My host linux is a Red Hat 7.1 that runs kernel 2.4.2-2, while
my UM-linux is a kernel 2.4.7-4um.
Please find attached a short example that causes the problem.
Marco Di Benedetto