Bug 8142 - '$' in class names vs. dlopen 'dynamic string tokens'
Summary: '$' in class names vs. dlopen 'dynamic string tokens'
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: libgcj (show other bugs)
Version: 3.3
: P3 enhancement
Target Milestone: ---
Assignee: Tom Tromey
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-10-04 06:36 UTC by Ulrich Weigand
Modified: 2003-07-25 17:33 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

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.

Release:
gcc 3.3

Environment:
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
Cc:  
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.
 
 Patches:
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/ChangeLog.diff?cvsroot=gcc&r1=1.1484&r2=1.1485
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/java/lang/natClassLoader.cc.diff?cvsroot=gcc&r1=1.51&r2=1.52
 
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