Bug 422653 - Xwayland gets segmentation faults at wl_proxy_marshal_constructor under kwin_wayland 5.18.5
Summary: Xwayland gets segmentation faults at wl_proxy_marshal_constructor under kwin_...
Status: RESOLVED DOWNSTREAM
Alias: None
Product: kwin
Classification: Plasma
Component: wayland-generic (other bugs)
Version First Reported In: 5.18.5
Platform: Gentoo Packages Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-06-08 23:59 UTC by nkde
Modified: 2022-01-19 15:29 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description nkde 2020-06-08 23:59:48 UTC
SUMMARY
Manually execute a new Xwayland instance under kwin_wayland will get segmentation fault.

STEPS TO REPRODUCE
1. Login to KDE wayland session and open a terminal
2. pick an empty DISPLAY (e.g. 10) and execute "Xwayland :10"
3. crash

OBSERVED RESULT
(gdb) run :10
Starting program: /usr/bin/Xwayland :10
...
Thread 1 "Xwayland" received signal SIGSEGV, Segmentation fault.
wl_proxy_marshal_constructor (proxy=0x0, opcode=opcode@entry=0, interface=0x555555787c40 <wl_shell_surface_interface>)
    at /usr/src/debug/dev-libs/wayland-1.18.0/wayland-1.18.0/src/wayland-client.c:830
830 wl_argument_from_va_list(proxy->object.interface->methods[opcode].signature,
(gdb) bt
#0  wl_proxy_marshal_constructor (proxy=0x0, opcode=opcode@entry=0, interface=0x555555787c40 <wl_shell_surface_interface>)
    at /usr/src/debug/dev-libs/wayland-1.18.0/wayland-1.18.0/src/wayland-client.c:830
#1  0x000055555558d4b2 in wl_shell_get_shell_surface (surface=<optimized out>, wl_shell=<optimized out>)
    at /usr/include/wayland-client-protocol.h:2926
#2  ensure_surface_for_window (window=window@entry=0x555555f46a00) at xwayland.c:565
#3  0x000055555558db51 in xwl_realize_window (window=0x555555f46a00) at xwayland.c:645
#4  0x00005555556be685 in compRealizeWindow (pWin=0x555555f46a00) at compwindow.c:268
#5  0x0000555555700827 in MapWindow (pWin=pWin@entry=0x555555f46a00, client=0x5555557bdf70) at window.c:2715
#6  0x00005555557009e7 in InitRootWindow (pWin=0x555555f46a00) at window.c:701
#7  0x00005555556d4b08 in dix_main (argc=2, argv=0x7fffffffdc38, envp=<optimized out>) at main.c:247
#8  0x00005555556bf3d6 in main (argc=<optimized out>, argv=<optimized out>, envp=<optimized out>) at stubmain.c:34

EXPECTED RESULT
Xwayland runs successfully without crash

SOFTWARE/OS VERSIONS
I can reproduce this bug in two environments.

The above backtrace comes from the first environment:
Operating System: Gentoo Linux 
KDE Plasma Version: 5.18.5
KDE Frameworks Version: 5.70.0
Qt Version: 5.14.2

Second environemnt:
Operating System: Arch Linux
KDE Plasma Version: 5.18.5
KDE Frameworks Version: 5.70.0
Qt Version: 5.15.0

ADDITIONAL INFORMATION
The bug seems to happen after upgrading kwin to 5.18.5 from 5.17.5 on my Gentoo box.

When running GNOME wayland session in Arch Linux, Xwayland works fine, so I report the bug here to KDE.
Comment 1 David Edmundson 2020-06-09 08:51:34 UTC
>Manually execute a new Xwayland instance under kwin_wayland will get segmentation fault.


Why are you trying to manually start xwayland. Kwin does that.
Comment 2 nkde 2020-06-09 09:28:50 UTC
(In reply to David Edmundson from comment #1)
> >Manually execute a new Xwayland instance under kwin_wayland will get segmentation fault.
> 
> 
> Why are you trying to manually start xwayland. Kwin does that.

I use wine to play some Windows games and I want the wine environment be isolated from my Linux desktop as much as possible, so I create one in a LXD container and pass a X server socket to it.

For this wine environment to use 3D graphics acceleration, projects like Xpra, Xephyr, VirtualGL doesn't work. Sharing existing Xwayland instance's xauth cookie to it should be avoided since this is the security problem wayland trying to solve.

Creating a new Xwayland instance and passing the X socket to it does a great job.
Comment 3 nkde 2020-06-11 23:07:37 UTC
change to reported
Comment 4 Aleix Pol 2022-01-19 15:29:36 UTC
Seems like it's a crash in Xwayland, maybe it should be reported there?

As for kwin, the only supported path is by using the Xwayland instance we spawn.