gnome-keyring-daemon crashes on exit
On Solaris 11.4, at Gnome logout, gnome-keyring-daemon 3.34.0 crashes and produces a core file.
To reproduce:
Login to Gnome
Logout
# pstack /var/cores/core.gnome-keyring-daemon.0.1598274988
core '/var/cores/core.gnome-keyring-daemon.0.1598274988' of 1439: /usr/bin/gnome-keyring-daemon --start --components=secrets
------------ lwp# 1 / thread# 1 ---------------
00007fd867a68e9d pthread_mutex_destroy () + d
00007fd8671451c5 g_mutex_clear () + 15
00000000004a3111 gkd_ssh_agent_preload_finalize () + 71 (gkd-ssh-agent-preload.c:130)
00007fd8674382ce g_object_unref () + 21e
00000000004a3c48 gkd_ssh_agent_service_finalize () + 38 (gkd-ssh-agent-service.c:129)
00007fd8674382ce g_object_unref () + 21e
00000000004b3c07 egg_cleanup_perform () + 37 (egg-cleanup.c:83)
000000000048091d main () + 2ed
000000000047f703 _start () + 43
It seems that unlike other places, daemon/ssh-agent/gkd-ssh-agent-preload.c does not initialize the mutex.
I believe the reason the crash isn't widespread is that it's not happening on Linux, as glib2 has two implementations of g_mutex_clear
https://gitlab.gnome.org/GNOME/glib/-/blob/master/glib/gthread-posix.c#L199
https://gitlab.gnome.org/GNOME/glib/-/blob/master/glib/gthread-posix.c#L1440
and the Linux one handles uninitialized mutexes gracefully.
The attached patch fixes it for me, but I don't have a deep knowledge of this component to be 100% confident it's correct.[05-lock.patch](/uploads/c7fd7fb75faa98484241df14ad2246d7/05-lock.patch)
Edited by Pavel Heimlich