Disclaimer: I don't have any prior experience running FreeBSD systems. This is my first FreeBSD problem report. I've read *Writing FreeBSD Problem Reports*, and follow it to the best of my abilities. I've been a Linux user for the last decade. There's no mention of "arcan" in `/usr/ports/UPDATING`. There's no relevant open or closed PRs against arcan currently in Bugzilla. Expected behavior ================= When I run `arcan ./console` (important with no slash at the end) in `/usr/local/share/arcan/appl` the Arcan console should show up and occupy the whole screen. Actual behavior =============== ``` /usr/local/share/arcan/appl # arcan ./console Sep 29 [...]: stack overflow detected; terminated ``` When I try to start the Arcan console I get an error saying that a stack overflow happened. A `arcan.core` file was created, which I assume is a coredump. When I ran `gdb ./arcan.core` I get the error ``` "/usr/local/share/arcan/appl/arcan.core": not in executable format: file format not recognized ``` which make me unsure if `arcan.core` is actually a coredump. I've regardless attached `arcan.core` with this PR. This is not something specific to the `console` app, because I get a similar error message when I try to start Durden (another Arcan appl). System ====== ``` # uname -r 13.2-RELEASE-p3 ``` Freshly installed FreeBSD 13.2 on a Thinkpad X230 with 16GB RAM, and on a freshly installed FreeBSD system in a KVM/QEMU VM (much more constrained hardware wise). Both automatically partitioned with ZFS by `bsdinstall(8)`. Installation done with all available security features listed by `bsdinstall(8)`. The only non-base applications installed is `arcan`, `durden`, `kakoune`, `ripgrep`, `bfs`, `gdb`; installed using `pkg install`. Everything executed as root, simply because I haven't yet created a separate user account.
I've the `arcan.core` file, but it weights in on 13.2 MB, so I can't attach it to this PR. I can send it or upload it elsewhere on request.
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=2258b3ebc4eea9aa93da7058a0df054475849f38 commit 2258b3ebc4eea9aa93da7058a0df054475849f38 Author: Jan Beich <jbeich@FreeBSD.org> AuthorDate: 2023-09-30 02:09:56 +0000 Commit: Jan Beich <jbeich@FreeBSD.org> CommitDate: 2023-09-30 02:52:05 +0000 multimedia/arcan: unbreak KMS support after cb7c09ae6a8e $ arcan console pid 12345 (arcan), jid 0, uid 1111: exited on signal 6 (no core dump - bad address) $ tail -1 /var/log/messages Sep 29 22:48:36 localhost arcan[12345]: stack overflow detected; terminated (lldb) bt * thread #2, name = 'arcan', stop reason = signal SIGABRT * frame #0: 0x00000008277faf5a libc.so.7`__sys_kill at kill.S:4 frame #1: 0x00000008277fe361 libc.so.7`__fail(msg="stack overflow detected; terminated") at stack_protector.c:120:8 frame #2: 0x00000008277fe2d0 libc.so.7`__stack_chk_fail at stack_protector.c:127:2 frame #3: 0x00000000002eb876 arcan`button_count(fd=5, bitn=1, got_mouse=0x000000082040a5cf, got_joy=0x000000082040a5ce) at event.c:0 (lldb) f 3 frame #3: 0x00000000002eb876 arcan`button_count(fd=5, bitn=1, got_mouse=0x000000082040a5cf, got_joy=0x000000082040a5ce) at event.c:0 844 #define bit_isset(ary, bit) (( ary[bit_longn(bit)] >> bit_ofs(bit)) & 1) 845 #define bit_count(x) ( ((x) - 1 ) / (sizeof(long) * 8 ) + 1 ) 846 -> 847 static size_t button_count(int fd, size_t bitn, bool* got_mouse, bool* got_joy) 848 { 849 size_t count = 0; 850 PR: 274163 Reported by: Albin "a12l" Otterhäll multimedia/arcan/Makefile | 2 +- .../arcan/files/patch-platform_cmake_CMakeLists.BSD (new) | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-)
A commit in branch 2023Q3 references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=32d0b0d5e1b5db3fb0a089a8eb30fb1891c27754 commit 32d0b0d5e1b5db3fb0a089a8eb30fb1891c27754 Author: Jan Beich <jbeich@FreeBSD.org> AuthorDate: 2023-09-30 02:09:56 +0000 Commit: Jan Beich <jbeich@FreeBSD.org> CommitDate: 2023-09-30 02:59:39 +0000 multimedia/arcan: unbreak KMS support after cb7c09ae6a8e $ arcan console pid 12345 (arcan), jid 0, uid 1111: exited on signal 6 (no core dump - bad address) $ tail -1 /var/log/messages Sep 29 22:48:36 localhost arcan[12345]: stack overflow detected; terminated (lldb) bt * thread #2, name = 'arcan', stop reason = signal SIGABRT * frame #0: 0x00000008277faf5a libc.so.7`__sys_kill at kill.S:4 frame #1: 0x00000008277fe361 libc.so.7`__fail(msg="stack overflow detected; terminated") at stack_protector.c:120:8 frame #2: 0x00000008277fe2d0 libc.so.7`__stack_chk_fail at stack_protector.c:127:2 frame #3: 0x00000000002eb876 arcan`button_count(fd=5, bitn=1, got_mouse=0x000000082040a5cf, got_joy=0x000000082040a5ce) at event.c:0 (lldb) f 3 frame #3: 0x00000000002eb876 arcan`button_count(fd=5, bitn=1, got_mouse=0x000000082040a5cf, got_joy=0x000000082040a5ce) at event.c:0 844 #define bit_isset(ary, bit) (( ary[bit_longn(bit)] >> bit_ofs(bit)) & 1) 845 #define bit_count(x) ( ((x) - 1 ) / (sizeof(long) * 8 ) + 1 ) 846 -> 847 static size_t button_count(int fd, size_t bitn, bool* got_mouse, bool* got_joy) 848 { 849 size_t count = 0; 850 PR: 274163 Reported by: Albin "a12l" Otterhäll (cherry picked from commit 2258b3ebc4eea9aa93da7058a0df054475849f38) multimedia/arcan/Makefile | 2 +- .../arcan/files/patch-platform_cmake_CMakeLists.BSD (new) | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-)
Upstream likely enabled evdev support on FreeBSD without actually testing. I can't report as https://github.com/letoram/arcan/issues/ has been disabled and need a tracking reference to refer to. Note, arcan.core is core(5) file, so uploading is pointless without matching executable, FreeBSD version and debug symbols (WITH_DEBUG=1 in ports). Disable core(5) files via "sysctl kern.coredump=0" or relocate via "sysctl kern.corefile=/var/tmp/%N.%U.core". It's still possible to debug apps by running from lldb/gdb e.g., "lldb arcan" + "settings set target.process.follow-fork-mode child" + "run -- console".
Running Arcan nested under Xorg or any Wayland compositor should work even without the committed workaround. I usually test under Sway which uses evdev just fine.
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=5fea740a3d8e5092f60f0ba5ced4118c98841f28 commit 5fea740a3d8e5092f60f0ba5ced4118c98841f28 Author: Jan Beich <jbeich@FreeBSD.org> AuthorDate: 2023-09-30 17:06:29 +0000 Commit: Jan Beich <jbeich@FreeBSD.org> CommitDate: 2023-09-30 18:22:36 +0000 multimedia/arcan: restore evdev support via upstream fix Arcan >= 0.6.1 respects XKB_DEFAULT_LAYOUT ("us" by default, similar to Option "XkbLayout" in xorg.conf) instead of ARCAN_INPUT_KEYMAPS (/usr/share/syscons/keymaps/us.iso.kbd by default). XKB_DEFAULT_* are also used by other libxkbcommon consumers like Wayland compositors. Users that prefer syscons input backend can override via Makefile.local e.g., $ echo CMAKE_ARGS+=-DINPUT_PLATFORM=syscons >/usr/ports/multimedia/arcan/Makefile.local PR: 274163 multimedia/arcan/Makefile | 3 ++- multimedia/arcan/distinfo | 2 ++ .../files/patch-platform_cmake_CMakeLists.BSD (gone) | 15 --------------- 3 files changed, 4 insertions(+), 16 deletions(-)
A commit in branch 2023Q3 references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=6688b6464142fa2377163e4677688b2423dbfc2f commit 6688b6464142fa2377163e4677688b2423dbfc2f Author: Jan Beich <jbeich@FreeBSD.org> AuthorDate: 2023-09-30 17:06:29 +0000 Commit: Jan Beich <jbeich@FreeBSD.org> CommitDate: 2023-09-30 18:23:49 +0000 multimedia/arcan: restore evdev support via upstream fix Arcan >= 0.6.1 respects XKB_DEFAULT_LAYOUT ("us" by default, similar to Option "XkbLayout" in xorg.conf) instead of ARCAN_INPUT_KEYMAPS (/usr/share/syscons/keymaps/us.iso.kbd by default). XKB_DEFAULT_* are also used by other libxkbcommon consumers like Wayland compositors. Users that prefer syscons input backend can override via Makefile.local e.g., $ echo CMAKE_ARGS+=-DINPUT_PLATFORM=syscons >/usr/ports/multimedia/arcan/Makefile.local PR: 274163 (cherry picked from commit 5fea740a3d8e5092f60f0ba5ced4118c98841f28) multimedia/arcan/Makefile | 3 ++- multimedia/arcan/distinfo | 2 ++ .../files/patch-platform_cmake_CMakeLists.BSD (gone) | 15 --------------- 3 files changed, 4 insertions(+), 16 deletions(-)
Thanks Jan, it no longer stack overflows! And thanks for the debugging tips, I'll keep that in mind in the future :)