• syncterm: Crash on OpenBSD

    From Dan Cross@1:103/705 to GitLab issue in main/sbbs on Fri Feb 9 08:48:02 2024
    open https://gitlab.synchro.net/main/sbbs/-/issues/714

    Syncterm seems to crash in `ssh_input_thread` when running under OpenBSD 7.4 x86_64. I get the following when connecting to e.g. Agency BBS:

    ```plaintext
    Program received signal SIGABRT, Aborted.
    [Switching to thread 276170]
    thrkill () at /tmp/-:3
    3 /tmp/-: No such file or directory.
    in /tmp/-
    Current language: auto; currently asm
    (gdb) where
    #0 thrkill () at /tmp/-:3
    #1 0x18ff757db4dc9362 in ?? ()
    #2 0x00000bf6b4546992 in _libc_abort () at /usr/src/lib/libc/stdlib/abort.c:51 #3 0x00000bf6b455230f in _rthread_mutex_timedlock (mutexp=Variable "mutexp" is not available.
    ) at /usr/src/lib/libc/thread/rthread_mutex.c:117
    #4 0x00000bf49aa43b1d in ssh_input_thread (args=0x0) at ssh.c:131
    #5 0x00000bf6f482bcd5 in _rthread_start (v=Unhandled dwarf expression opcode 0xa3
    ) at /usr/src/lib/librthread/rthread.c:96
    #6 0x00000bf6b4531f0a in __tfork_thread () at /usr/src/lib/libc/arch/amd64/sys/tfork_thread.S:86
    #7 0x00000bf6b4531f0a in __tfork_thread () at /usr/src/lib/libc/arch/amd64/sys/tfork_thread.S:86
    Previous frame identical to this frame (corrupt stack?)
    ```

    Curiously, `lldb` gives a different stack trace (GDB seems confused):

    ```plaintext
    : experimental; lldb ./clang.openbsd.amd64.exe.debug/syncterm
    (lldb) target create "./clang.openbsd.amd64.exe.debug/syncterm"
    Current executable set to '/home/cross/unix/ports/sbbs/src/syncterm/clang.openbsd.amd64.exe.debug/syncterm' (x86_64).
    (lldb) run
    Process 74034 launched: '/home/cross/unix/ports/sbbs/src/syncterm/clang.openbsd.amd64.exe.debug/syncterm' (x86_64)
    This version of LLDB has no plugin for the language "assembler". Inspection of frame variables will be limited.
    Process 74034 stopped
    * thread #1, stop reason = signal SIGABRT
    frame #0: 0x00000eb8882cbd7b libc.so.97.1`_thread_sys_nanosleep at -:3(lldb) bt all
    * thread #1, stop reason = signal SIGABRT
    * frame #0: 0x00000eb8882cbd7b libc.so.97.1`_thread_sys_nanosleep at -:3
    frame #1: 0x00000eb8883210d2 libc.so.97.1`_libc_nanosleep_cancel(timeout=<unavailable>, remainder=<unavailable>) at w_nanosleep.c:27:8
    frame #2: 0x00000eb6863c989c syncterm`doterm(bbs=0x00000eb68671a930) at term.c:4597:4
    frame #3: 0x00000eb6863d9ec7 syncterm`main(argc=1, argv=0x000076d9eb78f128) at syncterm.c:1924:8
    frame #4: 0x00000eb6863954d2 syncterm`__start + 338
    (lldb)
    ```

    Telnet seems unaffected; the crash seems localized to using ssh.
    --- SBBSecho 3.20-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Dan Cross@1:103/705 to GitLab note in main/sbbs on Fri Feb 9 08:52:26 2024
    https://gitlab.synchro.net/main/sbbs/-/issues/714#note_4786

    Oh, I should mention.... The above was from a debug binary built from `39f5063c9c78a1755c876a64bbda6555678dcedf`:

    ```
    : experimental; clang --version
    OpenBSD clang version 13.0.0
    Target: amd64-unknown-openbsd7.4
    Thread model: posix
    InstalledDir: /usr/bin
    : experimental; uname -a
    OpenBSD experimental.cshack.net 7.4 GENERIC.MP#1397 amd64
    : experimental;
    ```
    --- SBBSecho 3.20-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Dan Cross@1:103/705 to GitLab note in main/sbbs on Sun Feb 11 17:10:06 2024
    https://gitlab.synchro.net/main/sbbs/-/issues/714#note_4806

    By the way, I did a little bisection:
    A binary built from b33a40e7fac7520a500bea3f4cb8f74d6b8cb9a9 does not exhibit this behavior.
    A binary built from the next commit, 2b3c02d62ec5645323a0087cbb77485de792b668 ("Update cryptlib to 3.4.7") does.
    --- SBBSecho 3.20-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Deucе@1:103/705 to GitLab note in main/sbbs on Mon Feb 19 13:13:54 2024
    https://gitlab.synchro.net/main/sbbs/-/issues/714#note_4873

    This may be fixed in git now, there was a nasty issue fixed recently.
    --- SBBSecho 3.20-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Dan Cross@1:103/705 to GitLab note in main/sbbs on Thu Apr 4 19:02:46 2024
    https://gitlab.synchro.net/main/sbbs/-/issues/714#note_5262

    Ok, thanks! It seems to be working now.
    --- SBBSecho 3.20-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Dan Cross@1:103/705 to GitLab issue in main/sbbs on Thu Apr 4 19:02:46 2024
    close https://gitlab.synchro.net/main/sbbs/-/issues/714
    --- SBBSecho 3.20-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)