0

I have a process running, which contains a shared library,

For example:

00007f3d8422d000 4K r-x-- /media/projects/shared-lib/libshared.so

00007f3d8422e000 2044K ----- /media/projects/shared-lib/libshared.so

00007f3d8442d000 4K r---- /media/projects/shared-lib/libshared.so

00007f3d8442e000 4K rw--- /media/projects/shared-lib/libshared.so

  1. I would like to duplicate the above mapping, so another virtual pages will be point to the same physical address, how can it be done ?

So I will see the same mapping but with other virtual addresses. (In the same running process)

  1. What finally I would like to do, is replace the old shared library with the new mapping, can it be done ?

Thanks

omri-c
  • 81
  • 1
  • 7
  • I think the best response to this is "Why?"... You can `dlopen()` another copy of the library, but I'm not sure if that will actually map the entire library again, or just give you an additional copy of the non-read-only bits. And I'm pretty sure you can't subvert the already linked copy once the loader has finished its job... – twalberg Nov 25 '13 at 19:19
  • dlopen will return the same mapping, in general is it possible that a process will have duplicated virtual pages to the same memory regions? is there a way to mmap the same pages of the .so & then ask the linker to resolve them again ? I would like to acheive ASLR while forking a new child, & since the child inherit the same .so mapping I would like on runtime to mmap them again & thus to acheive ASLR – omri-c Nov 25 '13 at 19:24

0 Answers0