Bug 8142 - '$' in class names vs. dlopen 'dynamic string tokens'
'$' in class names vs. dlopen 'dynamic string tokens'
Product: gcc
Classification: Unclassified
Component: libgcj
: P3 enhancement
: ---
Assigned To: Tom Tromey
Depends on:
  Show dependency treegraph
Reported: 2002-10-04 06:36 UTC by Ulrich Weigand
Modified: 2003-07-25 17:33 UTC (History)
3 users (show)

See Also:
Known to work:
Known to fail:
Last reconfirmed:


Note You need to log in before you can comment on or make changes to this bug.
Description Ulrich Weigand 2002-10-04 06:36:01 UTC
libgcj passes class names to dlopen to find shared
libraries implementing the class.  In particular, 
in the case of inner classes, this name will contains 
'$' characters.

However, the Linux dlopen implementation interprets '$'
to signify a 'dynamic string token' that is subject to
replacement.  Currently, Linux implements the dynamic
string tokens $ORIGIN and $PLATFORM.

Thus, if an inner class happens to be named ORIGIN or
PLATFORM, dlopen will substitute those strings, and
either the intended shared library will not be found,
or possibly even an incorrect library will be loaded.

Furthermore, there is a bug in glibc 2.2.5 that causes
dlopen to go into an endless loop if the path contains
a '$' that is not followed by one of the recognized
dynamic string tokens.  This causes libgcj to hang 
whenever it tries to load an inner class.

gcc 3.3

Linux (glibc 2.x, x >= 1)
Comment 1 Mark Wielaard 2002-10-11 22:10:37 UTC
From: mark@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Subject: libgcj/8142
Date: 11 Oct 2002 22:10:37 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Changes by:	mark@gcc.gnu.org	2002-10-11 15:10:37
 Modified files:
 	libjava        : ChangeLog 
 	libjava/java/lang: natClassLoader.cc 
 Log message:
 	Fix for PR libgcj/8142
 	* java/lang/natClassLoader.cc (findClass): Skip inner classes when
 	loading native modules.
Comment 2 Tom Tromey 2002-11-02 15:35:01 UTC
Responsible-Changed-From-To: unassigned->tromey
Responsible-Changed-Why: I'm handling the administrivia
Comment 3 Tom Tromey 2002-11-02 15:35:01 UTC
State-Changed-From-To: open->closed
State-Changed-Why: A patch to fix this was checked in