From nobody@FreeBSD.ORG Fri Jun 11 01:35:37 1999
Return-Path: <nobody@FreeBSD.ORG>
Received: by hub.freebsd.org (Postfix, from userid 32767)
	id 11F2F14EF0; Fri, 11 Jun 1999 01:35:37 -0700 (PDT)
Message-Id: <19990611083537.11F2F14EF0@hub.freebsd.org>
Date: Fri, 11 Jun 1999 01:35:37 -0700 (PDT)
From: pavel_roskin@geocities.com
Sender: nobody@FreeBSD.ORG
To: freebsd-gnats-submit@freebsd.org
Subject: Process cannot call external functions after dlclose(self)
X-Send-Pr-Version: www-1.0

>Number:         12129
>Category:       bin
>Synopsis:       Process cannot call external functions after dlclose(self)
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    jdp
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Jun 11 01:40:01 PDT 1999
>Closed-Date:    Thu Jun 24 21:52:06 PDT 1999
>Last-Modified:  Thu Jun 24 21:53:03 PDT 1999
>Originator:     Pavel Roskin
>Release:        3.2-RELEASE
>Organization:
Contex Ltd., Saint Petersburg, Russia
>Environment:
FreeBSD liverpool.typhoon.spb.ru 3.2-RELEASE FreeBSD 3.2-RELEASE #0: Tue May 18
04:05:08 GMT 1999     jkh@cathair:/usr/src/sys/compile/GENERIC  i386
>Description:
Executable compiled with -Wl,--export-dynamic can call dlopen(0,RTLD_LAZY)
and access its own symbols. However, dlclose(handle) where handle is
returned by that dlopen() makes the process behave incorrectly.
Notably, the process cannot call external functions anymore,
not even exit().
>How-To-Repeat:
#include <dlfcn.h>
#include <stdio.h>

int
main ()
{
>Fix:
  void* handle;
  handle = dlopen(0, RTLD_LAZY);
  dlclose(handle);
  return 0;
}
Or just run "make check" in ftp://ftp.gnu.org/pub/gnu/libtool/libtool-1.3.2.tar.gz

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->jdp 
Responsible-Changed-By: msmith 
Responsible-Changed-When: Wed Jun 23 17:10:50 PDT 1999 
Responsible-Changed-Why:  
This is a toolchain/dynlinker issue. 
State-Changed-From-To: open->closed 
State-Changed-By: jdp 
State-Changed-When: Thu Jun 24 21:52:06 PDT 1999 
State-Changed-Why:  
Fixed in src/libexec/rtld-elf/rtld.c revision 1.25 (current) and 
1.13.2.10 (stable). 
>Unformatted:
