Skip to content

fix(linux): fix touch misalignment for wlgrab on scaled outputs (#4665) - #1

Merged
inkatail merged 1 commit into
inkatail:masterfrom
LizardByte:master
Feb 18, 2026
Merged

fix(linux): fix touch misalignment for wlgrab on scaled outputs (#4665)#1
inkatail merged 1 commit into
inkatail:masterfrom
LizardByte:master

Conversation

@inkatail

Copy link
Copy Markdown
Owner

No description provided.

@inkatail
inkatail marked this pull request as ready for review February 18, 2026 09:44
@inkatail
inkatail merged commit 6c360a0 into inkatail:master Feb 18, 2026
4 of 5 checks passed
inkatail pushed a commit that referenced this pull request Jun 27, 2026
…lkan)

On Linux with the Vulkan encoder, reinit triggered by display switching
or mode changes can crash Sunshine due to packets in flight after encoder
teardown.

With extra debug logging, this pattern was occurring:

Jun 26 23:57:21 archlinux sunshine[263621]: [2026-06-26 23:57:21.625]: Warning: [crash] encode_avcodec session=0x7fd8c89ad480 thread=140569594554048 avctx=0x7fd8c8c7f980 hw_frames=0x7fd8c883a940 FFmpeg frames ctx=0x7fd8c8a6b200
Jun 26 23:57:21 archlinux sunshine[263621]: [2026-06-26 23:57:21.628]: Warning: PACKET DESTROY 0x7fd8c8b76d00
Jun 26 23:57:21 archlinux sunshine[263621]: [2026-06-26 23:57:21.628]: Warning: [crash] SESSION DESTROY START 0x7fd8c89ad480
Jun 26 23:57:21 archlinux sunshine[263621]: [2026-06-26 23:57:21.628]: Warning: PACKET DESTROY 0x7fd8e8bfd490
Jun 26 23:57:21 archlinux sunshine[263621]: [2026-06-26 23:57:21.628]: Warning: [crash] Calling avcodec_ctx.reset()
Jun 26 23:57:21 archlinux sunshine[263621]: [2026-06-26 23:57:21.628]: Warning: [crash] SESSION DESTROY AFTER RESET 0x7fd8c89ad480
Jun 26 23:57:21 archlinux sunshine[263621]: [2026-06-26 23:57:21.628]: Warning: [crash] Calling device.reset()
Jun 26 23:57:21 archlinux sunshine[263621]: [2026-06-26 23:57:21.629]: Warning: PACKET DESTROY 0x7fd8c882de40
Jun 26 23:57:21 archlinux kernel: rtsp::handler[263877]: segfault at 7fd8a0af7e20 ip 00007fd8a0af7e20 sp 00007fd8ebffd638 error 14 likely on CPU 11 (core 3, socket 0)
Jun 26 23:57:21 archlinux kernel: Code: Unable to access opcode bytes at 0x7fd8a0af7df6.
Jun 26 23:57:21 archlinux systemd-coredump[263973]: Process 263621 (sunshine) of user 1000 terminated abnormally with signal 11/SEGV, processing...
Jun 26 23:57:21 archlinux systemd[1]: Started Process Core Dump (PID 263973/UID 0).
Jun 26 23:57:21 archlinux systemd[1]: Started Pass systemd-coredump journal entries to relevant user for potential DrKonqi handling.
Jun 26 23:57:22 archlinux systemd-coredump[263974]: [🡕] Process 263621 (sunshine) of user 1000 dumped core.

                                                    Stack trace of thread 263877:
                                                    #0  0x00007fd8a0af7e20 n/a (libvulkan_radeon.so + 0xf7e20)
                                                    #1  0x00007fd8a0bcd8cf n/a (libvulkan_radeon.so + 0x1cd8cf)
                                                    #2  0x00005636d70c0ea4 ff_vk_unmap_buffers (sunshine + 0x45dea4)
                                                    #3  0x00005636d70c100b ff_vk_unmap_buffer (sunshine + 0x45e00b)
                                                    #4  0x00005636d70c102d free_data_buf (sunshine + 0x45e02d)
                                                    #5  0x00005636d7198a17 buffer_pool_flush (sunshine + 0x535a17)
                                                    #6  0x00005636d7198c26 buffer_replace (sunshine + 0x535c26)
                                                    #7  0x00005636d704596e av_packet_unref (sunshine + 0x3e296e)
                                                    #8  0x00005636d70459da av_packet_free (sunshine + 0x3e29da)
                                                    #9  0x00005636d6eb51a8 _ZNSt10unique_ptrIN5video12packet_raw_tESt14default_deleteIS1_EED2Ev.lto_priv.0 (sunshine + 0x2521a8)
                                                    #10 0x00005636d6ea6b69 _ZN6stream20videoBroadcastThreadERN5boost4asio21basic_datagram_socketINS1_2ip3udpENS1_15any_io_executorEEE (sunshine + 0x243b69)
                                                    #11 0x00005636d7f4f749 execute_native_thread_routine (sunshine + 0x12ec749)
                                                    #12 0x00007fd938a97739 n/a (libc.so.6 + 0x97739)
                                                    #13 0x00007fd938b1bedc n/a (libc.so.6 + 0x11bedc)

Since an in-flight packet's packet_raw_avcodec destructor was calling av_packet_free(..) after device.reset(), a UAF-type SEGFAULT would manifest. Moving the breakout check
of the encoding loop to check immediately before encode() resolves the issue on my system via repeated stress testing. It may be possible that in-flight packets can still
be active, which may necessitate future refcounting of packets in flight and waiting for it to drop to zero before breaking out of the encode loop, but for now, this minimal change
fully resolves the issue on my system.
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.

2 participants