Restarts of daemon crash consumers when gdm has AutomaticLogin configured
When gdm is configured with AutomaticLogin, restarting accounts-daemon.service
causes consumers to crash with on_user_changed
in the stack trace. The crash seems to be in update_user()
, from a null username
returned from act_user_get_user_name()
, which is then looked up in a hash table.
I made a small test program that did nothing but enumerate the users once, as well as logging g-properties-changed
and g-signal
messages. The messages from the daemon the cause the crash appear to be:
-
g-properties-changed
, where all properties are invalidated by daemon shutdown -
g-signal
ofChanged
When this signal is received, none of the object's properties are cached, so they all return null. One such null is then enough to cause a crash.
I would guess that the Changed
signal that causes the crash is from the AutoLogin handling in reload_autologin_timeout
, since there's no crash when AutoLogin is disabled.
Tested versions 0.6.50 and 0.6.54.
Event trace of restart with crash
$ ./result/bin/accounts-service-consumer
user: lorne
*** Properties Invalidated:
Location
Saved
LocalAccount
HomeDirectory
RealName
Locked
LoginHistory
UserName
AccountType
Session
Shell
LoginTime
Language
XSession
LoginFrequency
Uid
SessionType
AutomaticLogin
SystemAccount
Email
IconFile
PasswordMode
PasswordHint
*** Received Signal: Changed: ()
zsh: segmentation fault (core dumped) ./result/bin/accounts-service-consumer
Event trace of restart without crash
$ ./result/bin/accounts-service-consumer
user: lorne
*** Properties Invalidated:
Location
Saved
LocalAccount
HomeDirectory
RealName
Locked
LoginHistory
UserName
AccountType
Session
Shell
LoginTime
Language
XSession
LoginFrequency
Uid
SessionType
AutomaticLogin
SystemAccount
Email
IconFile
PasswordMode
PasswordHint
*** Properties Changed:
Uid -> uint64 1000
UserName -> 'lorne'
RealName -> ''
AccountType -> 1
HomeDirectory -> '/home/lorne'
Shell -> '/run/current-system/sw/bin/zsh'
Email -> ''
Language -> 'en_US.UTF-8'
Session -> 'none+i3'
SessionType -> ''
XSession -> 'none+i3'
Location -> ''
LoginFrequency -> uint64 173
LoginTime -> int64 1539105104
LoginHistory -> [(int64 1529254851, int64 1529254905, {'type': <'tty1'>}), (1529293886, 1529294854, {'type': <'pts/0'>}), (1529391725, 1529391734, {'type': <'pts/1'>}), (1529391737, 1529391737, {'type': <'pts/1'>}), (1529391847, 1529391888, {'type': <'pts/1'>}), (1529391889, 1529391891, {'type': <'pts/1'>}), (1529415885, 1529416521, {'type': <'pts/0'>}), (1529899827, 1529899829, {'type': <'pts/1'>}), (1530015741, 1530015781, {'type': <'pts/1'>}), (1530095979, 1530096390, {'type': <'pts/4'>}), (1530114570, 1530114693, {'type': <'pts/1'>}), (1532524794, 1532529835, {'type': <'pts/0'>}), (1532612239, 1532612515, {'type': <'pts/0'>}), (1532612323, 1532614983, {'type': <'pts/1'>}), (1532612790, 1532615054, {'type': <'pts/0'>}), (1532612991, 1532612995, {'type': <'pts/2'>}), (1532613334, 1532613800, {'type': <'pts/2'>}), (1532613399, 1532613674, {'type': <'pts/3'>}), (1532613837, 1532613855, {'type': <'pts/2'>}), (1532613856, 1532616335, {'type': <'pts/2'>}), (1532614986, 1532621323, {'type': <'pts/1'>}), (1532615058, 1532618843, {'type': <'pts/0'>}), (1532615462, 1532620981, {'type': <'pts/3'>}), (1532615586, 1532621354, {'type': <'pts/4'>}), (1532620043, 1532621321, {'type': <'pts/0'>}), (1532620983, 1532621322, {'type': <'pts/2'>}), (1532767455, 1532767978, {'type': <'pts/0'>}), (1532768054, 1532768223, {'type': <'pts/0'>}), (1532768278, 1532771609, {'type': <':1'>}), (1532771499, 1532771519, {'type': <'pts/1'>}), (1532771655, 1532771774, {'type': <'tty1'>}), (1532771693, 1532771773, {'type': <'pts/0'>}), (1532778437, 1532778439, {'type': <'pts/1'>}), (1532800693, 1532800738, {'type': <'tty7'>}), (1532800713, 1532800738, {'type': <'pts/0'>}), (1532800784, 1532800921, {'type': <'tty7'>}), (1532800923, 1532800991, {'type': <'tty7'>}), (1532800964, 1532801019, {'type': <'pts/0'>}), (1532801062, 1532801144, {'type': <'tty7'>}), (1532801189, 1532801215, {'type': <'tty7'>}), (1532801495, 1532801506, {'type': <'tty7'>}), (1533128146, 1533133349, {'type': <'tty7'>}), (1533133390, 1533140831, {'type': <'tty7'>}), (1533140884, 1533141447, {'type': <'tty7'>}), (1533198847, 1533227146, {'type': <'tty7'>}), (1533260238, 1533260274, {'type': <'tty7'>}), (1533270260, 1533270262, {'type': <'pts/1'>}), (1533270282, 1533271746, {'type': <'pts/1'>}), (1533395546, 1533376011, {'type': <'tty7'>}), (1533366164, 1533369936, {'type': <'pts/2'>}), (1533367100, 1533367795, {'type': <'pts/4'>}), (1533367627, 1533367691, {'type': <'pts/5'>}), (1533367693, 1533367863, {'type': <'pts/5'>}), (1533367796, 1533367925, {'type': <'pts/4'>}), (1533368267, 1533368282, {'type': <'pts/4'>}), (1533368364, 1533368610, {'type': <'pts/4'>}), (1533368780, 1533368959, {'type': <'pts/4'>}), (1533369939, 1533369951, {'type': <'pts/2'>}), (1533376045, 1533376275, {'type': <'pts/0'>}), (1533376185, 1533378925, {'type': <'tty1'>}), (1533376330, 1533376543, {'type': <'pts/0'>}), (1533377201, 1533377729, {'type': <'pts/3'>}), (1533377576, 1533378620, {'type': <'pts/6'>}), (1533378182, 1533378923, {'type': <'pts/3'>}), (1533378697, 1533378923, {'type': <'pts/6'>}), (1533378984, 1533378994, {'type': <':1'>}), (1533379001, 1533379008, {'type': <':1'>}), (1533379014, 1533381501, {'type': <':1'>}), (1533381551, 1533386869, {'type': <'tty1'>}), (1533381605, 1533381959, {'type': <'pts/0'>}), (1533381654, 1533386768, {'type': <':1'>}), (1533386777, 1533386948, {'type': <':1'>}), (1533386799, 1533386892, {'type': <'pts/0'>}), (1533386899, 1533386947, {'type': <'pts/0'>}), (1533419447, 1533387090, {'type': <':0'>}), (1533387073, 1533387179, {'type': <'pts/0'>}), (1533387173, 1533390587, {'type': <':0'>}), (1533436665, 1533489670, {'type': <':0'>}), (1533475932, 1533476405, {'type': <'pts/1'>}), (1533775895, 1533743941, {'type': <':0'>}), (1533743951, 0, {'type': <':1'>}), (1533744972, 1533748936, {'type': <':2'>}), (1533745021, 1533748936, {'type': <'tty1'>}), (1533745048, 1533745344, {'type': <'pts/1'>}), (1533745141, 1533745327, {'type': <':0'>}), (1533745339, 1533748936, {'type': <':1'>}), (1533820219, 1533820236, {'type': <':0'>}), (1533820246, 1533834598, {'type': <':1'>}), (1534000484, 1533968589, {'type': <':0'>}), (1533973155, 1533974671, {'type': <':0'>}), (1533974715, 1534012606, {'type': <':0'>}), (1534648758, 1534691875, {'type': <':0'>}), (1534773161, 1534783118, {'type': <':0'>}), (1534940672, 1534944838, {'type': <':0'>}), (1534944883, 1534944914, {'type': <':0'>}), (1534944955, 1534945398, {'type': <':0'>}), (1535080724, 1535094451, {'type': <':0'>}), (1535081117, 1535081651, {'type': <'pts/2'>}), (1535094410, 1535094446, {'type': <'pts/1'>}), (1535094495, 1535123856, {'type': <':0'>}), (1535109743, 1535109996, {'type': <'pts/3'>}), (1535109856, 1535109870, {'type': <'pts/6'>}), (1535110003, 1535117084, {'type': <'pts/3'>}), (1535115764, 1535115810, {'type': <'pts/5'>}), (1535324831, 1535296268, {'type': <':0'>}), (1535511037, 1535511660, {'type': <':0'>}), (1535544808, 1535553703, {'type': <':0'>}), (1535718616, 1535743922, {'type': <':0'>}), (1535831352, 1535799897, {'type': <':0'>}), (1536060297, 1536066772, {'type': <':0'>}), (1536869556, 1536866652, {'type': <':0'>}), (1536888248, 1536889246, {'type': <':0'>}), (1536889288, 1536891326, {'type': <':0'>}), (1537054284, 1537054293, {'type': <':0'>}), (1537054304, 1537064597, {'type': <':1'>}), (1537822293, 1537793704, {'type': <':0'>}), (1537914137, 1537881779, {'type': <':0'>}), (1537881813, 1537883389, {'type': <'pts/0'>}), (1537882041, 1537882052, {'type': <':0'>}), (1537882064, 1537892660, {'type': <':1'>}), (1537918406, 1538131712, {'type': <':0'>}), (1537952061, 1537953164, {'type': <'pts/1'>}), (1537970888, 1537970940, {'type': <'pts/1'>}), (1537970983, 1537972273, {'type': <'pts/1'>}), (1537971743, 1537972275, {'type': <'pts/2'>}), (1537972362, 1537980601, {'type': <'pts/1'>}), (1538032785, 1538032786, {'type': <'pts/1'>}), (1538032787, 1538041333, {'type': <'pts/1'>}), (1538036215, 1538043430, {'type': <'pts/2'>}), (1538039636, 1538039779, {'type': <'pts/4'>}), (1538040047, 1538040090, {'type': <'pts/4'>}), (1538043813, 1538044167, {'type': <'pts/1'>}), (1538098541, 1538098749, {'type': <'pts/1'>}), (1538098582, 1538106313, {'type': <'pts/2'>}), (1538099150, 1538099268, {'type': <'pts/1'>}), (1538099269, 1538099457, {'type': <'pts/1'>}), (1538099461, 1538099467, {'type': <'pts/1'>}), (1538103981, 1538103985, {'type': <'pts/14'>}), (1538131699, 1538131712, {'type': <'pts/0'>}), (1538432607, 1538407424, {'type': <':0'>}), (1538817489, 1538819214, {'type': <':0'>}), (1538819258, 1538819435, {'type': <':0'>}), (1539026792, 1538997054, {'type': <':0'>}), (1538997098, 1538997109, {'type': <':0'>}), (1538997140, 1538997185, {'type': <':1'>}), (1538997191, 1538997363, {'type': <':1'>}), (1538997218, 1538997273, {'type': <'pts/0'>}), (1538997239, 1538997363, {'type': <':0'>}), (1538997402, 1539000626, {'type': <':0'>}), (1539000451, 1539000622, {'type': <'pts/2'>}), (1539000669, 1539002134, {'type': <':0'>}), (1539002169, 1539003309, {'type': <':0'>}), (1539003347, 1539007798, {'type': <':0'>}), (1539007513, 1539007797, {'type': <'pts/0'>}), (1539007839, 1539007874, {'type': <':0'>}), (1539007911, 1539009882, {'type': <':0'>}), (1539009767, 1539009810, {'type': <'pts/2'>}), (1539009811, 1539009881, {'type': <'pts/2'>}), (1539009924, 1539009982, {'type': <':0'>}), (1539009973, 1539009981, {'type': <'pts/1'>}), (1539010024, 0, {'type': <':0'>}), (1539011604, 1539013539, {'type': <'pts/6'>}), (1539011630, 1539011653, {'type': <':1'>}), (1539011742, 1539013917, {'type': <'tty1'>}), (1539012705, 1539014074, {'type': <':0'>}), (1539013901, 1539013984, {'type': <'pts/6'>}), (1539013960, 1539014074, {'type': <':2'>}), (1539046598, 1539018221, {'type': <':0'>}), (1539091652, 1539092718, {'type': <':0'>}), (1539092617, 1539092716, {'type': <'pts/2'>}), (1539092758, 1539092842, {'type': <':0'>}), (1539105067, 1539105115, {'type': <':0'>}), (1539105104, 1539105114, {'type': <'pts/2'>})]
IconFile -> '/home/lorne/.face'
Saved -> true
Locked -> false
PasswordMode -> 0
PasswordHint -> ''
AutomaticLogin -> false
SystemAccount -> false
LocalAccount -> true
*** Received Signal: Changed: ()
Stack trace of gdm crash with version 0.6.50 (from downstream bug)
#0 0x00007fe0f8431c99 in g_str_hash (v=0x0) at ghash.c:1894
#1 0x00007fe0f842fef1 in g_hash_table_lookup_node (hash_table=0xa220c0, key=0x0, hash_return=0x7ffcfe4c6d10) at ghash.c:379
#2 0x00007fe0f8430fd8 in g_hash_table_lookup (hash_table=0xa220c0, key=0x0) at ghash.c:1153
#3 0x00007fe0fa0889ba in update_user (manager=0xa109e0, user=0xa1d780) at act-user-manager.c:886
#4 0x00007fe0fa088027 in on_user_changed (user=0xa1d780, manager=0xa109e0) at act-user-manager.c:656
#5 0x00007fe0f8941643 in g_cclosure_marshal_VOID__VOID (closure=0xa365a0, return_value=0x0, n_param_values=1,
param_values=0x7ffcfe4c6fd0, invocation_hint=0x7ffcfe4c6f80, marshal_data=0x0) at gmarshal.c:875
#6 0x00007fe0f893e124 in g_closure_invoke (closure=0xa365a0, return_value=0x0, n_param_values=1, param_values=0x7ffcfe4c6fd0,
invocation_hint=0x7ffcfe4c6f80) at gclosure.c:804
#7 0x00007fe0f895bba6 in signal_emit_unlocked_R (node=0x7fe0e000a310, detail=0, instance=0xa1d780, emission_return=0x0,
instance_and_params=0x7ffcfe4c6fd0) at gsignal.c:3635
#8 0x00007fe0f895ae0e in g_signal_emit_valist (instance=0xa1d780, signal_id=52, detail=0, var_args=0x7ffcfe4c7240)
at gsignal.c:3391
#9 0x00007fe0f895b3ab in g_signal_emit (instance=0xa1d780, signal_id=52, detail=0) at gsignal.c:3447
#10 0x00007fe0fa08506e in on_accounts_proxy_changed (user=0xa1d780) at act-user.c:1097
#11 0x00007fe0f8729a3e in ffi_call_unix64 ()
from /nix/store/6z0spj65xwl2wf7dbn0fd8jxcka3yx3h-libffi-3.2.1/lib/../lib64/libffi.so.6
#12 0x00007fe0f8728a03 in ffi_call () from /nix/store/6z0spj65xwl2wf7dbn0fd8jxcka3yx3h-libffi-3.2.1/lib/../lib64/libffi.so.6
#13 0x00007fe0f893f945 in g_cclosure_marshal_generic (closure=0xa348c0, return_gvalue=0x0, n_param_values=1,
param_values=0xa33fd0, invocation_hint=0x7ffcfe4c7720, marshal_data=0x0) at gclosure.c:1490
#14 0x00007fe0f893e124 in g_closure_invoke (closure=0xa348c0, return_value=0x0, n_param_values=1, param_values=0xa33fd0,
invocation_hint=0x7ffcfe4c7720) at gclosure.c:804
#15 0x00007fe0f895bba6 in signal_emit_unlocked_R (node=0xa241e0, detail=0, instance=0xa28130, emission_return=0x0,
instance_and_params=0xa33fd0) at gsignal.c:3635
#16 0x00007fe0f8959ab2 in g_signal_emitv (instance_and_params=0xa33fd0, signal_id=70, detail=0, return_value=0x0)
at gsignal.c:3129
#17 0x00007fe0fa0a660f in accounts_user_proxy_g_signal (proxy=0xa28130, sender_name=0x7fe0e000a2f0 ":1.1198",
signal_name=0x7fe0e000a720 "Changed", parameters=0x7fe0e003e670) at accounts-user-generated.c:4873
#18 0x00007fe0f8729a3e in ffi_call_unix64 ()
from /nix/store/6z0spj65xwl2wf7dbn0fd8jxcka3yx3h-libffi-3.2.1/lib/../lib64/libffi.so.6
#19 0x00007fe0f8728a03 in ffi_call () from /nix/store/6z0spj65xwl2wf7dbn0fd8jxcka3yx3h-libffi-3.2.1/lib/../lib64/libffi.so.6
#20 0x00007fe0f893f945 in g_cclosure_marshal_generic (closure=0x9fc250, return_gvalue=0x0, n_param_values=4,
param_values=0x7ffcfe4c7d90, invocation_hint=0x7ffcfe4c7d40, marshal_data=0x7fe0fa0a63c9 <accounts_user_proxy_g_signal>)
at gclosure.c:1490
#21 0x00007fe0f893e808 in g_type_class_meta_marshal (closure=0x9fc250, return_value=0x0, n_param_values=4,
param_values=0x7ffcfe4c7d90, invocation_hint=0x7ffcfe4c7d40, marshal_data=0x90) at gclosure.c:997
#22 0x00007fe0f893e124 in g_closure_invoke (closure=0x9fc250, return_value=0x0, n_param_values=4, param_values=0x7ffcfe4c7d90,
invocation_hint=0x7ffcfe4c7d40) at gclosure.c:804
#23 0x00007fe0f895bd34 in signal_emit_unlocked_R (node=0x9fc280, detail=0, instance=0xa28130, emission_return=0x0,
instance_and_params=0x7ffcfe4c7d90) at gsignal.c:3673
#24 0x00007fe0f895ae0e in g_signal_emit_valist (instance=0xa28130, signal_id=8, detail=0, var_args=0x7ffcfe4c8040)
at gsignal.c:3391
#25 0x00007fe0f895b3ab in g_signal_emit (instance=0xa28130, signal_id=8, detail=0) at gsignal.c:3447
#26 0x00007fe0f9d819fb in on_signal_received (connection=0x9ff080, sender_name=0x7fe0e0042e20 ":1.1198",
object_path=0x7fe0e000a0c0 "/org/freedesktop/Accounts/User1000",
interface_name=0x7fe0e000a3a0 "org.freedesktop.Accounts.User", signal_name=0x7fe0e0003c60 "Changed",
parameters=0x7fe0e003e670, user_data=0xa30b10) at gdbusproxy.c:918
#27 0x00007fe0f9d6eb57 in emit_signal_instance_in_idle_cb (data=0x7fe0e001f3a0) at gdbusconnection.c:3720
#28 0x00007fe0f84479f0 in g_idle_dispatch (source=0x7fe0e000e390, callback=0x7fe0f9d6ea4c <emit_signal_instance_in_idle_cb>,
user_data=0x7fe0e001f3a0) at gmain.c:5535
#29 0x00007fe0f8444e68 in g_main_dispatch (context=0xa00430) at gmain.c:3177
#30 0x00007fe0f8445d7f in g_main_context_dispatch (context=0xa00430) at gmain.c:3830
#31 0x00007fe0f8445f72 in g_main_context_iterate (context=0xa00430, block=1, dispatch=1, self=0x9ebc90) at gmain.c:3903
#32 0x00007fe0f84463ac in g_main_loop_run (loop=0xa0d5c0) at gmain.c:4099
#33 0x000000000040b784 in main ()
See downstream bug: https://github.com/NixOS/nixpkgs/issues/47475