Red Hat Bugzilla – Bug 600457
[4.8] Unexpected failure of resolving a locally-defined symbol.
Last modified: 2016-11-24 10:44:59 EST
Customer Contact Name:
Description of Problem:
This problem is the same as issue #580553 of RHEL5.
This ticket is for RHEL4.
We hit a failure of resolving a symbol which is locally defined in a library,
in a complex case that I'll describe below.
If the dynamic linker, glibc or something else has a bug in it, please fix it.
If we did something wrong on creating a program, please point it out.
We wrote a program that consists of an executable file and four libraries.
The executable file a.out requires two libraries, libA and libX.
The library libA requires another library libB.
The library libB requires another library libC.
The program operates in the following steps.
+------+ +-------+ +------+ +------+ +-----------------------------------+
| libX | (2) | a.out | (1) | libA |----| libB |------| libC (5) (7) |
| | <=== | (8) | ===> | | | | <=== | atexit(libC_fini)--> _libC_fini() |
+------+ (3) +-------+ (6) +------+ +------+ (4) +-----------------------------------+
(1) a.out calls dlopen() for libA.
libB and libC shall be loaded, too.
(2) a.out calls dlopen() for libX.
(3) a.out calls dlclose() for libX.
(4) libC calls dlopen() for libB.
(5) libC calls atexit() to register libC_fini().
(6) a.out calls dlclose() for libA.
libB and libC are no longer needed, so both libraries shall be getting unloaded.
(7) libC_fini() shall be called when libC is getting unloaded.
(8) a.out exits.
But when we run the program, unexpectedly
a) step (7) is executed _after_ step (8)
b) libC cannot resolve a locally-defined symbol _libC_fini at executing (7)
Version-Release number of selected component:
- Red Hat Enterprise Linux Version Number: 4
- Release Number: 8
- Architecture: x86
- Kernel Version: 2.6.9-89.ELsmp
- Related Package Version: glibc-2.3.4-2.43.el4_8.2
- Related Middleware / Application: None
Drivers or hardware or architecture dependency:
Step to Reproduce:
1) Extract the reproducer.
$ tar zxvf reproducer.tar.gz
2) Compile it.
$ cd reproducer
3) Run it.
./main: symbol lookup error: ./libC.so: undefined symbol: _libC_fini
7)libC:finish - atexit()
Summary of actions taken to resolve issue:
Location of diagnostic data:
Model: PRIMERGY RX300 S5
CPU Info: Xeon(R) 2.27GHz x2
Memory Info: 3GB
Hardware Component Information: None
Configuration Info: None
Guest Configuration Info: None
The application suffering this issue cannot call the function registered
by atexit() because of the failure of resolving its symbol. It causes two
severe problems, a) the failure of cooperation with other processes by
notifying them of its completion, and b) the system resource leaks by not
Target Release: 4.9
Errata Request: async errata for 4.8
Hotfix Request: None.
Sosreport and reproducer are attached.
This is the same bug as IT #580553 https://bugzilla.redhat.com/show_bug.cgi?id=593675 (RHEL5)
Created attachment 421321 [details]
Created attachment 421323 [details]
Technical note added. If any revisions are required, please edit the "Technical Notes" field
accordingly. All revisions will be proofread by the Engineering Content Services team.
Under certain circumstances, unloading a module could leave the remaining modules' symbol search list in an inconsistent state. Consequent to this inconsistency, symbol lookups could spuriously fail to find the symbol. This update corrects this error, and module unloading no longer produces inconsistent state in the symbol search list.
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.