gsd-smartcard: segfault on startup

Bug #2016914 reported by Chorca
20
This bug affects 4 people
Affects Status Importance Assigned to Milestone
GNOME Settings Daemon
Unknown
Unknown
gnome-settings-daemon (Ubuntu)
Triaged
High
Unassigned

Bug Description

A smartcard reader attached to the computer on startup, containing a non-standard smartcard (in this case an NXP AV3 SAM card) causes gsd-smartcard to segfault and restart 200 times after login.

System Info:
This is Ubuntu 22.04.2 LTS at Kernel 5.19.0-38-generic
The Smart Card reader is an Identiv uTrust 4711 F with both SAM and Contactless slots
The system is an HP ZBook Firefly 14 G7

Detailed issue:
When the smartcard reader is plugged into the system, and an NXP SAM AV3 card is inserted into the physical smartcard slot, upon login several (5) Ubuntu Error report windows will open asking to report a crash. The reader lights will flicker for about 5 minutes until they finally stop. No other issues are seen with the system during this time.

Upon looking at /var/log/syslog, the errors listed in the attachment are visible as it appears gsd-smartcard is in a loop of restarting and crashing following an error.

/var/crash contains two files from the crash loop, _usr_libexec_gsd_smartcard.1000.crash and _usr_libexec_gsd_smartcard_127.crash

Eventually the crashes seem to stop and the light stops flickering, but a logout and log back in will restart the issue again, as will rebooting the machine. Re-plugging the device while logged in does not seem to cause it to start the crash loop again.

To complete the standard questions:
1. I logged into my computer and saw error messages
2. I expected the smart card to be ignored if there was a card inserted that was unexpected or incompatible with the gnome settings daemon
3. I encountered several crash reporter messages upon logging in, which seem to have come from the gsd-smartcard program

Revision history for this message
Chorca (chorca) wrote :
Revision history for this message
Chorca (chorca) wrote :

Have attempted to use apport to attach the crash dump but have so far been unsuccessful. It doesn't seem to upload anything.

Revision history for this message
Erich Eickmeyer (eeickmeyer) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better. Unfortunately, we cannot work on this bug because your description didn't include enough information. You may find it helpful to read "How to report bugs effectively" http://www.chiark.greenend.org.uk/~sgtatham/bugs.html. We'd be grateful if you would then provide a more complete description of the problem.

We have instructions on debugging some types of problems at http://wiki.ubuntu.com/DebuggingProcedures.

At a minimum, we need:

1. The specific steps or actions you took that caused you to encounter the problem.
2. The behavior you expected.
3. The behavior you actually encountered (in as much detail as possible).

Please also ensure that you include the release and flavour of Ubuntu that you are using.

Thank you!

Changed in gnome-settings-daemon (Ubuntu):
status: New → Incomplete
Revision history for this message
Chorca (chorca) wrote :

Sure!

I've gone ahead and updated the description with a better description of the problem. I have the crashdump files as well, if those can be uploaded somewhere.

description: updated
Chorca (chorca)
Changed in gnome-settings-daemon (Ubuntu):
status: Incomplete → New
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in gnome-settings-daemon (Ubuntu):
status: New → Confirmed
Revision history for this message
Sebastien Bacher (seb128) wrote :

It sounds like some part of the system has crashed. To help us find the cause of the crash please follow these steps:

1. Look in /var/crash for crash files and if found run:
    ubuntu-bug YOURFILE.crash
Then tell us the ID of the newly-created bug.

2. If step 1 failed then look at https://errors.ubuntu.com/user/ID where ID is the content of file /var/lib/whoopsie/whoopsie-id on the machine. Do you find any links to recent problems on that page? If so then please send the links to us.

Please take care to avoid attaching .crash files to bugs as we are unable to process them as file attachments. It would also be a security risk for yourself.

Changed in gnome-settings-daemon (Ubuntu):
importance: Undecided → High
status: Confirmed → Incomplete
Revision history for this message
Chorca (chorca) wrote :

I've been able to upload the crashfile using ubuntu-bug, but an ID was not created. I found the relevant error report here: https://errors.ubuntu.com/oops/5a0ff543-eea3-11ed-bb84-fa163ef35206

Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for gnome-settings-daemon (Ubuntu) because there has been no activity for 60 days.]

Changed in gnome-settings-daemon (Ubuntu):
status: Incomplete → Expired
Revision history for this message
stsp (stsp-0) wrote :

Thread 1 "gsd-smartcard" received signal SIGSEGV, Segmentation fault.
0x000055555556237f in sync_initial_tokens_from_driver (
    cancellable=0x555555592e50, smartcards=0x5555555ab1f0,
    module=<optimized out>, self=0x555555578170)
    at ../plugins/smartcard/gsd-smartcard-manager.c:436
Downloading source file /usr/src/gnome-settings-daemon-44.0-1ubuntu1/obj-x86_64-linux-gnu/../plugins/smartcard/gsd-smartcard-manager.c
warning: Source file is more recent than executable.
436 g_debug ("Detected smartcard '%s' in slot %lu at start up",
(gdb)
(gdb) bt
#0 0x000055555556237f in sync_initial_tokens_from_driver
    (cancellable=0x555555592e50, smartcards=0x5555555ab1f0, module=<optimized out>, self=0x555555578170) at ../plugins/smartcard/gsd-smartcard-manager.c:436
#1 watch_smartcards_from_module_async
    (callback=0x55555555f9c0 <on_smartcards_from_module_watched>, user_data=0x0, cancellable=0x555555592e50, module=<optimized out>, self=0x555555578170)
    at ../plugins/smartcard/gsd-smartcard-manager.c:476
#2 on_modules_initialized
    (source_object=<optimized out>, result=<optimized out>, user_data=0x0)
    at ../plugins/smartcard/gsd-smartcard-manager.c:551
#3 0x00007ffff7e65613 in () at /lib/x86_64-linux-gnu/libgio-2.0.so.0
#4 0x00007ffff7e6564d in () at /lib/x86_64-linux-gnu/libgio-2.0.so.0
#5 0x00007ffff7c6c36f in g_main_dispatch (context=0x555555576fc0)
    at ../../../glib/gmain.c:3460
#6 g_main_context_dispatch (context=0x555555576fc0)
    at ../../../glib/gmain.c:4200
#7 0x00007ffff7cc7178 in g_main_context_iterate.constprop.0
    (context=0x555555576fc0, block=<optimized out>, dispatch=1, self=<optimized out>) at ../../../glib/gmain.c:4276
#8 0x00007ffff7c6bbdf in g_main_loop_run (loop=0x5555555771d0)
    at ../../../glib/gmain.c:4479
#9 0x000055555555bfa5 in main (argc=<optimized out>, argv=<optimized out>)
    at ../plugins/common/daemon-skeleton.h:256
(gdb) list
431
432 for (l = full_slots; l; l = l->next) {
433 GckSlot *slot = l->data;
434 GckTokenInfo *token_info = gck_slot_get_token_info (slot);
435
436 g_debug ("Detected smartcard '%s' in slot %lu at start up",
437 token_info->label, gck_slot_get_handle (slot));
438
439 g_hash_table_replace (smartcards, g_object_ref (slot), token_info);
440
(gdb) p token_info
$1 = (GckTokenInfo *) 0x0

Why gck_slot_get_token_info() returns NULL
is what I don't know. Have that problem with
etoken.

Revision history for this message
Timothée COCAULT (tcocault) wrote :

Hi.

I happen to also be affected by this bug and managed to narrow it down.

I guess the problem lies in the function sync_initial_tokens_from_driver (https://gitlab.gnome.org/GNOME/gnome-settings-daemon/-/blob/master/plugins/smartcard/gsd-smartcard-manager.c#L461).
The code assumes that gck_slot_get_token_info won't return NULL.

However looking in gck, it does return NULL if C_GetTokenInfo returns an error (https://gitlab.gnome.org/GNOME/gcr/-/blob/master/gck/gck-slot.c#L688).

And this is precisely the behavior of opensc-pkcs11.so when it sees an unrecognized token. It returns the token in C_GetSlotList (as present), but returns an error when calling C_GetTokenInfo.

So if you login as a user with your USB token plugged in, gsd-smartcard will crash in a loop.

Changed in gnome-settings-daemon (Ubuntu):
status: Expired → Incomplete
Revision history for this message
Sebastien Bacher (seb128) wrote :

@Timothée, thanks for the debugging work, could you report your finding upstream in a gitlab ticket (or perhaps submit a fix there since you understand the problem)?

Changed in gnome-settings-daemon (Ubuntu):
status: Incomplete → Triaged
Revision history for this message
Timothée COCAULT (tcocault) wrote :

I had trouble creating an account on the gnome bugtracker, but it seems to work now.
I filled the following issue upstream: https://gitlab.gnome.org/GNOME/gnome-settings-daemon/-/issues/795

Revision history for this message
Sebastien Bacher (seb128) wrote :

Thanks!

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.