About once a week I get a crash that prevents me from logging into my
running desktop. I'm hitting this on Ubuntu 26.04.1 LTS, gnome-keyring
50.0-1 (amd64, Wayland GNOME), and was able to get a backtrace from the
apport core.

**Root cause (from the backtrace):** the Secret Service `OpenSession`
D-Bus method handler builds its reply with `g_variant_new("(@vo)",
output, path)` without checking that `output` is non-NULL. When session
negotiation fails (`aes_negotiate: assertion 'session' failed`),
`output` is NULL, GLib logs a G_LOG_LEVEL_ERROR, and the daemon aborts.
The earlier `gkd_secret_service_get_pkcs11_session: assertion 'client'
failed` suggests the client had already gone away (disconnected mid-
handshake), so the failed negotiation is the trigger and the missing
NULL check is the bug.

Crashing thread (gnome-keyring-daemon frames are unsymbolized; GLib/GIO
frames resolved via debuginfod):

```
#5  _g_log_abort (breakpoint=<optimized out>) at ../../../glib/gmessages.c:454
#8  g_logv (log_domain="GLib", log_level=G_LOG_LEVEL_ERROR, ...) at 
gmessages.c:1286
#10 g_variant_valist_new_nnp (str=0x7fff00f52488, ptr=0x0) at gvariant.c:4978
#13 g_variant_new (format_string=0x6351c41a9da7 "(@vo)") at gvariant.c:5480
#14 0x00006351c416543a in ?? ()      <- gnome-keyring-daemon
#15 0x00006351c415e286 in ?? ()      <- gnome-keyring-daemon
#16 g_closure_invoke (n_param_values=4, ...) at gclosure.c:916
#19 g_signal_emitv (...) at gsignal.c:3153
#20 0x00006351c415f30c in ?? ()      <- gnome-keyring-daemon
#21 g_dbus_interface_skeleton_method_dispatch_real (...) at 
gdbusinterfaceskeleton.c:616
#22 call_in_idle_cb (...) at gdbusconnection.c:5476
#26 g_main_loop_run (...) at gmain.c:4721
```

Journal immediately before the abort (03:14:29):

```
gkd_secret_service_get_pkcs11_session: assertion 'client' failed
aes_negotiate: assertion 'session' failed
gkd_secret_service_publish_dispatch: assertion 'client' failed
GLib: g_variant_get_type: assertion 'value != NULL' failed
GLib: g_variant_new: expected GVariant of type 'v' but received value has type 
'(null)'
```

**Differences from the original report, in case they help:**
- It did not happen at login. The daemon had been up for about 1 week 8 hours 
on an otherwise idle desktop, and the crash was at 03:14.
- No OOM: no kernel OOM kills in the journal, and plenty of free RAM.

**Aftermath:** systemd restarted `gnome-keyring-daemon.service`, but the
login collection came back locked, and a second, dbus-activated `gnome-
keyring-daemon --start --components=secrets` instance ended up owning
`org.freedesktop.secrets`. So `gnome-keyring-daemon --unlock` (which
talks to the control socket) unlocked the wrong instance and the secrets
service stayed locked. Anything keyed on the keyring then fails; in my
case gnome-remote-desktop could no longer read its RDP credentials
("Couldn't retrieve RDP credentials"), so every remote login was refused
until I intervened.

**Workaround that worked:** stop `gnome-keyring-daemon.socket` and
`.service`, kill the stray daemons, then start one with the password on
stdin:

```
printf '%s' "$PASSWORD" | systemd-run --user --scope --collect -q \
  setsid -f gnome-keyring-daemon --login --foreground 
--components=pkcs11,secrets
```

I'm also marking this as affecting me. I can test a fix or provide a
symbolized trace for the gnome-keyring frames if someone points me at
the right dbgsym package.

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2161749

Title:
  gnome-keyring-daemon repeatedly crashes during Secret Service session
  negotiation and leaves login keyring locked

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/gnome-keyring/+bug/2161749/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to