BusyBox Bug and Patch Tracking
BusyBox
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0000430 [uClibc] Shared Library Support major always 09-14-05 03:18 09-19-05 09:19
Reporter mfuzzey View Status public  
Assigned To uClibc
Priority normal Resolution fixed  
Status closed   Product Version 0.9.28
Summary 0000430: dlopen incorrectly merges absolute library names
Description In fact with 0.9.28 but tracker wouldn't accept that..

When two calls to dlopen are used with library names containing / but refering to *different* libraries the second call returns the same library as the first.

I am having this problem with python (compiled by standard buildroot) and pygame (custom buildroot extension).
python contains a native library /usr/lib/python2.4/lib-dynload/time.so
pygame contains a native library /usr/lib/python2.4/site-packages/pygame/time.so
These two libraries are completely different

Importing either by itself works correctly
However if both are imported in the same python process the dlopen call for the second returns a reference to the first!

The reason is evident looking at _dl_load_shared_library in dl-elf.c [duplicate detection is performed after removing all / parts...]
Additional Information Extract from traces with LD_DEBUG
dlopen():188: Trying to dlopen '/usr/lib/python2.4/lib-dynload/time.so', RTLD_GLOBAL:0 RTLD_NOW:1
_dl_check_if_named_library_is_loaded:195: Checking if 'time.so' is already loaded
_dl_load_shared_library:282: find library='time.so'; searching
_dl_load_shared_library:288: trying file='/usr/lib/python2.4/lib-dynload/time.so'
...
dlopen():188: Trying to dlopen '/usr/lib/python2.4/site-packages/pygame/time.so', RTLD_GLOBAL:0 RTLD_NOW:1
_dl_check_if_named_library_is_loaded:195: Checking if 'time.so' is already loaded
dlopen():204: Lib: /usr/lib/python2.4/site-packages/pygame/time.so already opened
Attached Files  uClibc-absolute-dynamic-load.patch [^] (1,850 bytes) 09-15-05 01:08

- Relationships

- Notes
(0000531)
jocke
09-14-05 15:33

yes, _dl_check_if_named_library_is_loaded() is busted. The
real fix is to stat() the lib and compare the st_dev and st_ino
fields with the already loaded libs. I don't have time ATM so you
are welcome to try fixing it yourself.
 
(0000536)
mfuzzey
09-15-05 01:07

I have now created a patch which I'm uploading.
It doesn't use the stat() method suggested but calls _dl_check_if_named_library_is_loaded() with the full library name and modifies it to compare the full names.

This works for me but it probably isn't really correct either - if a process mixes absolute and relative dlopen calls duplicates could go undetected.
 
(0000545)
jocke
09-17-05 10:07

I fixed it using st_dev and st_ino instead. Please test.
 
(0000560)
mfuzzey
09-19-05 07:27

Your fix works fine. Thank you.
 
(0000561)
jocke
09-19-05 09:19

Good, I will close this bug then.
 

- Issue History
Date Modified Username Field Change
09-14-05 03:18 mfuzzey New Issue
09-14-05 03:18 mfuzzey Status new => assigned
09-14-05 03:18 mfuzzey Assigned To  => uClibc
09-14-05 04:47 mfuzzey Issue Monitored: mfuzzey
09-14-05 08:14 andersen version 0.9.27 => 0.9.28
09-14-05 15:34 jocke Note Added: 0000531
09-15-05 01:07 mfuzzey Note Added: 0000536
09-15-05 01:08 mfuzzey File Added: uClibc-absolute-dynamic-load.patch
09-17-05 10:07 jocke Note Added: 0000545
09-19-05 07:27 mfuzzey Note Added: 0000560
09-19-05 09:19 jocke Status assigned => closed
09-19-05 09:19 jocke Note Added: 0000561
09-19-05 09:19 jocke Resolution open => fixed


Copyright © 2000 - 2006 Mantis Group
Powered by Mantis Bugtracker