Issue: RHN System ID:
Customer Contact Name:
Description of Problem:
This problem is the same as issue #580553 of RHEL5.
This ticket is for RHEL6.
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.
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: 6
- Release Number: Alpha 3
- Architecture: x86
- Kernel Version: 2.6.31-38.el6
- Related Package Version: glibc-2.10.90-26
- 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: 6.0
Errata Request: None.
Hotfix Request: None.
Sosreport and reproducer are attached.
Sosreport and reproducer are attached.
> Why does calling libC_fini() succeed even though calling _libC_fini() fails?
> For the same reasons as above.
This answer does not satisfy us.
It just answered "Why calling _libC_fini() fails", but here we want to know
"Why calling libC_fini() succeeds" instead. They are completely different
> Here is another program "reproducer_v2.tar.gz" that works well without any
> "undefined symbol" error. We provide it, too.
> The difference between "reproducer" and "reproducer_v2" is whether to call
> dlopen()/dlclose for libX.so or not. The "reproducer_v2" does not call them.
> According to your explanation, it is a problem if "reproducer_v2" works well
> without any problem, because the RTLD_GLOBAL flag is not specified in it.
> Why does this work well?
> I'm looking further into this
We add some information of differences between them.
If a.out does not call dlopen()/dlclose() for libX.so ["reproducer_v2" case]:
- When libA.so is closed, dlclose() updates the l_scope list of libC.so.
- There is the scope for libC.so in the l_scope list (in the linkmap structure)
of libC.so itself after a.out calls dlclose() for libA.so.
If a.out calls dlopen()/dlclose() for libX.so ["reproducer" case]:
- When libA.so is closed, dlclose() doesn't update the l_scope list of libC.so.
- There is no scope for libC.so in the l_scope list of any library (even
libC.so itself) after a.out calls dlclose() for libA.so.
So obviously there is something wrong in dlclose().
Created attachment 415113 [details]
Created attachment 415114 [details]
Created attachment 415116 [details]
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux major release. Product Management has requested further
review of this request by Red Hat Engineering, for potential inclusion in a Red
Hat Enterprise Linux Major release. This request is not yet committed for
Red Hat Enterprise Linux 6.0 is now available and should resolve
the problem described in this bug report. This report is therefore being closed
with a resolution of CURRENTRELEASE. You may reopen this bug report if the
solution does not work for you.