<div dir="ltr"><div>Dear maintainer of gcr package,<br></div><div><br></div><div>I also have been caught by this crash of gcr-ssh-agent. I strongly believe that this issue is attributed to gnome's gcr-ssh-agent. This issue has already been fixed upstream. In the following I am going to provide arguments to support my conclusion.  </div><div><br></div><div>I can reproduce this issue when I try to test ssh connection:</div><div>```</div><div># test rig<br>$ export SSH_AUTH_SOCK=/run/user/1000/gcr/ssh<br>$ ssh -T <a href="mailto:git@github.com">git@github.com</a></div><div><br></div><div># crash confirmation</div><div>$ journalctl --no-pager -f</div><div>Jan 15 08:42:07 pc-debian systemd[629]: gcr-ssh-agent.service: Main process exited, code=killed, status=11/SEGV<br>Jan 15 08:42:07 pc-debian systemd[629]: gcr-ssh-agent.service: Failed with result 'signal'.<br>Jan 15 08:42:08 pc-debian systemd[629]: gcr-ssh-agent.service: Scheduled restart job, restart counter is at 1.<br>Jan 15 08:42:08 pc-debian systemd[629]: Stopped gcr-ssh-agent.service - GCR ssh-agent wrapper.<br>Jan 15 08:42:08 pc-debian systemd[629]: Started gcr-ssh-agent.service - GCR ssh-agent wrapper.</div><div>```<br></div><div><br></div><div>I decided to attach a dbg to the running service in order to find the cause of the problem.</div><div>```</div><div>$ export DEBUGINFOD_URLS="<a href="https://debuginfod.debian.net">https://debuginfod.debian.net</a>"<br>$ gdb  /usr/libexec/gcr-ssh-agent -p <pid_of_gcr-ssh-agent><br></div><div>GNU gdb (Debian 13.1-3) 13.1<br>...<br>This GDB supports auto-downloading debuginfo from the following URLs:<br>  <<a href="https://debuginfod.debian.net">https://debuginfod.debian.net</a>><br>Enable debuginfod for this session? (y or [n]) y<br>Debuginfod has been enabled.<br>...<br>(gdb) set pagination 0<br>(gdb) run /run/user/1000/gcr/<br>Starting program: /usr/libexec/gcr-ssh-agent /run/user/1000/gcr/<br>Downloading separate debug info for system-supplied DSO at 0x7ffff7fc9000<br>...<br>[New Thread 0x7ffff71f66c0 (LWP 2330)]<br>[New Thread 0x7ffff69f56c0 (LWP 2366)]<br>[Detaching after fork from child process 2367]<br><br>Thread 3 "pool" received signal SIGSEGV, Segmentation fault.<br>[Switching to Thread 0x7ffff69f56c0 (LWP 2366)]<br>0x00007ffff7e5ffc0 in ascii_table_data () from /lib/x86_64-linux-gnu/libglib-2.0.so.0<br>(gdb) bt<br>#0  0x00007ffff7e5ffc0 in ascii_table_data () at /lib/x86_64-linux-gnu/libglib-2.0.so.0<br>#1  0x000055555555b25a in handle_request<br>    (error=0x7ffff69f4718, cancellable=0x555555574620 [GCancellable], resp=0x7ffff69f4750, req=0x7ffff69f4720, connection=0x7fffe8006450 [GUnixConnection], self=0x555555566b60 [GcrSshAgentService])<br>    at ../gcr/gcr-ssh-agent-service.c:197<br>#2  on_run (service=<optimized out>, connection=connection@entry=0x5555555814f0 [GUnixConnection], source_object=source_object@entry=0x0, user_data=user_data@entry=0x555555566b60)<br>    at ../gcr/gcr-ssh-agent-service.c:326<br>#3  0x00007ffff7bea19e in _g_cclosure_marshal_BOOLEAN__OBJECT_OBJECTv<br>    (closure=0x555555580660, return_value=0x7ffff69f4940, instance=<optimized out>, args=<optimized out>, marshal_data=<optimized out>, n_params=<optimized out>, param_types=0x55555557c4c0)<br>    at ../../../gio/gmarshal-internal.c:335<br>#4  0x00007ffff7d5d5a9 in _g_closure_invoke_va<br>    (closure=closure@entry=0x555555580660, return_value=return_value@entry=0x7ffff69f4940, instance=instance@entry=0x5555555775d0, args=args@entry=0x7ffff69f4a10, n_params=2, param_types=0x55555557c4c0)<br>    at ../../../gobject/gclosure.c:895<br>#5  0x00007ffff7d7605e in g_signal_emit_valist (instance=0x5555555775d0, signal_id=8, detail=<optimized out>, var_args=var_args@entry=0x7ffff69f4a10) at ../../../gobject/gsignal.c:3456<br>#6  0x00007ffff7d76dbf in g_signal_emit (instance=<optimized out>, signal_id=<optimized out>, detail=detail@entry=0) at ../../../gobject/gsignal.c:3606<br>#7  0x00007ffff7c1c71d in g_threaded_socket_service_func (job_data=0x555555576400, user_data=<optimized out>) at ../../../gio/gthreadedsocketservice.c:98<br>#8  0x00007ffff7e256ca in g_thread_pool_thread_proxy (data=<optimized out>) at ../../../glib/gthreadpool.c:352<br>#9  0x00007ffff7e24cfd in g_thread_proxy (data=0x5555555671e0) at ../../../glib/gthread.c:831<br>#10 0x00007ffff78dd044 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442<br>#11 0x00007ffff795d61c in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81<br>(gdb) Quit<br>(gdb)</div><div>```</div><div><br></div><div>This have lead me to the source code of gcr-ssh-agent-service.c at line 197</div><div><a href="https://gitlab.gnome.org/GNOME/gcr/-/blob/gcr-3-41/gcr/gcr-ssh-agent-service.c?ref_type=heads#L191">https://gitlab.gnome.org/GNOME/gcr/-/blob/gcr-3-41/gcr/gcr-ssh-agent-service.c?ref_type=heads#L191</a><br></div><div><br></div><div>According to backtrace the crash appears at line 197, but there is an `if` branch above with wrong comparison `op <= GCR_SSH_OP_MAX` should be `op < GCR_SSH_OP_MAX`. I was ready to report a bug report to gcr project when I suddenly found that this issue has been fixed already:</div><div><a href="https://gitlab.gnome.org/GNOME/gnome-keyring/-/merge_requests/47/diffs">https://gitlab.gnome.org/GNOME/gnome-keyring/-/merge_requests/47/diffs</a><br></div><div><br></div><div>I built the gcr-ssh-agent from the 4.2.0 branch and I can confirm that the issue is resolved with the new binary.</div><div><br></div><div>I guess it might be possible to apply this patch to the gcr debian package also in order to publish a new version of the package. </div><div><br></div><div>---</div><div>Rustam</div></div>