Bug 28920 - ldd crashes when it can't find libjvm.so
Summary: ldd crashes when it can't find libjvm.so
Status: RESOLVED DUPLICATE of bug 28868
Alias: None
Product: glibc
Classification: Unclassified
Component: libc (show other bugs)
Version: 2.35
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-02-23 16:35 UTC by Hussam Al-Tayeb
Modified: 2022-03-02 13:40 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Hussam Al-Tayeb 2022-02-23 16:35:38 UTC
archlinux gcc 11.2 / binutils 2.38/ glibc 2.35

ldd  /usr/lib/jvm/default-runtime/lib/libnio.so returns nothing.
It actually segfaults without any valid trace.

LD_LIBRARY_PATH=/usr/lib/jvm/default-runtime/lib/server ldd /usr/lib/jvm/default-runtime/lib/libnio.so avoids the segfault.
This was not an issue in previous versions of glibc.

I tried archlinux's jdk, adoptium eclipse jdk, oracle jdk, and many other jdk flavors. I even compiled openjdk myself. all result in a same issue.

An Archlinux developer confirmed the segfault so this isn't a local problem on my machine.
Comment 1 Adhemerval Zanella 2022-02-23 16:50:44 UTC
I think this is duplicate of bz#28868.  Could you check if https://patchwork.sourceware.org/project/glibc/list/?series=7467 fixes it?
Comment 2 Hussam Al-Tayeb 2022-02-23 17:18:20 UTC
(In reply to Adhemerval Zanella from comment #1)
> I think this is duplicate of bz#28868.  Could you check if
> https://patchwork.sourceware.org/project/glibc/list/?series=7467 fixes it?

It does.
 ldd libnio.so 
ldd: warning: you do not have execution permission for `./libnio.so'
	linux-vdso.so.1 (0x00007ffcff9ba000)
	libjava.so => /usr/lib/jvm/java-17-temurin/lib/./libjava.so (0x00007f9140000000)
	libnet.so => /usr/lib/jvm/java-17-temurin/lib/./libnet.so (0x00007f913fc00000)
	libpthread.so.0 => /usr/lib/libpthread.so.0 (0x00007f91407e1000)
	libdl.so.2 => /usr/lib/libdl.so.2 (0x00007f91407dc000)
	libc.so.6 => /usr/lib/libc.so.6 (0x00007f9140628000)
	/usr/lib64/ld-linux-x86-64.so.2 (0x00007f9140803000)
	libjvm.so => not found
	libjvm.so => not found


Why the double libjvm.so => not found though?
Comment 3 Adhemerval Zanella 2022-02-23 17:30:47 UTC
(In reply to Hussam Al-Tayeb from comment #2)
> (In reply to Adhemerval Zanella from comment #1)
> > I think this is duplicate of bz#28868.  Could you check if
> > https://patchwork.sourceware.org/project/glibc/list/?series=7467 fixes it?
> 
> It does.
>  ldd libnio.so 
> ldd: warning: you do not have execution permission for `./libnio.so'
> 	linux-vdso.so.1 (0x00007ffcff9ba000)
> 	libjava.so => /usr/lib/jvm/java-17-temurin/lib/./libjava.so
> (0x00007f9140000000)
> 	libnet.so => /usr/lib/jvm/java-17-temurin/lib/./libnet.so
> (0x00007f913fc00000)
> 	libpthread.so.0 => /usr/lib/libpthread.so.0 (0x00007f91407e1000)
> 	libdl.so.2 => /usr/lib/libdl.so.2 (0x00007f91407dc000)
> 	libc.so.6 => /usr/lib/libc.so.6 (0x00007f9140628000)
> 	/usr/lib64/ld-linux-x86-64.so.2 (0x00007f9140803000)
> 	libjvm.so => not found
> 	libjvm.so => not found

Thanks for checking on it.

> 
> 
> Why the double libjvm.so => not found though?

Because /usr/lib/jvm/java-17-temurin/lib/./libjava.so and /usr/lib/jvm/java-17-temurin/lib/./libnet.so both have libjvm.so as DT_NEEDED and loaders does not keep track if the object already was printted for LD_TRACE_LOADED_OBJECTS.
Comment 4 Adhemerval Zanella 2022-02-23 17:31:15 UTC
As per previous comments.

*** This bug has been marked as a duplicate of bug 28868 ***
Comment 5 Hussam Al-Tayeb 2022-02-25 16:39:48 UTC
On Wed, 2022-02-23 at 17:30 +0000, adhemerval.zanella at linaro dot org
wrote:
> Because /usr/lib/jvm/java-17-temurin/lib/./libjava.so and
> /usr/lib/jvm/java-17-temurin/lib/./libnet.so both have libjvm.so as
> DT_NEEDED
> and loaders does not keep track if the object already was printted
> for
> LD_TRACE_LOADED_OBJECTS.
> 

So it's not sorted in a tree format? Why are they both showing at end
instead one of the entries after libjava.so?