-
- Downloads
Elf: Serialize shared-object load and unload
Our current dynamic-linker code (elf.cc) is not thread safe, and all sort of disasters can happen if shared objects are loaded, unloaded and/or used concurrently. This and the following patches solve this problem in stages: The first stage, in this patch, is to protect concurrent shared-library loads and unloads. (if the dynamic linker is also in use concurrently, this will still cause problems, and will be solved in the next patches). Library load and unload use a bunch of shared data without protection, so concurrency can cause disaster. For example, two concurrent loads can pick the same address to map the objects in. We solve this by using a mutex to ensure only one shared object is loaded or unloaded at a time. Instead of this coarse-grain locking, we could have used finer-grained locks to allow several library loads to proceed in parallel, protecting just the actual shared data. However the benefits will be very small because with demand-paged file mmaps, "loading" a library just sets up the memory map, very quickly, and the object will only be actually read from disk later, when its pages get used. Fixes #175. Signed-off-by:Nadav Har'El <nyh@cloudius-systems.com> Signed-off-by:
Pekka Enberg <penberg@cloudius-systems.com>
Loading
Please register or sign in to comment