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

minecraft-launcher: segfault in versions later than 0.9.66 #4961

Open
5 of 7 tasks
benaryorg opened this issue Feb 18, 2022 · 7 comments
Open
5 of 7 tasks

minecraft-launcher: segfault in versions later than 0.9.66 #4961

benaryorg opened this issue Feb 18, 2022 · 7 comments

Comments

@benaryorg
Copy link

Description

Hard SIGSEGV when running minecraft-launcher in corresponding profile.

Steps to Reproduce

  1. firejail "--private=${custom_path?}" minecraft-launcher (LC_ALL=C.utf8 is my default)
  2. login
  3. start game
  4. See error №6, see below for detailed log output
Click to expand
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007f41675e3661, pid=401, tid=403
#
# JRE version: OpenJDK Runtime Environment Temurin-17.0.2+8 (17.0.2+8) (build 17.0.2+8)
# Java VM: OpenJDK 64-Bit Server VM Temurin-17.0.2+8 (17.0.2+8, mixed mode, sharing, tiered, compressed class ptrs, z gc, linux-amd64)
# Problematic frame:
# C  [libc.so.6+0x75661]  fgets+0x21
#
# Core dump will be written. Default location: core.401 (may not exist)
#
# If you would like to submit a bug report, please visit:
#   https://github.com/adoptium/adoptium-support/issues
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#

---------------  S U M M A R Y ------------

Command Line: […]

Host: AMD Ryzen 9 3900XT 12-Core Processor, 24 cores, 62G, Linux
Time: Fri Feb 18 21:44:38 2022 UTC elapsed time: 11.473674 seconds (0d 0h 0m 11s)

---------------  T H R E A D  ---------------

Current thread (0x00007f4160031340):  JavaThread "Render thread" [_thread_in_native, id=403, stack(0x00007f4165d62000,0x00007f4165e62000)]

Stack: [0x00007f4165d62000,0x00007f4165e62000],  sp=0x00007f4165e5cf80,  free space=1003k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C  [libc.so.6+0x75661]  fgets+0x21

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j  org.lwjgl.util.tinyfd.TinyFileDialogs.ntinyfd_messageBox(JJJJI)I+0 org.lwjgl.tinyfd
j  org.lwjgl.util.tinyfd.TinyFileDialogs.tinyfd_messageBox(Ljava/lang/CharSequence;Ljava/lang/CharSequence;Ljava/lang/CharSequence;Ljava/lang/CharSequence;Z)Z+106 org.lwjgl.tinyfd
j  com.mojang.blaze3d.platform.Window.m_85412_(IJ)V+30 [email protected]
j  com.mojang.blaze3d.platform.Window$$Lambda$4284+0x00000008016ff3f8.invoke(IJ)V+2 [email protected]
j  org.lwjgl.glfw.GLFWErrorCallbackI.callback(J)V+9 org.lwjgl.glfw
v  ~StubRoutines::call_stub
j  org.lwjgl.system.JNI.invokePPPP(IIJJJJ)J+0 org.lwjgl
j  org.lwjgl.glfw.GLFW.nglfwCreateWindow(IIJJJ)J+14 org.lwjgl.glfw
j  org.lwjgl.glfw.GLFW.glfwCreateWindow(IILjava/lang/CharSequence;JJ)J+37 org.lwjgl.glfw
j  net.minecraftforge.client.loading.NoVizFallback.lambda$fallback$0(Ljava/util/function/IntSupplier;Ljava/util/function/IntSupplier;Ljava/util/function/Supplier;Ljava/util/function/LongSupplier;)J+28 [email protected]
j  net.minecraftforge.client.loading.NoVizFallback$$Lambda$4293+0x0000000801704208.getAsLong()J+16 [email protected]
j  net.minecraftforge.fml.loading.progress.EarlyProgressVisualization$Visualization$$Lambda$4294+0x00000008016faa98.apply(Ljava/lang/Object;)Ljava/lang/Object;+4 [email protected]
J 4324 c2 java.util.Optional.map(Ljava/util/function/Function;)Ljava/util/Optional; [email protected] (30 bytes) @ 0x00007f41510a2ba0 [0x00007f41510a2b20+0x0000000000000080]
j  net.minecraftforge.fml.loading.progress.EarlyProgressVisualization$Visualization.handOffWindow(Ljava/util/function/IntSupplier;Ljava/util/function/IntSupplier;Ljava/util/function/Supplier;Ljava/util/function/LongSupplier;)J+48 [email protected]
j  net.minecraftforge.fml.loading.progress.EarlyProgressVisualization.handOffWindow(Ljava/util/function/IntSupplier;Ljava/util/function/IntSupplier;Ljava/util/function/Supplier;Ljava/util/function/LongSupplier;)J+9 [email protected]
j  com.mojang.blaze3d.platform.Window.<init>(Lcom/mojang/blaze3d/platform/WindowEventHandler;Lcom/mojang/blaze3d/platform/ScreenManager;Lcom/mojang/blaze3d/platform/DisplayData;Ljava/lang/String;Ljava/lang/String;)V+279 [email protected]
j  net.minecraft.client.renderer.VirtualScreen.m_110872_(Lcom/mojang/blaze3d/platform/DisplayData;Ljava/lang/String;Ljava/lang/String;)Lcom/mojang/blaze3d/platform/Window;+15 [email protected]
j  net.minecraft.client.Minecraft.<init>(Lnet/minecraft/client/main/GameConfig;)V+709 [email protected]
j  net.minecraft.client.main.Main.main([Ljava/lang/String;)V+1347 [email protected]
v  ~StubRoutines::call_stub
J 5804  jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Ljava/lang/reflect/Method;Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object; [email protected] (0 bytes) @ 0x00007f4151361c53 [0x00007f4151361bc0+0x0000000000000093]
J 5803 c1 jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object; [email protected] (137 bytes) @ 0x00007f414a53b8cc [0x00007f414a53ae80+0x0000000000000a4c]
J 4622 c1 jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object; [email protected] (10 bytes) @ 0x00007f4149da17ec [0x00007f4149da16c0+0x000000000000012c]
J 4621 c1 java.lang.reflect.Method.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object; [email protected] (65 bytes) @ 0x00007f4149da07fc [0x00007f4149da0480+0x000000000000037c]
j  net.minecraftforge.fml.loading.targets.CommonClientLaunchHandler.lambda$launchService$0(Ljava/lang/ModuleLayer;[Ljava/lang/String;)Ljava/lang/Void;+40 [email protected]
j  net.minecraftforge.fml.loading.targets.CommonClientLaunchHandler$$Lambda$774+0x0000000800fa99b8.call()Ljava/lang/Object;+8 [email protected]
j  cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch([Ljava/lang/String;Ljava/lang/ModuleLayer;)V+11 [email protected]
j  cpw.mods.modlauncher.LaunchServiceHandler.launch(Ljava/lang/String;[Ljava/lang/String;Ljava/lang/ModuleLayer;Lcpw/mods/modlauncher/TransformingClassLoader;Lcpw/mods/modlauncher/LaunchPluginHandler;)V+58 [email protected]
j  cpw.mods.modlauncher.LaunchServiceHandler.launch(Lcpw/mods/modlauncher/ArgumentHandler;Ljava/lang/ModuleLayer;Lcpw/mods/modlauncher/TransformingClassLoader;Lcpw/mods/modlauncher/LaunchPluginHandler;)V+21 [email protected]
j  cpw.mods.modlauncher.Launcher.run([Ljava/lang/String;)V+310 [email protected]
j  cpw.mods.modlauncher.Launcher.main([Ljava/lang/String;)V+78 [email protected]
j  cpw.mods.modlauncher.BootstrapLaunchConsumer.accept([Ljava/lang/String;)V+1 [email protected]
j  cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(Ljava/lang/Object;)V+5 [email protected]
j  cpw.mods.bootstraplauncher.BootstrapLauncher.main([Ljava/lang/String;)V+536 [email protected]
v  ~StubRoutines::call_stub

siginfo: si_signo: 11 (SIGSEGV), si_code: 1 (SEGV_MAPERR), si_addr: 0x0000000000000000

Seems to be a solid NULL-deref.

Expected behavior

It's supposed to launch the game as usual.

Actual behavior

The above error is thrown and no game ever appears.

Behavior without a profile

Doesn't start at all
Parent pid 29380, child pid 29381
Child process initialized in 9.59 ms

Parent is shutting down, bye...

Additional context

The problem was introduced after firejail-0.9.66.
That version works as expected, while the update to 0.9.68 introduces the error.

firejail version 0.9.66 (working)
Compile time support:
        - always force nonewprivs support is disabled
        - AppArmor support is disabled
        - AppImage support is enabled
        - chroot support is enabled
        - D-BUS proxy support is enabled
        - file and directory whitelisting support is enabled
        - file transfer support is enabled
        - firetunnel support is disabled
        - networking support is enabled
        - output logging is enabled
        - overlayfs support is disabled
        - private-home support is enabled
        - private-cache and tmpfs as user enabled
        - SELinux support is disabled
        - user namespace support is enabled
        - X11 sandboxing support is enabled
firejail version 0.9.68 (broken)
Compile time support:
        - always force nonewprivs support is disabled
        - AppArmor support is disabled
        - AppImage support is enabled
        - chroot support is enabled
        - D-BUS proxy support is enabled
        - file transfer support is enabled
        - firetunnel support is disabled
        - networking support is enabled
        - output logging is enabled
        - overlayfs support is disabled
        - private-home support is enabled
        - private-cache and tmpfs as user enabled
        - SELinux support is disabled
        - user namespace support is enabled
        - X11 sandboxing support is enabled

Environment

  • Gentoo
  • see above

Checklist

  • The issues is caused by firejail: older firejail version works, no other changes
  • I can reproduce the issue without custom modifications: only modification is the removal of private-opt to use a newer java version, the bundled one fails too however
  • The program has a profile: minecraft-launcher
  • The profile (and redirect profile if exists) hasn't already been fixed upstream: there do not seem to be related commits in the range dae6c65 through ba437e7
  • I have performed a short search for similar issues (to avoid opening a duplicate): keywords are a little tricky with that one, sorry if this is a dupe
    • I'm aware of browser-allow-drm yes/browser-disable-u2f no in firejail.config to allow DRM/U2F in browsers: shouldn't be relevant
  • I used --profile=PROFILENAME to set the right profile. (Only relevant for AppImages)

Log

Output of LC_ALL=C firejail /path/to/program

Reading profile /etc/firejail/minecraft-launcher.profile
Reading profile /etc/firejail/allow-java.inc
Reading profile /etc/firejail/disable-common.inc
Reading profile /etc/firejail/disable-devel.inc
Reading profile /etc/firejail/disable-exec.inc
Reading profile /etc/firejail/disable-interpreters.inc
Reading profile /etc/firejail/disable-programs.inc
Reading profile /etc/firejail/disable-shell.inc
Reading profile /etc/firejail/disable-xdg.inc
Reading profile /etc/firejail/whitelist-common.inc
Reading profile /etc/firejail/whitelist-runuser-common.inc
Reading profile /etc/firejail/whitelist-usr-share-common.inc
Reading profile /etc/firejail/whitelist-var-common.inc
Parent pid 29562, child pid 29563
Warning: NVIDIA card detected, nogroups command ignored
Warning: NVIDIA card detected, nogroups command ignored
Warning: NVIDIA card detected, nogroups command ignored
Warning: NVIDIA card detected, nogroups command ignored
3 programs installed in 2.79 ms
Warning: An abstract unix socket for session D-BUS might still be available. Use --net or remove unix from --protocol set.
Warning: skipping alternatives for private /etc
Warning: skipping ati for private /etc
Warning: skipping crypto-policies for private /etc
Warning: skipping drirc for private /etc
Warning: skipping hostname for private /etc
Warning: skipping java-10-openjdk for private /etc
Warning: skipping java-11-openjdk for private /etc
Warning: skipping java-12-openjdk for private /etc
Warning: skipping java-13-openjdk for private /etc
Warning: skipping java-14-openjdk for private /etc
Warning: skipping java-7-openjdk for private /etc
Warning: skipping java-8-openjdk for private /etc
Warning: skipping java-9-openjdk for private /etc
Warning: skipping java-openjdk for private /etc
Warning: skipping nvidia for private /etc
Warning: skipping pki for private /etc
Warning: skipping selinux for private /etc
Warning fcopy: skipping /etc/X11/startDM.sh, cannot find inode
Private /etc installed in 18.23 ms
Private /usr/etc installed in 0.00 ms
Blacklist violations are logged to syslog
Warning: NVIDIA card detected, nogroups command ignored
Warning: NVIDIA card detected, nogroups command ignored
Child process initialized in 59.26 ms
https://launchermeta.mojang.com/v1/products/launcher/6f083b80d5e6fabbc4236f81d0d8f8a350c665a9/linux.json
[0218/222620.528597:ERROR:address_tracker_linux.cc(214)] Could not bind NETLINK socket: Address already in use (98)
[0218/222620.533890:INFO:main_context.cpp(137)] CEF initialized successfully.
[0218/222620.533924:INFO:main_context.cpp(139)] CEF version: 86.0.23+ga2c2edf+chromium-86.0.4240.193

(minecraft-launcher:36): dbind-WARNING **: 22:26:20.566: Couldn't connect to accessibility bus: Failed to connect to socket /tmp/dbus-wILK2vPpjW: No such file or directory
[0218/222620.566602:ERROR:angle_platform_impl.cc(43)] initialize(797): ANGLE Display::initialize error 12289: Could not create a backing OpenGL context.
[0218/222620.566706:ERROR:gl_surface_egl.cc(767)] EGL Driver message (Critical) eglInitialize: Could not create a backing OpenGL context.
[0218/222620.566739:ERROR:gl_surface_egl.cc(1295)] eglInitialize OpenGL failed with error EGL_NOT_INITIALIZED, trying next display type
[0218/222620.572542:ERROR:angle_platform_impl.cc(43)] initialize(797): ANGLE Display::initialize error 12289: Could not create a backing OpenGL context.
[0218/222620.572621:ERROR:gl_surface_egl.cc(767)] EGL Driver message (Critical) eglInitialize: Could not create a backing OpenGL context.
[0218/222620.572653:ERROR:gl_surface_egl.cc(1295)] eglInitialize OpenGLES failed with error EGL_NOT_INITIALIZED
[0218/222620.572681:ERROR:gl_initializer_linux_x11.cc(160)] GLSurfaceEGL::InitializeOneOff failed.
[0218/222620.573479:ERROR:viz_main_impl.cc(229)] Exiting GPU process due to errors during initialization
Created browser window for reuse: 0x1a00001
[0218/222620.761130:INFO:LauncherAppRenderer.cpp(518)] OnContextReleased: no frame (unknown context), browser id=1
[0218/222621.276611:ERROR:nss_util.cc(53)] Failed to create /home/benaryorg/.pki/nssdb directory.
Created browser window for reuse: 0x1a00007
[0218/222910.202664:INFO:LauncherAppRenderer.cpp(518)] OnContextReleased: no frame (unknown context), browser id=2
[0218/223008.023547:INFO:LauncherAppRenderer.cpp(518)] OnContextReleased: no frame (unknown context), browser id=2
[0218/223008.104329:WARNING:xproto_util.cc(51)] X error received: serial 1469, error_code 3 (BadWindow (invalid Window parameter)), request_code 4, minor_code 0 (X_DestroyWindow)
Created browser window for reuse: 0x1a0000f
[0218/223015.994086:INFO:LauncherAppRenderer.cpp(51)] [Info: 2022-02-18 22:26:20.520468189: LauncherMain.cpp(104)] Initiated models
[0218/223015.994195:INFO:LauncherAppRenderer.cpp(51)] [Info: 2022-02-18 22:26:20.520655151: LauncherController.cpp(436)] Constructing launcher controller with workDir: /.../.minecraft, isActive: 0
[0218/223015.994223:INFO:LauncherAppRenderer.cpp(51)] [Info: 2022-02-18 22:30:11.743687891: LauncherAppRenderer.cpp(172)] Javascript bridge extended in OnWebKitInitialized.
[0218/223016.303904:INFO:LauncherAppRenderer.cpp(518)] OnContextReleased: no frame (unknown context), browser id=3
[0218/223016.305749:INFO:LauncherAppRenderer.cpp(69)] OnBrowserDestroyed: id=3
[0218/223016.388072:WARNING:xproto_util.cc(51)] X error received: serial 1800, error_code 3 (BadWindow (invalid Window parameter)), request_code 4, minor_code 0 (X_DestroyWindow)

The above output is pretty much the same with the older version too, only after that output the start button is triggered at which point the segfault occurs, but there is no more output from that point onwards.

Output of LC_ALL=C firejail --debug /path/to/program

Same as without the --debug, but with this prepended:

See attached file: log.txt

@reinerh
Copy link
Collaborator

reinerh commented Feb 18, 2022

There are some GL-related error messages, and the backtrace also seems to be in a 3d-related library (while creating a window?).
We recently had a report with crashes (#4960) that was solved by removing no3d, though I couldn't find no3d in minecraft-launcher.profile.

But maybe some related 3d-library is in a different path in Gentoo.

@benaryorg
Copy link
Author

You know what? This thing has 24 cores idling and I've been meaning to put git-bisect to use for some time now.

[a few minutes later]

ea564eb74abaefd791a8c95d51e36c21e5fffcf9 is the first bad commit
commit ea564eb74abaefd791a8c95d51e36c21e5fffcf9
Author: Kelvin M. Klann <[email protected]>
Date:   Sat Oct 16 02:26:17 2021 -0300

    Consider nosound and novideo when keeping groups

    Even when `nogroups` is not used, avoid keeping the audio and video
    groups when `nosound` and `novideo` are used, respectively.

    Based on @rusty-snake's suggestion:
    https://github.com/netblue30/firejail/issues/4603#issuecomment-944046299

    Relates to #4603.

 src/firejail/main.c | 20 ++++++++++++--------
 src/firejail/util.c | 13 ++++++++++---
 2 files changed, 22 insertions(+), 11 deletions(-)

Guess I'll have a look at ea564eb, I'll let you know if I find out anything.

@benaryorg
Copy link
Author

Turns out, it's specifically that video group handling.
If I remove the ifs around the video group handling I get a window again.

Only now did I notice the novideo line in the minecraft-launcher profile, and it seems it's been there since the initial commit for that profile.

I'm not too familiar with the internals, so maybe you can shed some light on the purpose of novideo.?
Because I'm not sure whether it's just out of place in the minecraft-launcher profile, or the handling is at fault?

@rusty-snake
Copy link
Collaborator

rusty-snake commented Feb 19, 2022

purpose of novideo

novideo
Disable video devices.

video devices mean webcam (/dev/video*, /dev/v4l).

out of place in the minecraft-launcher profile,

Unless minecraft(-launcher) has a webcam feature (e.g. for streaming) it is right there.

it's specifically that video group handling.

Related discussion: #4632 (comment)

@benaryorg
Copy link
Author

What fixes it for me is this:

==> /home/benaryorg/.config/firejail/minecraft-launcher.local <==
ignore novideo # required due to nvidia voodoo
ignore private-opt # required for openjdk selection

It seems ignore nogroups does nothing at all.
For me this is a passable workaround so feel free to close the issue unless you're planning to pursue the matter further.

@kmk3
Copy link
Collaborator

kmk3 commented Feb 25, 2022

@benaryorg commented on Feb 25:

What fixes it for me is this:

==> /home/benaryorg/.config/firejail/minecraft-launcher.local <==
ignore novideo # required due to nvidia voodoo
ignore private-opt # required for openjdk selection

It seems ignore nogroups does nothing at all. For me this is a passable
workaround so feel free to close the issue unless you're planning to pursue
the matter further.

Thanks for debugging and for specifying that the problem happens on nvidia.

The aforementioned bisected commit from #4632 would be my first guess as well.
Permalink to it:

ea564eb?diff=unified&w=1

So as I suspected in #4632, it seems that the proprietary nvidia driver indeed
needs both the "render" and "video" groups in order to avoid breakage with
hardware acceleration.

I think I'll change the checks to keep the video group to also consider the
nvidia proprietary driver (+ no no3d).

To clarify the environment:

Are you using openrc and the proprietary nvidia driver?

Are you using udev/eudev?

Which seat manager are you using if any? Examples: logind, elogind, seatd

@benaryorg
Copy link
Author

Are you using openrc and the proprietary nvidia driver?

Correct.
Specifically x11-drivers/nvidia-drivers-510.54.
In case it's relevant I also have cgroup support enabled in OpenRC:

rc_controller_cgroups="YES"
rc_cgroup_mode="unified"
rc_cgroup_controllers="cpuset cpu io memory hugetlb pids systemd"
rc_cgroup_cleanup="YES"
rc_crashed_start=YES
rc_depend_strict="YES"
rc_parallel="NO"
rc_shell=/sbin/sulogin
rc_sys=""
rc_tty_number=12
unicode="YES"

Are you using udev/eudev?

udev, yes.
FYI: eudev was retired on 2022-01-01.

Which seat manager are you using if any? Examples: logind, elogind, seatd

None, plain old startx on tty2 (at which point agetty chowns the tty device to my user for the duration of my session AFAIK).

@kmk3 kmk3 changed the title segfault with minecraft-launcher in versions later than 0.9.66 minecraft-launcher: segfault in versions later than 0.9.66 Aug 23, 2024
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

No branches or pull requests

4 participants