Recent g_hash_table_lookup_extended change crashes GNOME Shell after unlocking a SSH key
Commit 8dc8b33d changes the behavior of g_hash_table_lookup_extended
, and unfortunately, it causes GNOME Shell to crash in GCR. Since the change may affect other programs, I reported the issue here instead of asking GCR to change their code.
In file gcr/gcr-system-prompter.c
, function prompt_stop_prompting
, there is a call to g_hash_table_lookup_extended
:
498 /* Get a pointer to our actual callback */
499 if (!g_hash_table_lookup_extended (self->pv->callbacks, callback,
500 (gpointer *)&callback, &watch)) {
501 g_debug ("couldn't find the callback for prompting operation %s@%s",
502 callback->path, callback->name);
503 return;
504 }
If g_hash_table_lookup_extended
returns FALSE
, callback
will be set to NULL
. This causes segfault at the following g_debug
call because it dereferences the null pointer.
Full backtrace of GNOME Shell:
Reading symbols from gnome-shell...done.
Core was generated by `/home/lantw44/gnome/devinstall/bin/gnome-shell'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x00000008060ebf65 in prompt_stop_prompting (self=0x81dfacdc0, callback=0x0, send_done_message=1, wait_for_reply=0) at /home/lantw44/gnome/source/gcr/gcr/gcr-system-prompter.c:501
501 g_debug ("couldn't find the callback for prompting operation %s@%s",
[Current thread is 1 (LWP 101753)]
(gdb) bt
#0 0x00000008060ebf65 in prompt_stop_prompting (self=0x81dfacdc0, callback=0x0, send_done_message=1, wait_for_reply=0) at /home/lantw44/gnome/source/gcr/gcr/gcr-system-prompter.c:501
#1 0x00000008060ee194 in on_prompt_close (prompt=0x82c716d30, user_data=0x81e5e8280) at /home/lantw44/gnome/source/gcr/gcr/gcr-system-prompter.c:158
#2 0x000000080698a818 in ffi_call_unix64 () from /usr/local/lib/libffi.so.6
#3 0x0000000806989f46 in ffi_call () from /usr/local/lib/libffi.so.6
#4 0x000000080142b9b0 in g_cclosure_marshal_generic (closure=0x81c9784a0, return_gvalue=0x0, n_param_values=1, param_values=0x7fffffffcd90, invocation_hint=0x7fffffffcd30, marshal_data=0x0)
at /home/lantw44/gnome/source/glib/gobject/gclosure.c:1500
#5 0x000000080142a7a5 in g_closure_invoke (closure=0x81c9784a0, return_value=0x0, n_param_values=1, param_values=0x7fffffffcd90, invocation_hint=0x7fffffffcd30) at /home/lantw44/gnome/source/glib/gobject/gclosure.c:810
#6 0x000000080144b7d7 in signal_emit_unlocked_R (node=0x81c9537c0, detail=0, instance=0x82c716d30, emission_return=0x0, instance_and_params=0x7fffffffcd90) at /home/lantw44/gnome/source/glib/gobject/gsignal.c:3635
#7 0x000000080144d175 in g_signal_emit_valist (instance=0x82c716d30, signal_id=713, detail=0, var_args=0x7fffffffd4b0) at /home/lantw44/gnome/source/glib/gobject/gsignal.c:3391
#8 0x000000080144d97f in g_signal_emit (instance=0x82c716d30, signal_id=713, detail=0) at /home/lantw44/gnome/source/glib/gobject/gsignal.c:3447
#9 0x00000008060e2206 in gcr_prompt_close (prompt=0x82c716d30) at /home/lantw44/gnome/source/gcr/gcr/gcr-prompt.c:1073
#10 0x00000008060ec09e in prompt_stop_prompting (self=0x81dfacdc0, callback=0x83234a670, send_done_message=1, wait_for_reply=0) at /home/lantw44/gnome/source/gcr/gcr/gcr-system-prompter.c:530
#11 0x00000008060ed964 in prompter_method_stop_prompting (self=0x81dfacdc0, invocation=0x816d21090, parameters=0x816c98290) at /home/lantw44/gnome/source/gcr/gcr/gcr-system-prompter.c:968
#12 0x00000008060ed269 in prompter_method_call (connection=0x815ee9180, sender=0x81c03bc30 ":1.7", object_path=0x816c9f480 "/org/gnome/keyring/Prompter",
interface_name=0x81c53be10 "org.gnome.keyring.internal.Prompter", method_name=0x81c0d9ff0 "StopPrompting", parameters=0x816c98290, invocation=0x816d21090, user_data=0x81dfacdc0)
at /home/lantw44/gnome/source/gcr/gcr/gcr-system-prompter.c:995
#13 0x0000000801120052 in call_in_idle_cb (user_data=0x816d21090) at /home/lantw44/gnome/source/glib/gio/gdbusconnection.c:4842
#14 0x00000008016dcbaf in g_idle_dispatch (source=0x816c37d40, callback=0x80111fe10 <call_in_idle_cb>, user_data=0x816d21090) at /home/lantw44/gnome/source/glib/glib/gmain.c:5620
#15 0x00000008016e1113 in g_main_dispatch (context=0x815e40240) at /home/lantw44/gnome/source/glib/glib/gmain.c:3182
#16 0x00000008016e0f60 in g_main_context_dispatch (context=0x815e40240) at /home/lantw44/gnome/source/glib/glib/gmain.c:3847
#17 0x00000008016e14ae in g_main_context_iterate (context=0x815e40240, block=1, dispatch=1, self=0x815e236c0) at /home/lantw44/gnome/source/glib/glib/gmain.c:3920
#18 0x00000008016e196e in g_main_loop_run (loop=0x81a9600e0) at /home/lantw44/gnome/source/glib/glib/gmain.c:4116
#19 0x00000008037d2f3d in meta_run () at /home/lantw44/gnome/source/mutter/src/core/main.c:689
#20 0x0000000000402342 in main (argc=1, argv=0x7fffffffd9a8) at ../../source/gnome-shell/src/main.c:501