Bug 600457

Summary: [4.8] Unexpected failure of resolving a locally-defined symbol.
Product: Red Hat Enterprise Linux 4 Reporter: Alan Matsuoka <alanm>
Component: glibcAssignee: Andreas Schwab <schwab>
Status: CLOSED ERRATA QA Contact: qe-baseos-tools-bugs
Severity: high Docs Contact:
Priority: high    
Version: 4.8CC: ebachalo, fweimer, kawajiri, pmuller, tao
Target Milestone: rcKeywords: ZStream
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: glibc-2.3.4-2.50 Doc Type: Bug Fix
Doc Text:
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.
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-02-16 14:30:54 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 602210    
Attachments:
Description Flags
reproducer.tar.gz
none
sosreport-rhel4u8x-373481-dc98bf.tar.bz2 none

Description Alan Matsuoka 2010-06-04 18:23:54 UTC
Customer Contact Name:
Naoki Yanagimoto

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:
None.

How reproducible:
always.

Step to Reproduce:
1) Extract the reproducer.
   $ tar zxvf reproducer.tar.gz

2) Compile it.
   $ cd reproducer
   $ make

3) Run it.
   $ ./run.sh

Actual Results:
$ ./run.sh
1)main:dlopen  libA.so
2)main:dlopen  libX.so
3)main:dlclose libX.so
4)libC:dlopen  libB.so
5)libC:atexit(libC_fini)
6)main:dlclose libA.so
8)main:finish main
./main: symbol lookup error: ./libC.so: undefined symbol: _libC_fini

Expected Results:
$ ./run.sh
1)main:dlopen  libA.so
2)main:dlopen  libX.so
3)main:dlclose libX.so
4)libC:dlopen  libB.so
5)libC:atexit(libC_fini)
6)main:dlclose libA.so
7)libC:finish - atexit()
8)main:finish main

Summary of actions taken to resolve issue:
None.

Location of diagnostic data:
None.

Hardware configuration:
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

Business Impact:
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
freeing them.

Target Release: 4.9

Errata Request: async errata for 4.8

Hotfix Request: None.

Additional Info:
Sosreport and reproducer are attached.

This is the same bug as IT #580553 https://bugzilla.redhat.com/show_bug.cgi?id=593675 (RHEL5)

Comment 1 Alan Matsuoka 2010-06-04 18:26:03 UTC
Created attachment 421321 [details]
reproducer.tar.gz

Comment 2 Alan Matsuoka 2010-06-04 18:26:54 UTC
Created attachment 421323 [details]
sosreport-rhel4u8x-373481-dc98bf.tar.bz2

Comment 9 Jaromir Hradilek 2011-01-19 10:52:16 UTC
    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.
    
    New Contents:
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.

Comment 10 errata-xmlrpc 2011-02-16 14:30:54 UTC
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.

http://rhn.redhat.com/errata/RHBA-2011-0248.html