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

Crashes Xwayland in xwl_dmabuf_feedback_main_device on FreeBSD #1028

Open
jbeich opened this issue Dec 5, 2024 · 1 comment
Open

Crashes Xwayland in xwl_dmabuf_feedback_main_device on FreeBSD #1028

jbeich opened this issue Dec 5, 2024 · 1 comment

Comments

@jbeich
Copy link

jbeich commented Dec 5, 2024

Predates epoch-1.0.0-alpha.1. Affects rootless, satellite and rootful Xwayland. Likely caused by Rust fossilizing 4-byte dev_t when FreeBSD >= 12 uses 8 bytes outside of backward compat (binaries built against old headers).

Note, Xwayland in niri (satellite and rootful) works fine despite also using Smithay. See also russelltg/wl-screenrec#99

$ HOME=$(mktemp -dt home) cosmic-comp
 WARN cosmic_comp::logger: Failed to init journald logging. err=Os { code: 2, kind: NotFound, message: "No such file or directory" }
ERROR i18n_embed::requester: Unable to parse your locale: ParserError(InvalidLanguage)
ERROR cosmic_comp::config: Failed to read config 'workspaces' err=NoConfigDirectory
ERROR cosmic_settings_config::shortcuts: failed to read system shortcuts config 'system_actions': GetKey("system_actions", Os { code: 2, kind: NotFound, message: "No such file or directory" })
ERROR cosmic_settings_config::shortcuts: failed to read local shortcuts config 'system_actions': NoConfigDirectory
ERROR cosmic_settings_config::shortcuts: shortcuts defaults config error: GetKey("defaults", Os { code: 21, kind: IsADirectory, message: "Is a directory" })
ERROR cosmic_settings_config::shortcuts: shortcuts custom config error: GetKey("custom", Os { code: 2, kind: NotFound, message: "No such file or directory" })
ERROR cosmic_settings_config::window_rules: tiling exceptions defaults config error: GetKey("tiling_exception_defaults", Os { code: 21, kind: IsADirectory, message: "Is a directory" })
ERROR cosmic_settings_config::window_rules: tiling exceptions custom config error: GetKey("tiling_exception_custom", Os { code: 2, kind: NotFound, message: "No such file or directory" })
ERROR smithay::xwayland::xserver: Xwayland terminated: signal: 6 (SIGABRT)
^C

$ lldb --core Xwayland.1234.core Xwayland
(lldb) bt
* thread #1, name = 'Xwayland', stop reason = signal SIGABRT
  * frame #0: 0x00000008303fd82a libsys.so.7`__sys_thr_kill at thr_kill.S:4
    frame #1: 0x000000082d646074 libc.so.7`__raise(s=6) at raise.c:48:10
    frame #2: 0x000000082d708879 libc.so.7`abort at abort.c:61:8
    frame #3: 0x000000000046888a Xwayland`OsAbort at utils.c:1283:5
    frame #4: 0x000000000046f215 Xwayland`AbortServer at log.c:892:9
    frame #5: 0x000000000046f0cd Xwayland`FatalError(f="") at log.c:1030:9
    frame #6: 0x000000000046581e Xwayland`OsSigHandler(signo=6, sip=0x00000008205f1970, unused=0x00000008205f1600) at osinit.c:156:5
    frame #7: 0x000000082ad71aad libthr.so.3`handle_signal(actp=0x00000008205f1580, sig=6, info=0x00000008205f1970, ucp=0x00000008205f1600) at thr_sig.c:297:3
    frame #8: 0x000000082ad70f8a libthr.so.3`thr_sighandler(sig=6, info=0x00000008205f1970, _ucp=0x00000008205f1600) at thr_sig.c:243:2
    frame #9: 0x00000008214052d3
    frame #10: 0x000000082d708879 libc.so.7`abort at abort.c:61:8
    frame #11: 0x000000082d628831 libc.so.7`__assert(func=<unavailable>, file=<unavailable>, line=<unavailable>, failedexpr=<unavailable>) at assert.c:47:2
    frame #12: 0x00000000002a6424 Xwayland`xwl_dmabuf_feedback_main_device(data=0x000007c4fd2c14b0, dmabuf_feedback=0x000007c4fd210860, dev=0x000007c4fd35fcd0) at xwayland-dmabuf.c:475:5
    frame #13: 0x000000082f8c3a92 libffi.so.8`ffi_call_unix64 at unix64.S:104
    frame #14: 0x000000082f8c2ec0 libffi.so.8`ffi_call_int(cif=0x00000008205f1ef0, fn=(Xwayland`xwl_dmabuf_feedback_main_device at xwayland-dmabuf.c:469), rvalue=0x0000000000000000, avalue=0x00000008205f1f20, closure=0x0000000000000000) at ffi64.c:673:3
    frame #15: 0x000000082f8c2a8c libffi.so.8`ffi_call(cif=0x00000008205f1ef0, fn=(Xwayland`xwl_dmabuf_feedback_main_device at xwayland-dmabuf.c:469), rvalue=0x0000000000000000, avalue=0x00000008205f1f20) at ffi64.c:710:3
    frame #16: 0x00000008250af044 libwayland-client.so.0`wl_closure_invoke(closure=0x000007c4fd35fc00, flags=1, target=0x000007c4fd210860, opcode=2, data=0x000007c4fd2c14b0) at connection.c:1228:2
    frame #17: 0x00000008250ac994 libwayland-client.so.0`dispatch_event(display=0x000007c4fd23e280, queue=0x000007c4fd23e378) at wayland-client.c:1674:3
    frame #18: 0x00000008250ab8f5 libwayland-client.so.0`dispatch_queue(display=0x000007c4fd23e280, queue=0x000007c4fd23e378) at wayland-client.c:1820:3
    frame #19: 0x00000008250ab6fd libwayland-client.so.0`wl_display_dispatch_queue_pending(display=0x000007c4fd23e280, queue=0x000007c4fd23e378) at wayland-client.c:2062:8
    frame #20: 0x00000008250ab309 libwayland-client.so.0`wl_display_dispatch_queue(display=0x000007c4fd23e280, queue=0x000007c4fd23e378) at wayland-client.c:2038:9
    frame #21: 0x00000008250aaeee libwayland-client.so.0`wl_display_roundtrip_queue(display=0x000007c4fd23e280, queue=0x000007c4fd23e378) at wayland-client.c:1448:9
    frame #22: 0x00000008250ab360 libwayland-client.so.0`wl_display_roundtrip(display=0x000007c4fd23e280) at wayland-client.c:1477:9
    frame #23: 0x0000000000297ebc Xwayland`xwl_screen_roundtrip(xwl_screen=0x000007c4fd2c1300) at xwayland-screen.c:731:15
    frame #24: 0x00000000002987ca Xwayland`xwl_screen_init(pScreen=0x000007c4fd2c4000, argc=11, argv=0x00000008205f2448) at xwayland-screen.c:1027:5
    frame #25: 0x000000000032ca7a Xwayland`AddScreen(pfnInit=(Xwayland`xwl_screen_init at xwayland-screen.c:856), argc=11, argv=0x00000008205f2448) at dispatch.c:3993:10
    frame #26: 0x0000000000288c99 Xwayland`InitOutput(screen_info=0x00000000004ff540, argc=11, argv=0x00000008205f2448) at xwayland.c:455:9
    frame #27: 0x00000000003329a5 Xwayland`dix_main(argc=11, argv=0x00000008205f2448, envp=0x00000008205f24a8) at main.c:193:9
    frame #28: 0x00000000002abeea Xwayland`main(argc=11, argv=0x00000008205f2448, envp=0x00000008205f24a8) at stubmain.c:34:12
    frame #29: 0x000000082d618325 libc.so.7`__libc_start1(argc=<unavailable>, argv=0x00000008205f2448, env=<unavailable>, cleanup=<unavailable>, mainX=(Xwayland`main at stubmain.c:33)) at libc_start1.c:172:7
    frame #30: 0x0000000000288110 Xwayland`_start at crt1_s.S:83
(lldb) f 12
frame #12: 0x00000000002a6424 Xwayland`xwl_dmabuf_feedback_main_device(data=0x000007c4fd2c14b0, dmabuf_feedback=0x000007c4fd210860, dev=0x000007c4fd35fcd0) at xwayland-dmabuf.c:475:5
   472
   473      xwl_check_reset_tranche_info(xwl_feedback);
   474
-> 475      assert(dev->size == sizeof(dev_t));
            ^
   476      memcpy(&devid, dev->data, sizeof(dev_t));
   477
   478      drmFreeDevice(&xwl_feedback->main_dev);
(lldb) p dev->size
(size_t) 4
(lldb) p sizeof(dev_t)
(unsigned long) 8
@ids1024
Copy link
Member

ids1024 commented Dec 5, 2024

Hm, I don't recall seeing this when I tested on FreeBSD, but its been a while now.

In smithay-client-toolkit, I added a workaround for dev_t on FreeBSD: https://github.com/Smithay/client-toolkit/blob/25079ae75cb6952b0542aa343bd5a52c81d135d4/src/dmabuf.rs#L15-L19

I guess smithay may need something similar.

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

2 participants