Subject: Bug#1603: segfault when starting new Terminal session (error 14 in nxagent)

From: Wes Piard <[email-masked]>
Date: Wed, 24 May 2023 02:52:56 -0400

Package: nxagent
Version: 3.5.99.26

x2go client system: Windows 11 Pro
x2go server system: RHEL/Rocky 8.8, Linux 4.18.0-477.10.1
x2goclient version: 4.1.2.2
x2goserver, x2goagent version: 4.1.0.3
nxagent, nx-libs version: 3.5.99.26

When attempting to start a new session using x2go of type "Single application" with command "Terminal", the x2go client receives the following error:

"X2Go - 57: The connection with the remote server was shut down. Please check the state of your network connection."

At this point, the x2go server gets a segfault from nxagent:

kernel: x2goagent[16153]: segfault at 0 ip 0000000000000000 sp 00007fff984cffc8 error 14 in nxagent[55bf4d27a000+439000]

Here is the full output shown in /var/log/messages:

systemd-logind[1092]: New session 11 of user wespiard.
systemd[1]: Started Session 11 of user wespiard.
/usr/bin/x2gostartagent[16162]: successfully started X2Go Agent session with ID wespiard-58-1684910138_stRTERMINAL_dp32
kernel: x2goagent[16153]: segfault at 0 ip 0000000000000000 sp 00007fff984cffc8 error 14 in nxagent[55bf4d27a000+439000]
kernel: Code: Unable to access opcode bytes at RIP 0xffffffffffffffd6.
systemd[1]: Started Process Core Dump (PID 16440/UID 0).
systemd-coredump[16441]: Process 16153 (x2goagent) of user 1001 dumped core.#012#012Stack trace of thread 16153:#012#0  0x0000000000000000 n/a (n/a)
systemd[1]: [email-masked]: Succeeded.
systemd-logind[1092]: Session 11 logged out. Waiting for processes to exit.
/usr/bin/x2gosetkeyboard[16662]: /home/wespiard/.x2go/C-wespiard-58-1684910138_stRTERMINAL_dp32/keyboard did not appear within 30s after agent startup
systemd[1]: session-11.scope: Succeeded.
systemd-logind[1092]: Removed session 11.

Here is the output of "coredumpctl info 16153":

           PID: 16153 (x2goagent)
           UID: 1001 (wespiard)
           GID: 1001 (wespiard)
        Signal: 11 (SEGV)
     Timestamp: Wed 2023-05-24 06:35:42 UTC (9min ago)
  Command Line: x2goagent -nolisten tcp -nolisten tcp -dpi 96 -R -auth /home/wespiard/.Xauthority -geometry 1024x768 -name X2GO-wespiard-58-1684910138_stRTERMINAL_dp32 :58
    Executable: /usr/bin/nxagent
 Control Group: /user.slice/user-1001.slice/session-11.scope
          Unit:
         Slice: user-1001.slice
       Session: 11
     Owner UID: 1001 (wespiard)
       Storage: /var/lib/systemd/coredump/core.x2goagent.1001.8af9355d6c8542eb8b72103dc32ef9c0.16153.1684910142000000.lz4
       Message: Process 16153 (x2goagent) of user 1001 dumped core.

                Stack trace of thread 16153:
                #0  0x0000000000000000 n/a (n/a)