https://bugs.kde.org/show_bug.cgi?id=466281

            Bug ID: 466281
           Summary: Nested kwin_wayland crashed in
                    KWin::GLFramebuffer::size in VMs using the llvmpipe
                    driver
    Classification: Plasma
           Product: kwin
           Version: 5.27.0
          Platform: Fedora RPMs
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: wayland-generic
          Assignee: kwin-bugs-n...@kde.org
          Reporter: matt.fagn...@bell.net
  Target Milestone: ---

Created attachment 156628
  --> https://bugs.kde.org/attachment.cgi?id=156628&action=edit
The full trace of all threads of the nested kwin_wayland crash.

SUMMARY

I booted the Fedora 38 KDE Plasma live image
Fedora-KDE-Live-x86_64-38-20230221.n.1.iso in a QEMU/KVM VM using GNOME Boxes
with 3D acceleration disabled using the llvmpipe driver from
mesa-dri-drivers-23.0.0~rc4-3.fc38.x86_64.
Plasma 5.27.0 on Wayland started. I started Konsole. I tried to run a nested
kwin_wayland session using the instructions at
https://community.kde.org/KWin/Wayland
export $(dbus-launch)
kwin_wayland --xwayland 

The nested kwin_wayland window didn't appear except for a Wayland icon in the
task manager. The following output was in Konsole which showed some Permission
denied errors and a segmentation fault of kwin_wayland.

$ kwin_wayland --xwayland
No backend specified, automatically choosing Wayland because WAYLAND_DISPLAY is
set
unable to lock lockfile /run/user/1000/wayland-0.lock, maybe another compositor
is running
libEGL warning: egl: failed to create dri2 screen
OpenGL vendor string:                   Mesa
OpenGL renderer string:                 llvmpipe (LLVM 15.0.7, 256 bits)
OpenGL version string:                  4.5 (Core Profile) Mesa 23.0.0-rc4
OpenGL shading language version string: 4.50
Driver:                                 LLVMpipe
GPU class:                              Unknown
OpenGL version:                         4.5
GLSL version:                           4.50
Mesa version:                           23.0
Linux kernel version:                   6.2
Requires strict binding:                no
GLSL shaders:                           yes
Texture NPOT support:                   yes
Virtual Machine:                        no
kwin_core: Parse error in tiles configuration for monitor
"7fb8c463-c102-5440-8fb7-5253b26b5d9c" : "illegal value" Creating default setup
kwin_xkbcommon: XKB: inet:323:58: unrecognized keysym "XF86EmojiPicker"
kwin_xkbcommon: XKB: inet:324:58: unrecognized keysym "XF86Dictate"
KMS: DRM_IOCTL_MODE_CREATE_DUMB failed: Permission denied
kwin_wayland_backend: Failed to allocate a buffer for an output layer
KMS: DRM_IOCTL_MODE_CREATE_DUMB failed: Permission denied
kwin_wayland_backend: Failed to allocate a buffer for an output layer
(WW) Option "-listen" for file descriptors is deprecated
Please use "-listenfd" instead.
(WW) Option "-listen" for file descriptors is deprecated
Please use "-listenfd" instead.
libEGL warning: egl: failed to create dri2 screen
libEGL warning: NEEDS EXTENSION: falling back to kms_swrast
(EE) could not connect to wayland server
Segmentation fault (core dumped)

The nested kwin_wayland crashed in KWin::GLFramebuffer::size. The crash
might've been due to a null pointer dereference since this=0x0.

Core was generated by `kwin_wayland --xwayland'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x00007f56fe3fcead in KWin::GLFramebuffer::size (this=0x0) at
/usr/src/debug/kwin-5.27.0-2.fc38.x86_64/src/libkwineffects/kwinglutils.h:421
421             return mSize;
[Current thread is 1 (Thread 0x7f56fdaa9e40 (LWP 4389))]

(gdb) bt
#0  0x00007f56fe3fcead in KWin::GLFramebuffer::size (this=0x0)
    at
/usr/src/debug/kwin-5.27.0-2.fc38.x86_64/src/libkwineffects/kwinglutils.h:421
#1  KWin::RenderTarget::size (this=0x7ffe85125500)
    at /usr/src/debug/kwin-5.27.0-2.fc38.x86_64/src/core/rendertarget.cpp:30
#2  0x00007f56fe4a3fec in KWin::CursorScene::paint
(this=this@entry=0x5564ab4fd200, 
    renderTarget=renderTarget@entry=0x7ffe85125500, region=...)
    at /usr/src/debug/kwin-5.27.0-2.fc38.x86_64/src/scene/cursorscene.cpp:57
#3  0x00007f56fe4a8d91 in KWin::SceneDelegate::paint
(this=this@entry=0x5564ab747590, 
    renderTarget=renderTarget@entry=0x7ffe85125500, region=...)
    at /usr/src/debug/kwin-5.27.0-2.fc38.x86_64/src/scene/scene.cpp:55
#4  0x00007f56fe5de432 in KWin::Wayland::WaylandOutput::renderCursorOpengl
(this=this@entry=0x5564aaef17f0, 
    backend=<optimized out>, source=source@entry=0x5564ab6448e0)
    at
/usr/src/debug/kwin-5.27.0-2.fc38.x86_64/src/backends/wayland/wayland_output.cpp:229
#5  0x00007f56fe5de805 in KWin::Wayland::WaylandOutput::setCursor
(source=0x5564ab6448e0, this=0x5564aaef17f0)
    at
/usr/src/debug/kwin-5.27.0-2.fc38.x86_64/src/backends/wayland/wayland_output.cpp:191
#6  KWin::Wayland::WaylandOutput::setCursor (this=0x5564aaef17f0,
source=0x5564ab6448e0)
    at
/usr/src/debug/kwin-5.27.0-2.fc38.x86_64/src/backends/wayland/wayland_output.cpp:184
#7  0x00007f56fe3f0a42 in operator() (__closure=__closure@entry=0x7ffe851256a0)
    at /usr/src/debug/kwin-5.27.0-2.fc38.x86_64/src/composite.cpp:455
#8  0x00007f56fe3f4686 in KWin::Compositor::addOutput
(this=this@entry=0x5564aaef8d10, output=0x5564aaef17f0)
    at /usr/src/debug/kwin-5.27.0-2.fc38.x86_64/src/composite.cpp:471
#9  0x00007f56fe3f4988 in KWin::Compositor::startupWithWorkspace
(this=0x5564aaef8d10)
    at /usr/src/debug/kwin-5.27.0-2.fc38.x86_64/src/composite.cpp:383
#10 0x00007f56fcadf03b in QObject::event (this=0x5564aaef8d10,
e=0x5564aaf7c090) at kernel/qobject.cpp:1347
#11 0x00007f56fc1aece5 in QApplicationPrivate::notify_helper(QObject*, QEvent*)
()
   from /lib64/libQt5Widgets.so.5
#12 0x00007f56fcab3648 in QCoreApplication::notifyInternal2
(receiver=0x5564aaef8d10, event=0x5564aaf7c090)
    at kernel/qcoreapplication.cpp:1064
--Type <RET> for more, q to quit, c to continue without paging--
#13 0x00007f56fcab6af5 in QCoreApplicationPrivate::sendPostedEvents
(receiver=receiver@entry=0x0, 
    event_type=event_type@entry=0, data=data@entry=0x5564aae52900) at
kernel/qcoreapplication.cpp:1821
#14 0x00007f56fcb03371 in QEventDispatcherUNIX::processEvents
(this=0x5564aae557d0, flags=...)
    at kernel/qeventdispatcher_unix.cpp:468
#15 0x00005564aabd10c2 in
QUnixEventDispatcherQPA::processEvents(QFlags<QEventLoop::ProcessEventsFlag>)
()
#16 0x00007f56fcab201b in QEventLoop::exec (this=this@entry=0x7ffe85125ac0,
flags=..., flags@entry=...)
    at ../../include/QtCore/../../src/corelib/global/qflags.h:69
#17 0x00007f56fcaba29b in QCoreApplication::exec ()
    at ../../include/QtCore/../../src/corelib/global/qflags.h:121
#18 0x00005564aaaecc04 in main (argc=<optimized out>, argv=<optimized out>)
    at /usr/src/debug/kwin-5.27.0-2.fc38.x86_64/src/main_wayland.cpp:628

fbo pointed to a null pointer in KWin::RenderTarget::size in frame 1, so 
(*fbo)->size() might've been the null pointer dereference.

(gdb) frame 1
#1  KWin::RenderTarget::size (this=0x7ffe85125500)
    at /usr/src/debug/kwin-5.27.0-2.fc38.x86_64/src/core/rendertarget.cpp:30
30              return (*fbo)->size();
(gdb) p fbo
$1 = (KWin::GLFramebuffer * const *) 0x7ffe85125500
(gdb) p *fbo
$2 = (KWin::GLFramebuffer * const) 0x0

The framebuffer might not have been properly initialized due to the Permission
denied errors
KMS: DRM_IOCTL_MODE_CREATE_DUMB failed: Permission denied
kwin_wayland_backend: Failed to allocate a buffer for an output layer

I've frequently seen KDE programs showing warnings like "libEGL warning: egl:
failed to create dri2 screen" in the journal of VMs using the llvmpipe driver
e.g. https://bugs.kde.org/show_bug.cgi?id=464258 That warning didn't appear
with the virgl or radeonsi mesa drivers. That warning led to a fallback to the
kms_swrast driver.

This problem happened each of a few times I tried to run a nested kwin_wayland
session in VMs using the llvmpipe driver. Nested kwin_wayland started normally
in VMs with the same image using 3D acceleration enabled using the virgl mesa
driver and on bare metal using the radeonsi mesa driver. The problem might be
specific to the use of llvmpipe.

STEPS TO REPRODUCE
1. Boot a Fedora 37 KDE Plasma installation updated to 2023-2-22 with
updates-testing enabled
2. Log in to Plasma 5.27.0 on Wayland from sddm
3. Download Fedora-KDE-Live-x86_64-38-20230221.n.1.iso from
https://koji.fedoraproject.org/koji/buildinfo?buildID=2157026
4. Install GNOME Boxes if it isn't already with sudo dnf install gnome-boxes
5. Start GNOME Boxes
6. boot the Fedora 38 KDE Plasma live image
Fedora-KDE-Live-x86_64-38-20230221.n.1.iso in a QEMU/KVM VM using GNOME Boxes
with 3D acceleration disabled using the llvmpipe driver
7. Start Konsole in the VM
8. In Konsole, run
export $(dbus-launch)
kwin_wayland --xwayland

OBSERVED RESULT
Nested kwin_wayland crashed in KWin::GLFramebuffer::size in VMs using the
llvmpipe driver

EXPECTED RESULT
Nested kwin_wayland wouldn't crash

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Fedora 38
(available in About System)
KDE Plasma Version: 5.27.0
KDE Frameworks Version: 5.103.0
Qt Version: 5.15.8

ADDITIONAL INFORMATION

I'm attaching the full trace of all threads.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to