Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove glibc from alpine_jdk11 #1361

Merged
merged 2 commits into from May 26, 2022
Merged

Remove glibc from alpine_jdk11 #1361

merged 2 commits into from May 26, 2022

Conversation

basil
Copy link
Member

@basil basil commented May 26, 2022

JDK-8247589 was backported to OpenJDK 11.0.16 upstream (slated for a July 19, 2022 GA) in openjdk/jdk11u-dev#910, but it appears to have been backported to Adoptium/Temurin sooner than that in adoptium/jdk11u#7 and is already shipping in Temurin 11.0.15. As a result it is no longer necessary to include glibc.

Testing done

Built this Docker image. Verified that java is not linking against glibc:

$ ldd /opt/java/openjdk/bin/java
        /lib/ld-musl-x86_64.so.1 (0x7f1ec5295000)
        libjli.so => /opt/java/openjdk/bin/../lib/jli/libjli.so (0x7f1ec527e000)
        libc.musl-x86_64.so.1 => /lib/ld-musl-x86_64.so.1 (0x7f1ec5295000)
        libz.so.1 => /lib/libz.so.1 (0x7f1ec5264000)

Installed Jenkins and verified there were no errors or stack traces printed in the console log. Then went to the script console and induced a crash:

import java.lang.reflect.Field
import sun.misc.Unsafe

Field f = Unsafe.class.getDeclaredField("theUnsafe")
f.setAccessible(true)
Unsafe unsafe = (Unsafe) f.get(null)
unsafe.putAddress(0, 0)

Examining the resulting HotSpot error file, I see that musl is loaded in the process address space:

$ grep -i musl /tmp/hs_err_pid6.log
7fe98557e000-7fe985593000 r--p 00000000 00:52 50                         /lib/ld-musl-x86_64.so.1
7fe985593000-7fe9855db000 r-xp 00015000 00:52 50                         /lib/ld-musl-x86_64.so.1
7fe9855db000-7fe985611000 r--p 0005d000 00:52 50                         /lib/ld-musl-x86_64.so.1
7fe985611000-7fe985612000 r--p 00092000 00:52 50                         /lib/ld-musl-x86_64.so.1
7fe985612000-7fe985613000 rw-p 00093000 00:52 50                         /lib/ld-musl-x86_64.so.1

Additionally I see the following strings:

libc:musl - unknown musl - unknown
vm_info: OpenJDK 64-Bit Server VM (11.0.15+10) for linux-amd64-musl JRE (11.0.15+10), built on Apr 19 2022 22:14:51 by "" with gcc 10.3.1 20211027

The former indicates that https://github.com/adoptium/jdk11u/blob/982989d67b04ab2c4047c31acbf02e82b55c3072/src/hotspot/os/linux/os_linux.cpp#L626= must have been executed, which implies MUSL_LIBC must have been defined when compiling the software.

@basil basil requested a review from a team as a code owner May 26, 2022 00:02
Comment on lines +22 to +23
musl-locales \
musl-locales-lang \
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@basil basil mentioned this pull request May 26, 2022
Copy link
Member

@timja timja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@timja timja merged commit e9e4c2d into jenkinsci:master May 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants