This is the mail archive of the libc-help@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Creating aliases for memory ranges


On 18/10/13 15:54, Florian Weimer wrote:
On 01/26/2013 08:35 PM, Ángel González wrote:

Florian, you need to open a temporary file and map it twice (once ro and
the other rw). You can then unlink the file after opening. You can't
duplicate a mapping with no associated file.

I tried to map memory from /proc/self/map, but that doesn't work, either. I came up with the attached code instead. It has the advantage that the memory area isn't backed by disk (if /dev/shm is on tmpfs), so it won't cause any pointless disk I/O.
Looks good. If you're interesed, there were some code and discussion about that related to the executable pages must not be writable patches and jit engines such as firefox.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]