r-c-f/waynergy

segfault / tls error

ackstorm23 opened this issue · 5 comments

I have a new intermittent problem I am hoping to get to the bottom of.

Waynergy client and Synergy (windows) server cannot negotiate a connection.

Synergy shows this repeating error:

[2022-12-02T13:37:20] INFO: accepted secure socket
[2022-12-02T13:37:20] INFO: network encryption protocol: TLSv1.3
[2022-12-02T13:37:20] NOTE: accepted client connection
[2022-12-02T13:37:20] WARNING: protocol error from client "<unknown>"
[2022-12-02T13:37:20] ERROR: tls error occurred (system call failure)
[2022-12-02T13:37:20] ERROR: eof violates tls protocol
[2022-12-02T13:37:23] INFO: accepted secure socket
[2022-12-02T13:37:23] INFO: network encryption protocol: TLSv1.3
[2022-12-02T13:37:23] NOTE: accepted client connection
[2022-12-02T13:37:23] WARNING: protocol error from client "<unknown>"
[2022-12-02T13:37:23] ERROR: tls error occurred (system call failure)
[2022-12-02T13:37:23] ERROR: eof violates tls protocol
[2022-12-02T13:37:26] INFO: accepted secure socket
[2022-12-02T13:37:26] INFO: network encryption protocol: TLSv1.3
[2022-12-02T13:37:26] NOTE: accepted client connection
[2022-12-02T13:37:26] WARNING: protocol error from client "<unknown>"
[2022-12-02T13:37:26] ERROR: tls error occurred (system call failure)
[2022-12-02T13:37:26] ERROR: eof violates tls protocol

Waynergy shows this repeating start up sequence

wl-clipboard 2.1.0
Copyright (C) 2019 Sergey Bugaev
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
wl-clipboard 2.1.0
Copyright (C) 2019 Sergey Bugaev
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
ste
0.003515046: [DEBUG] Child died: PID 2040120, Status 0
0.003630001: [DEBUG] Found wl-copy
0.003661224: [DEBUG] not requiring wait() on SIGCHLD
0.021906167: [WARN] Child died: PID 2040121, Status 1
0.021960143: [WARN] Could not kill lingering wlpaste instances: -1

0.022288499: [DEBUG] Got value from INI: wayland/flush_timeout: 5000
0.022301903: [DEBUG] Using INI value for wayland/flush_timeout: 5000
0.022397926: [DEBUG] Got idle manager
0.022468417: [DEBUG] Seat name is seat0
0.022478919: [DEBUG] Seat has pointer
0.022487693: [DEBUG] Seat has keyboard
0.022497380: [DEBUG] Mutating output...
0.022506094: [DEBUG] Got output at position 0,0
0.022515591: [DEBUG] Got current mode: 2880x1920@120000
0.022525049: [INFO] Not using preferred mode on output -- check config
0.022533954: [DEBUG] Mutating output...
0.022542876: [DEBUG] Got scale factor for output: 2
0.022551655: [DEBUG] Mutating output...
0.022560631: [INFO] Output updated: 2880x1920 at 0, 0 (scale: 2)
0.022570329: [DEBUG] Got xdg output name: eDP-1
0.022579268: [DEBUG] Mutating output from xdg_output event
0.022588180: [DEBUG] Got xdg output desc: LGD 0x06B1 0x00003CA1 (eDP-1)
0.022596939: [DEBUG] Mutating output from xdg_output event
0.022606218: [DEBUG] Got xdg output position: 0, 1440
0.022615001: [DEBUG] Mutating output from xdg_output event
0.022623850: [DEBUG] Got xdg output size: 1440x960
0.022632719: [DEBUG] Mutating output from xdg_output event
0.022641442: [INFO] Output name: eDP-1
0.022650218: [INFO] Output description: LGD 0x06B1 0x00003CA1 (eDP-1)
0.022660914: [INFO] Output updated: 1440x960 at 0, 1440 (scale: 2)
0.022671305: [DEBUG] Mutating output...
0.022679821: [DEBUG] Got output at position 0,0
0.022689321: [DEBUG] Got current mode: 2560x1440@59961
0.022698409: [INFO] Not using preferred mode on output -- check config
0.022706993: [DEBUG] Mutating output...
0.022715875: [DEBUG] Got scale factor for output: 1
0.022724600: [DEBUG] Mutating output...
0.022733412: [INFO] Output updated: 2560x1440 at 0, 0 (scale: 1)
0.022742427: [DEBUG] All outputs updated, triggering event
0.022751185: [INFO] Geometry updated: 2560x2400
0.022760419: [DEBUG] Got xdg output name: DP-5
0.022769098: [DEBUG] Mutating output from xdg_output event
0.022777945: [DEBUG] Got xdg output desc: Dell Inc. DELL U2515H (DP-5)
0.022786610: [DEBUG] Mutating output from xdg_output event
0.022795640: [DEBUG] Got xdg output position: 0, 0
0.022804547: [DEBUG] Mutating output from xdg_output event
0.022813515: [DEBUG] Got xdg output size: 2560x1440
0.022822552: [DEBUG] Mutating output from xdg_output event
0.022831738: [INFO] Output name: DP-5
0.022840323: [INFO] Output description: Dell Inc. DELL U2515H (DP-5)
0.022848865: [INFO] Output updated: 2560x1440 at 0, 0 (scale: 1)
0.022857779: [DEBUG] All outputs updated, triggering event
0.022866318: [INFO] Geometry updated: 2560x2400
0.022900161: [DEBUG] Property wl_keyboard_map not found in INI
0.022939883: [DEBUG] Current keymap updated
0.022968396: [INFO] Compositor seems to be sway
0.022980489: [DEBUG] Section wlr not found in INI
0.028565356: [DEBUG] Got version string sway version 1.8-dev-85005b52 (Nov 12 2022, branch 'master')

0.028604018: [INFO] Sway version is 1.8
0.028617419: [DEBUG] Section wlr not found in INI
0.028637182: [DEBUG] Using wheel_mult value of 120
0.028649577: [DEBUG] Section button-map not found in INI
0.028662722: [DEBUG] Set button mapping: 0 -> 0
0.028674057: [DEBUG] Section button-map not found in INI
0.028686892: [DEBUG] Set button mapping: 1 -> 272
0.028698172: [DEBUG] Section button-map not found in INI
0.028710815: [DEBUG] Set button mapping: 2 -> 274
0.028735614: [DEBUG] Section button-map not found in INI
0.028748325: [DEBUG] Set button mapping: 3 -> 273
0.028759591: [DEBUG] Section button-map not found in INI
0.028772065: [DEBUG] Set button mapping: 4 -> 275
0.028785106: [DEBUG] Child died: PID 2040124, Status 0
0.028824372: [DEBUG] Section button-map not found in INI
0.028833543: [DEBUG] Set button mapping: 5 -> 276
0.028841551: [INFO] Using wlroots virtual input protocols
0.028849639: [INFO] Using wlroots protocols for virtual input
0.036641686: [DEBUG] Property wl_keyboard_map not found in INI
0.036723787: [DEBUG] Current keymap updated
0.036806307: [DEBUG] Will default to map xkb_keymap {

(cut out keymap stuff due to length)

0.036923407: [DEBUG] Property xkb_keymap not found in INI
0.039554605: [DEBUG] Setting virtual keymap
0.039609398: [DEBUG] max key: 709
0.039641545: [DEBUG] Got value from INI: raw-keymap/offset: 0
0.039657190: [DEBUG] Using INI value for raw-keymap/offset: 0
0.039672826: [DEBUG] Got value from INI: xkb_key_offset: 8
0.039687938: [DEBUG] Using INI value for xkb_key_offset: 8
0.039702909: [DEBUG] Initial raw key offset: 8
0.039720056: [DEBUG] Got value from INI: raw-keymap/offset_on_explicit: false
0.039735298: [DEBUG] Using INI value for raw-keymap/offset_on_explicit: false
0.039751889: [DEBUG] set raw key map: 331 = 113
0.039767196: [DEBUG] Set maximum raw keycode to 114
0.039782368: [DEBUG] set raw key map: 328 = 111
0.039797807: [DEBUG] set raw key map: 333 = 114
0.039813150: [DEBUG] Set maximum raw keycode to 115
0.039828337: [DEBUG] set raw key map: 336 = 116
0.039843359: [DEBUG] Set maximum raw keycode to 117
0.039858381: [DEBUG] set raw key map: 338 = 118
0.039873347: [DEBUG] Set maximum raw keycode to 119
0.039888133: [DEBUG] set raw key map: 327 = 110
0.039903449: [DEBUG] set raw key map: 329 = 112
0.039930693: [DEBUG] set raw key map: 339 = 119
0.039946196: [DEBUG] Set maximum raw keycode to 120
0.039960010: [DEBUG] set raw key map: 335 = 115
0.039973115: [DEBUG] set raw key map: 337 = 117
0.039987326: [DEBUG] set raw key map: 347 = 133
0.040000045: [DEBUG] Set maximum raw keycode to 134
0.040012136: [DEBUG] set raw key map: 312 = 108
0.040024139: [DEBUG] set raw key map: 349 = 135
0.040036303: [DEBUG] Set maximum raw keycode to 136
0.040050220: [DEBUG] set raw key map: 284 = 104
0.040063899: [DEBUG] set raw key map: 325 = 77
0.040075968: [DEBUG] set raw key map: 309 = 106
0.040088743: [DEBUG] max key: 61440
0.040100895: [DEBUG] Could not find section id-keymap
0.040132846: [DEBUG] Got value from INI: idle-inhibit/enable: false
0.040148181: [DEBUG] Using INI value for idle-inhibit/enable: false
0.040163098: [INFO] Idle inhibition explicitly disabled
0.040179443: [DEBUG] Got idle inhibit request: on
0.040193908: [DEBUG] No idle inhibition support, ignoring request
0.040209169: [INFO] Going to connect to 10.1.0.12 at port 24800
0.042519143: [DEBUG] Section tls not found in INI
0.058547774: [DEBUG] Accepting
0.058618141: [DEBUG] Accepting
0.058639660: [DEBUG] Clipboard data read for p: 52 bytes
0.058678128: [DEBUG] Clipboard data read for c: 52 bytes
0.071694246: [INFO] Server is Synergy 1.8
0.071763907: [INFO] Connected as client "aut"
0.072193798: [ERROR] Protocol error
[1]    2039369 segmentation fault (core dumped)  /usr/bin/waynergy -c <server ip> -N <name> -e -t -L debug
  1. Restarting and/or recompiling waynergy does not solve it.
  2. Restarting Synergy in windows does not solve it.
  3. Rebooting the system running Waynergy immediately solves it, but sometimes it appears to solve itself.
    (however, NOT quickly. I will let it try forever and after a while of ignoring, it will sometimes come back)

I've tried regenerating the SSL cert on the server and wiping out ~/.config/waynergy/tls on the client to be sure its not a cert issue. but that does not resolv anything.

Let me know what your thoughts are on how to debug this.

r-c-f commented

Build/install with debugging symbols (place CFLAGS=-g before the meson command; for example, CFLAGS=-g meson dbg; cd dbg; ninja...) and -- when it happens -- run coredumpctl gdb waynergy and post the output of the bt command (ideally say 'yes' to the prompt about debuginfod)

I disabled TLS today to work around the annoyance, but interestingly still ran into segfaults

└[~]> coredumpctl gdb waynergy
Hint: You are currently not seeing messages from other users and the system.
      Users in groups 'adm', 'systemd-journal', 'wheel' can see all messages.
      Pass -q to turn off this notice.
           PID: 553019 (waynergy)
           UID: 1000 (REDACTED)
           GID: 1000 (REDACTED)
        Signal: 11 (SEGV)
     Timestamp: Sat 2022-12-03 14:33:58 CST (43s ago)
  Command Line: /usr/bin/waynergy -c 10.1.0.12 -N aut -E -t -L debug
    Executable: /usr/bin/waynergy
 Control Group: /user.slice/user-1000.slice/user@1000.service/app.slice/app-org.wezfurlong.wezterm.slice/app-org.wezfurlong.wezterm-103561.scope
          Unit: user@1000.service
     User Unit: app-org.wezfurlong.wezterm-103561.scope
         Slice: user-1000.slice
     Owner UID: 1000 (REDACTED)
       Boot ID: cc47c8056d4847c5914b07db6b8f8cad
    Machine ID: 0f39e9d52c1b4287ad9123027fcd3852
      Hostname: REDACTED
       Storage: /var/lib/systemd/coredump/core.waynergy.1000.cc47c8056d4847c5914b07db6b8f8cad.553019.1670099638000000.zst (present)
  Size on Disk: 150.8K
       Message: Process 553019 (waynergy) of user 1000 dumped core.

                Stack trace of thread 553019:
                #0  0x00007fb6e4d3ee86 n/a (libc.so.6 + 0x164e86)
                #1  0x00005631f7adee64 n/a (waynergy + 0xae64)
                #2  0x00005631f7ada7d7 n/a (waynergy + 0x67d7)
                #3  0x00007fb6e4bfd290 n/a (libc.so.6 + 0x23290)
                #4  0x00007fb6e4bfd34a __libc_start_main (libc.so.6 + 0x2334a)
                #5  0x00005631f7ada855 n/a (waynergy + 0x6855)
                ELF object binary architecture: AMD x86-64

GNU gdb (GDB) 12.1
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /usr/bin/waynergy...

This GDB supports auto-downloading debuginfo from the following URLs:
https://debuginfod.archlinux.org
Enable debuginfod for this session? (y or [n]) y
Debuginfod has been enabled.
To make this setting permanent, add 'set debuginfod enabled on' to .gdbinit.
(No debugging symbols found in /usr/bin/waynergy)
[New LWP 553019]
Downloading 0.12 MB separate debug info for /usr/lib/libwayland-client.so.0
Downloading 0.65 MB separate debug info for /usr/lib/libxkbcommon.so.0
Downloading 9.93 MB separate debug info for /usr/lib/libc.so.6
Downloading 0.11 MB separate debug info for /usr/lib/libffi.so.8
Downloading 1.07 MB separate debug info for /lib64/ld-linux-x86-64.so.2
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
Core was generated by `/usr/bin/waynergy -c 10.1.0.12 -N aut -E -t -L debug'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  __memcpy_evex_unaligned_erms () at ../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S:469
Downloading 0.03 MB source file /build/glibc/src/glibc/string/../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S
469             VMOVU   -VEC_SIZE(%rsi, %rdx), %VEC(5)
(gdb) bt
#0  __memcpy_evex_unaligned_erms () at ../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S:469
#1  0x00005631f7adee64 in ?? ()
#2  0x00005631f7ada7d7 in ?? ()
#3  0x00007fb6e4bfd290 in __libc_start_call_main (main=main@entry=0x5631f7ad80a0, argc=argc@entry=9, argv=argv@entry=0x7ffcb93eb548)
    at ../sysdeps/nptl/libc_start_call_main.h:58
#4  0x00007fb6e4bfd34a in __libc_start_main_impl (main=0x5631f7ad80a0, argc=9, argv=0x7ffcb93eb548, init=<optimized out>,
    fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7ffcb93eb538) at ../csu/libc-start.c:381
#5  0x00005631f7ada855 in ?? ()
(gdb)

Turned on TLS and this is what it looks like

# coredumpctl gdb waynergy
Hint: You are currently not seeing messages from other users and the system.
      Users in groups 'adm', 'systemd-journal', 'wheel' can see all messages.
      Pass -q to turn off this notice.
           PID: 570118 (waynergy)
           UID: 1000 (REDACTED)
           GID: 1000 (REDACTED)
        Signal: 11 (SEGV)
     Timestamp: Sat 2022-12-03 15:03:03 CST (3s ago)
  Command Line: /usr/bin/waynergy -c 10.1.0.12 -N aut -e -t -L debug
    Executable: /usr/bin/waynergy
 Control Group: /user.slice/user-1000.slice/user@1000.service/app.slice/app-org.wezfurlong.wezterm.slice/app-org.wezfurlong.wezterm-103561.scope
          Unit: user@1000.service
     User Unit: app-org.wezfurlong.wezterm-103561.scope
         Slice: user-1000.slice
     Owner UID: 1000 (REDACTED)
       Boot ID: cc47c8056d4847c5914b07db6b8f8cad
    Machine ID: 0f39e9d52c1b4287ad9123027fcd3852
      Hostname: REDACTED
       Storage: /var/lib/systemd/coredump/core.waynergy.1000.cc47c8056d4847c5914b07db6b8f8cad.570118.1670101383000000.zst (present)
  Size on Disk: 208.4K
       Message: Process 570118 (waynergy) of user 1000 dumped core.

                Stack trace of thread 570118:
                #0  0x00007f7646d75e86 n/a (libc.so.6 + 0x164e86)
                #1  0x0000562f4cdb4e64 n/a (waynergy + 0xae64)
                #2  0x0000562f4cdb07d7 n/a (waynergy + 0x67d7)
                #3  0x00007f7646c34290 n/a (libc.so.6 + 0x23290)
                #4  0x00007f7646c3434a __libc_start_main (libc.so.6 + 0x2334a)
                #5  0x0000562f4cdb0855 n/a (waynergy + 0x6855)
                ELF object binary architecture: AMD x86-64

GNU gdb (GDB) 12.1
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /usr/bin/waynergy...

This GDB supports auto-downloading debuginfo from the following URLs:
https://debuginfod.archlinux.org
Enable debuginfod for this session? (y or [n]) y
Debuginfod has been enabled.
To make this setting permanent, add 'set debuginfod enabled on' to .gdbinit.
(No debugging symbols found in /usr/bin/waynergy)
[New LWP 570118]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
Core was generated by `/usr/bin/waynergy -c 10.1.0.12 -N aut -e -t -L debug'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  __memcpy_evex_unaligned_erms () at ../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S:469
469             VMOVU   -VEC_SIZE(%rsi, %rdx), %VEC(5)
(gdb) bt
#0  __memcpy_evex_unaligned_erms () at ../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S:469
#1  0x0000562f4cdb4e64 in ?? ()
#2  0x0000562f4cdb07d7 in ?? ()
#3  0x00007f7646c34290 in __libc_start_call_main (main=main@entry=0x562f4cdae0a0, argc=argc@entry=9, argv=argv@entry=0x7ffc498b0678)
    at ../sysdeps/nptl/libc_start_call_main.h:58
#4  0x00007f7646c3434a in __libc_start_main_impl (main=0x562f4cdae0a0, argc=9, argv=0x7ffc498b0678, init=<optimized out>,
    fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7ffc498b0668) at ../csu/libc-start.c:381
#5  0x0000562f4cdb0855 in ?? ()
(gdb)

This is not always true, but the trigger for this was that I stopped waynergy after the mouse became locked on the client side and I could not give it back to the windows host without stopping it on the client. (this happens in videogames sometimes as well as if I get prompted for elevated permissions on windows when my mouse it on the linux client)

As soon as I try to start waynergy again, segfault.

r-c-f commented

That last bit was reliable here as well; it is now resolved.