Assume I have a process X and then it has loaded some shared library Y into its address space. I then manage to swap this library Y with a different version Yprime, what would be the effect on the process?
Asked
Active
Viewed 833 times
3
-
2Are you loading the library at runtime manually, or is the loader loading it as it is linked? http://www.kernel.org/doc/man-pages/online/pages/man3/dlsym.3.html – Andrew Tomazos Sep 09 '12 at 16:14
-
My answer http://stackoverflow.com/a/12322672/841108 might be partly relevant to your question. – Basile Starynkevitch Sep 09 '12 at 16:30
1 Answers
1
No effect. The loader holds the library open until the process ends (or until the library is unloaded via dlclose(3)
), which means that it keeps using the same (now deleted) library since its blocks still exist on disk.

Ignacio Vazquez-Abrams
- 776,304
- 153
- 1,341
- 1,358
-
-
1
-
Does it? Once the library has been loaded into memory I don't see why the originating disk blocks would be re-read. Or are the library files mapped in directly instead? – boycy Aug 14 '14 at 13:33
-
2@boycy: Since the pages are executable and not writeable, the kernel will discard them rather than swap them out if required. When they are reloaded from disk, Bad Things can happen. – Ignacio Vazquez-Abrams Aug 14 '14 at 16:34