Bug 1081

Summary: fix recursive dlclose
Product: glibc Reporter: Roland McGrath <roland>
Component: libcAssignee: Roland McGrath <roland>
Status: RESOLVED FIXED    
Severity: normal CC: glibc-bugs
Priority: P2    
Version: 2.3.5   
Target Milestone: ---   
Host: Target:
Build: Last reconfirmed:
Bug Depends on:    
Bug Blocks: 852    

Description Roland McGrath 2005-07-18 01:17:49 UTC
This trunk patch should go into the 2.3 branch:

2005-04-26  Jakub Jelinek  <jakub@redhat.com>

	* elf/dl-close.c: Include stddef.h.
	(_dl_close): If called recursively, just remember GC needs to be rerun
	and decrease l_direct_opencount.  Avoid GC if l_direct_opencount
	decreased to 1.  Rerun GC at the end if any destructor unloaded some
	additional libraries.
	* elf/Makefile: Add rules to build and run unload6 test.
	* elf/unload6.c: New test.
	* elf/unload6mod1.c: New file.
	* elf/unload6mod2.c: New file.
	* elf/unload6mod3.c: New file.
Comment 1 Sourceware Commits 2005-07-18 01:19:53 UTC
Subject: Bug 1081

CVSROOT:	/cvs/glibc
Module name:	libc
Branch: 	glibc-2_3-branch
Changes by:	roland@sources.redhat.com	2005-07-18 01:19:49

Modified files:
	elf            : dl-close.c Makefile 

Log message:
	2005-04-26  Jakub Jelinek  <jakub@redhat.com>
	
	[BZ #1081]
	* elf/dl-close.c: Include stddef.h.
	(_dl_close): If called recursively, just remember GC needs to be rerun
	and decrease l_direct_opencount.  Avoid GC if l_direct_opencount
	decreased to 1.  Rerun GC at the end if any destructor unloaded some
	additional libraries.
	* elf/Makefile: Add rules to build and run unload6 test.
	* elf/unload6.c: New test.
	* elf/unload6mod1.c: New file.
	* elf/unload6mod2.c: New file.
	* elf/unload6mod3.c: New file.

Patches:
http://sources.redhat.com/cgi-bin/cvsweb.cgi/libc/elf/dl-close.c.diff?cvsroot=glibc&only_with_tag=glibc-2_3-branch&r1=1.107.2.2&r2=1.107.2.3
http://sources.redhat.com/cgi-bin/cvsweb.cgi/libc/elf/Makefile.diff?cvsroot=glibc&only_with_tag=glibc-2_3-branch&r1=1.287.2.4&r2=1.287.2.5

Comment 2 Sourceware Commits 2005-07-18 01:22:22 UTC
Subject: Bug 1081

CVSROOT:	/cvs/glibc
Module name:	libc
Branch: 	glibc-2_3-branch
Changes by:	roland@sources.redhat.com	2005-07-18 01:22:18

Added files:
	elf            : unload6mod1.c unload6mod2.c unload6mod3.c 
	                 unload6.c 

Log message:
	2005-04-26  Jakub Jelinek  <jakub@redhat.com>
	
	[BZ #1081]
	* elf/dl-close.c: Include stddef.h.
	(_dl_close): If called recursively, just remember GC needs to be rerun
	and decrease l_direct_opencount.  Avoid GC if l_direct_opencount
	decreased to 1.  Rerun GC at the end if any destructor unloaded some
	additional libraries.
	* elf/Makefile: Add rules to build and run unload6 test.
	* elf/unload6.c: New test.
	* elf/unload6mod1.c: New file.
	* elf/unload6mod2.c: New file.
	* elf/unload6mod3.c: New file.

Patches:
http://sources.redhat.com/cgi-bin/cvsweb.cgi/libc/elf/unload6mod1.c.diff?cvsroot=glibc&only_with_tag=glibc-2_3-branch&r1=NONE&r2=1.1.4.1
http://sources.redhat.com/cgi-bin/cvsweb.cgi/libc/elf/unload6mod2.c.diff?cvsroot=glibc&only_with_tag=glibc-2_3-branch&r1=NONE&r2=1.1.4.1
http://sources.redhat.com/cgi-bin/cvsweb.cgi/libc/elf/unload6mod3.c.diff?cvsroot=glibc&only_with_tag=glibc-2_3-branch&r1=NONE&r2=1.1.4.1
http://sources.redhat.com/cgi-bin/cvsweb.cgi/libc/elf/unload6.c.diff?cvsroot=glibc&only_with_tag=glibc-2_3-branch&r1=NONE&r2=1.1.4.1

Comment 3 Roland McGrath 2005-07-19 03:30:49 UTC
This fix is now in the 2.3 branch as well as the trunk, and the problem should
be resolved as of the 2.3.6 release.