git: f2661569dd0a - 2024Q2 - x11/xdg-desktop-portal-hyprland: backport crashfixes for -CURRENT

From: Jan Beich <jbeich_at_FreeBSD.org>
Date: Mon, 22 Apr 2024 05:23:51 UTC
The branch 2024Q2 has been updated by jbeich:

URL: https://cgit.FreeBSD.org/ports/commit/?id=f2661569dd0a371d5e799562aad578b54450850e

commit f2661569dd0a371d5e799562aad578b54450850e
Author:     Jan Beich <jbeich@FreeBSD.org>
AuthorDate: 2024-04-22 05:18:18 +0000
Commit:     Jan Beich <jbeich@FreeBSD.org>
CommitDate: 2024-04-22 05:23:46 +0000

    x11/xdg-desktop-portal-hyprland: backport crashfixes for -CURRENT
    
    * thread #1, name = 'xdg-desktop-port', stop reason = signal SIGSEGV: address not mapped to object (fault address: 0x0)
        frame #0: 0x000000000026acf0 xdg-desktop-portal-hyprland`dmabufFeedbackMainDevice(data=0x0000000000000000, feedback=0x0000182398a105c0, device_arr=0x0000182398a891d0) at PortalManager.cpp:90:5
       87   static void dmabufFeedbackMainDevice(void* data, zwp_linux_dmabuf_feedback_v1* feedback, wl_array* device_arr) {
       88       Debug::log(LOG, "[core] dmabufFeedbackMainDevice");
       89
    -> 90       RASSERT(!g_pPortalManager->m_sWaylandConnection.gbm, "double dmabuf feedback");
       91
       92       dev_t device;
       93       assert(device_arr->size == sizeof(device));
    (lldb) bt
    * thread #1, name = 'xdg-desktop-port', stop reason = signal SIGSEGV: address not mapped to object (fault address: 0x0)
      * frame #0: 0x000000000026acf0 xdg-desktop-portal-hyprland`dmabufFeedbackMainDevice(data=0x0000000000000000, feedback=0x0000182398a105c0, device_arr=0x0000182398a891d0) at PortalManager.cpp:90:5
        frame #1: 0x000000082c61067a libffi.so.8`ffi_call_unix64 at unix64.S:104
        frame #2: 0x000000082c60f8f9 libffi.so.8`ffi_call_int(cif=0x0000000820fbba80, fn=(xdg-desktop-portal-hyprland`dmabufFeedbackMainDevice(void*, zwp_linux_dmabuf_feedback_v1*, wl_array*) at PortalManager.cpp:87), rvalue=0x0000000000000000, avalue=0x0000000820fbbab0, closure=0x0000000000000000) at ffi64.c:673:3
        frame #3: 0x000000082c60f452 libffi.so.8`ffi_call(cif=0x0000000820fbba80, fn=(xdg-desktop-portal-hyprland`dmabufFeedbackMainDevice(void*, zwp_linux_dmabuf_feedback_v1*, wl_array*) at PortalManager.cpp:87), rvalue=0x0000000000000000, avalue=0x0000000820fbbab0) at ffi64.c:710:3
        frame #4: 0x00000008242fac28 libwayland-client.so.0`wl_closure_invoke(closure=0x0000182398a89100, flags=1, target=0x0000182398a105c0, opcode=2, data=0x0000000000000000) at connection.c:1025:2
        frame #5: 0x00000008242f84cf libwayland-client.so.0`dispatch_event(display=0x0000182398a1b140, queue=0x0000182398a1b230) at wayland-client.c:1631:3
        frame #6: 0x00000008242f72f4 libwayland-client.so.0`dispatch_queue(display=0x0000182398a1b140, queue=0x0000182398a1b230) at wayland-client.c:1777:3
        frame #7: 0x00000008242f70bd libwayland-client.so.0`wl_display_dispatch_queue_pending(display=0x0000182398a1b140, queue=0x0000182398a1b230) at wayland-client.c:2019:8
        frame #8: 0x00000008242f6c8e libwayland-client.so.0`wl_display_dispatch_queue(display=0x0000182398a1b140, queue=0x0000182398a1b230) at wayland-client.c:1995:9
        frame #9: 0x00000008242f6814 libwayland-client.so.0`wl_display_roundtrip_queue(display=0x0000182398a1b140, queue=0x0000182398a1b230) at wayland-client.c:1403:9
        frame #10: 0x00000008242f6ce0 libwayland-client.so.0`wl_display_roundtrip(display=0x0000182398a1b140) at wayland-client.c:1432:9
        frame #11: 0x0000000000326718 xdg-desktop-portal-hyprland`CToplevelManager::activate(this=0x0000182398a19240) at ToplevelManager.cpp:109:5
        frame #12: 0x0000000000267b72 xdg-desktop-portal-hyprland`CPortalManager::onGlobal(this=0x0000182398a1b000, data=0x0000000000000000, registry=0x0000182398a10440, name=24, interface="zwlr_foreign_toplevel_manager_v1", version=3) at PortalManager.cpp:261:34
        frame #13: 0x00000000002675e5 xdg-desktop-portal-hyprland`handleGlobal(data=0x0000000000000000, registry=0x0000182398a10440, name=24, interface="zwlr_foreign_toplevel_manager_v1", version=3) at PortalManager.cpp:20:23
        frame #14: 0x000000082c61067a libffi.so.8`ffi_call_unix64 at unix64.S:104
        frame #15: 0x000000082c60f8f9 libffi.so.8`ffi_call_int(cif=0x0000000820fbc140, fn=(xdg-desktop-portal-hyprland`handleGlobal(void*, wl_registry*, unsigned int, char const*, unsigned int) at PortalManager.cpp:19), rvalue=0x0000000000000000, avalue=0x0000000820fbc170, closure=0x0000000000000000) at ffi64.c:673:3
        frame #16: 0x000000082c60f452 libffi.so.8`ffi_call(cif=0x0000000820fbc140, fn=(xdg-desktop-portal-hyprland`handleGlobal(void*, wl_registry*, unsigned int, char const*, unsigned int) at PortalManager.cpp:19), rvalue=0x0000000000000000, avalue=0x0000000820fbc170) at ffi64.c:710:3
        frame #17: 0x00000008242fac28 libwayland-client.so.0`wl_closure_invoke(closure=0x0000182398a1b8c0, flags=1, target=0x0000182398a10440, opcode=0, data=0x0000000000000000) at connection.c:1025:2
        frame #18: 0x00000008242f84cf libwayland-client.so.0`dispatch_event(display=0x0000182398a1b140, queue=0x0000182398a1b230) at wayland-client.c:1631:3
        frame #19: 0x00000008242f72f4 libwayland-client.so.0`dispatch_queue(display=0x0000182398a1b140, queue=0x0000182398a1b230) at wayland-client.c:1777:3
        frame #20: 0x00000008242f70bd libwayland-client.so.0`wl_display_dispatch_queue_pending(display=0x0000182398a1b140, queue=0x0000182398a1b230) at wayland-client.c:2019:8
        frame #21: 0x00000008242f6c8e libwayland-client.so.0`wl_display_dispatch_queue(display=0x0000182398a1b140, queue=0x0000182398a1b230) at wayland-client.c:1995:9
        frame #22: 0x00000008242f6814 libwayland-client.so.0`wl_display_roundtrip_queue(display=0x0000182398a1b140, queue=0x0000182398a1b230) at wayland-client.c:1403:9
        frame #23: 0x00000008242f6ce0 libwayland-client.so.0`wl_display_roundtrip(display=0x0000182398a1b140) at wayland-client.c:1432:9
        frame #24: 0x00000000002689a4 xdg-desktop-portal-hyprland`CPortalManager::init(this=0x0000182398a1b000) at PortalManager.cpp:312:5
        frame #25: 0x00000000002a3f76 xdg-desktop-portal-hyprland`main(argc=1, argv=0x0000000820fbc870, envp=0x0000000820fbc880) at main.cpp:38:23
        frame #26: 0x000000082a0172aa libc.so.7`__libc_start1(argc=1, argv=0x0000000820fbc870, env=0x0000000820fbc880, cleanup=<unavailable>, mainX=(xdg-desktop-portal-hyprland`main at main.cpp:15)) at libc_start1.c:157:7
        frame #27: 0x0000000000267520 xdg-desktop-portal-hyprland`_start at crt1_s.S:83
    
    * thread #1, name = 'xdg-desktop-port', stop reason = signal SIGILL: privileged opcode
        frame #0: 0x0000000824c5f7cf libc++.so.1`std::__1::mutex::unlock(this=<unavailable>) at mutex.cpp:39:3
       36   void mutex::unlock() noexcept {
       37     int ec = __libcpp_mutex_unlock(&__m_);
       38     (void)ec;
    -> 39     _LIBCPP_ASSERT_VALID_EXTERNAL_API_CALL(
       40         ec == 0, "call to mutex::unlock failed. A possible reason is that the mutex wasn't locked");
       41   }
       42
    (lldb) bt
    * thread #1, name = 'xdg-desktop-port', stop reason = signal SIGILL: privileged opcode
      * frame #0: 0x0000000824c5f7cf libc++.so.1`std::__1::mutex::unlock(this=<unavailable>) at mutex.cpp:39:3
        frame #1: 0x00000000002691d3 xdg-desktop-portal-hyprland`CPortalManager::startEventLoop(this=0x000021aa1001b000) at PortalManager.cpp:424:48
        frame #2: 0x0000000000268f06 xdg-desktop-portal-hyprland`CPortalManager::init(this=0x000021aa1001b000) at PortalManager.cpp:335:5
        frame #3: 0x00000000002a3f56 xdg-desktop-portal-hyprland`main(argc=1, argv=0x0000000820d386c8, envp=0x0000000820d386d8) at main.cpp:38:23
        frame #4: 0x00000008274222aa libc.so.7`__libc_start1(argc=1, argv=0x0000000820d386c8, env=0x0000000820d386d8, cleanup=<unavailable>, mainX=(xdg-desktop-portal-hyprland`main at main.cpp:15)) at libc_start1.c:157:7
        frame #5: 0x0000000000267520 xdg-desktop-portal-hyprland`_start at crt1_s.S:83
    (lldb) f 1
    frame #1: 0x00000000002691d3 xdg-desktop-portal-hyprland`CPortalManager::startEventLoop(this=0x000021aa1001b000) at PortalManager.cpp:424:48
       421
       422      while (1) { // dbus events
       423          // wait for being awakened
    -> 424          m_sEventLoopInternals.loopRequestMutex.unlock(); // unlock, we are ready to take events
       425
       426          std::unique_lock lk(m_sEventLoopInternals.loopMutex);
       427          if (m_sEventLoopInternals.shouldProcess == false) // avoid a lock if a thread managed to request something already since we .unlock()ed
    
    PR:             278496
    Reported by:    shurd
    
    (cherry picked from commit 78fbf8e19f6fcb3abee5c67ad107c4fd3846a694)
---
 x11/xdg-desktop-portal-hyprland/Makefile | 4 +++-
 x11/xdg-desktop-portal-hyprland/distinfo | 4 ++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/x11/xdg-desktop-portal-hyprland/Makefile b/x11/xdg-desktop-portal-hyprland/Makefile
index 64854424f856..18ae03f006d0 100644
--- a/x11/xdg-desktop-portal-hyprland/Makefile
+++ b/x11/xdg-desktop-portal-hyprland/Makefile
@@ -1,12 +1,14 @@
 PORTNAME=	xdg-desktop-portal-hyprland
 DISTVERSIONPREFIX=	v
 DISTVERSION=	1.3.1
-PORTREVISION=	4
+PORTREVISION=	5
 CATEGORIES=	x11 wayland
 
 PATCH_SITES=	https://github.com/${GH_ACCOUNT}/${GH_PROJECT}/commit/
 PATCHFILES+=	65fb44ae4960.patch:-p1 # https://github.com/hyprwm/xdg-desktop-portal-hyprland/issues/190
 PATCHFILES+=	9c370fd55d6e.patch:-p1 # https://github.com/hyprwm/xdg-desktop-portal-hyprland/pull/193
+PATCHFILES+=	4fc83e6871e9.patch:-p1 # unbreak MALLOC_CONF=junk:true
+PATCHFILES+=	9ace6f969ce4.patch:-p1 # https://github.com/hyprwm/xdg-desktop-portal-hyprland/issues/207
 
 MAINTAINER=	jbeich@FreeBSD.org
 COMMENT=	xdg-desktop-portal backend for hyprland
diff --git a/x11/xdg-desktop-portal-hyprland/distinfo b/x11/xdg-desktop-portal-hyprland/distinfo
index 3944a7f74eeb..18eb43fb44a6 100644
--- a/x11/xdg-desktop-portal-hyprland/distinfo
+++ b/x11/xdg-desktop-portal-hyprland/distinfo
@@ -9,3 +9,7 @@ SHA256 (65fb44ae4960.patch) = 26a3232c3dd9cdbc7f322a194dc37ca41df43be953d36d1d62
 SIZE (65fb44ae4960.patch) = 894
 SHA256 (9c370fd55d6e.patch) = cad38c734274449f9dbab356f7643c0e41b378d5609a17593ca3b39f3e722030
 SIZE (9c370fd55d6e.patch) = 1096
+SHA256 (4fc83e6871e9.patch) = ed10c6554c56aaec248ae9aeca58b40cc9327ff63fe99c36a2810c495624e681
+SIZE (4fc83e6871e9.patch) = 918
+SHA256 (9ace6f969ce4.patch) = b92e24d009ec4a3ab6d1296a1b1320a18f6be51ddde267711e7fa30b19acd2b6
+SIZE (9ace6f969ce4.patch) = 1257