Skip to content

Instantly share code, notes, and snippets.

@unix-junkie
Last active June 27, 2023 23:16
Show Gist options
  • Save unix-junkie/a58b74a44182e492bfef75e25f1033f4 to your computer and use it in GitHub Desktop.
Save unix-junkie/a58b74a44182e492bfef75e25f1033f4 to your computer and use it in GitHub Desktop.

Steps to reproduce

unset LD_LIBRARY_PATH 
unset LD_PRELOAD 
unset _JAVA_OPTIONS 
unset JAVA_TOOL_OPTIONS

export JAVA_HOME=/usr/lib/jvm/java-1.3.1_20-sun-i386
export JRE_HOME=${JAVA_HOME}/jre
export PATH=${JAVA_HOME}/bin:${JRE_HOME}/bin:${PATH}
export DEBUG_PROG='gdb --args'

java -version

From within gdb:

b main
r
b canonicalize
cont

Normal behaviour (Glibc 2.24)

Debian 9:

$ /lib/i386-linux-gnu/libc.so.6 
GNU C Library (Debian GLIBC 2.24-11+deb9u4) stable release version 2.24, by Roland McGrath et al.
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
Compiled by GNU CC version 6.3.0 20170516.
Available extensions:
        crypt add-on version 2.1 by Michael Glad and others
        GNU Libidn by Simon Josefsson
        Native POSIX Threads Library by Ulrich Drepper et al
        BIND-8.2.3-T5B
libc ABIs: UNIQUE IFUNC
For bug reporting instructions, please see:
<http://www.debian.org/Bugs/>.

Backtrace

#0  0xf79c304a in canonicalize () from /usr/lib/jvm/java-1.3.1_20-sun-i386/jre/lib/i386/libjava.so
#1  0xf79bec50 in Canonicalize () from /usr/lib/jvm/java-1.3.1_20-sun-i386/jre/lib/i386/libjava.so
#2  0xf7d05c4b in ClassLoader::get_canonical_path(char *, char *, int) () from /usr/lib/jvm/java-1.3.1_20-sun-i386/jre/lib/x86_64/client/libjvm.so
#3  0xf7d0506f in ClassLoader::setup_bootstrap_search_path(void) () from /usr/lib/jvm/java-1.3.1_20-sun-i386/jre/lib/x86_64/client/libjvm.so
#4  0xf7d05cad in classLoader_init(void) () from /usr/lib/jvm/java-1.3.1_20-sun-i386/jre/lib/x86_64/client/libjvm.so
#5  0xf7d1bad3 in init_globals(void) () from /usr/lib/jvm/java-1.3.1_20-sun-i386/jre/lib/x86_64/client/libjvm.so
#6  0xf7de14ea in Threads::create_vm(JavaVMInitArgs *) () from /usr/lib/jvm/java-1.3.1_20-sun-i386/jre/lib/x86_64/client/libjvm.so
#7  0xf7d4b620 in JNI_CreateJavaVM () from /usr/lib/jvm/java-1.3.1_20-sun-i386/jre/lib/x86_64/client/libjvm.so
#8  0x08049bca in InitializeJVM ()
#9  0x08048fd0 in main ()

Abnormal behaviour (Glibc 2.25+)

Debian 10:

$ /lib/i386-linux-gnu/libc.so.6 
GNU C Library (Debian GLIBC 2.28-10+deb10u2) stable release version 2.28.
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
Compiled by GNU CC version 8.3.0.
libc ABIs: UNIQUE IFUNC ABSOLUTE
For bug reporting instructions, please see:
<http://www.debian.org/Bugs/>.

Backtrace

#0  __canonicalize (cx=0x8050d50, x=0xffff948c) at ./s_canonicalize_template.c:24
#1  0xf7fa9c50 in Canonicalize () from /usr/lib/jvm/java-1.3.1_20-sun-i386/jre/lib/i386/libjava.so
#2  0xf7c8dc4b in ClassLoader::get_canonical_path(char *, char *, int) () from /usr/lib/jvm/java-1.3.1_20-sun-i386/jre/lib/x86_64/client/libjvm.so
#3  0xf7c8d06f in ClassLoader::setup_bootstrap_search_path(void) () from /usr/lib/jvm/java-1.3.1_20-sun-i386/jre/lib/x86_64/client/libjvm.so
#4  0xf7c8dcad in classLoader_init(void) () from /usr/lib/jvm/java-1.3.1_20-sun-i386/jre/lib/x86_64/client/libjvm.so
#5  0xf7ca3ad3 in init_globals(void) () from /usr/lib/jvm/java-1.3.1_20-sun-i386/jre/lib/x86_64/client/libjvm.so
#6  0xf7d694ea in Threads::create_vm(JavaVMInitArgs *) () from /usr/lib/jvm/java-1.3.1_20-sun-i386/jre/lib/x86_64/client/libjvm.so
#7  0xf7cd3620 in JNI_CreateJavaVM () from /usr/lib/jvm/java-1.3.1_20-sun-i386/jre/lib/x86_64/client/libjvm.so
#8  0x08049bca in InitializeJVM ()
#9  0x08048fd0 in main ()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment