After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 575247 - ssh agent hangs, then aborts when ctrl-c'ing ssh process
ssh agent hangs, then aborts when ctrl-c'ing ssh process
Status: RESOLVED FIXED
Product: gnome-keyring
Classification: Core
Component: general
2.25.x
Other Linux
: Normal major
: ---
Assigned To: GNOME keyring maintainer(s)
GNOME keyring maintainer(s)
: 574247 577587 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2009-03-13 13:07 UTC by freggy1
Modified: 2009-04-11 16:12 UTC
See Also:
GNOME target: ---
GNOME version: 2.25/2.26


Attachments
gkr-valgrind.log. (1.26 KB, text/plain)
2009-03-18 21:41 UTC, freggy1
  Details
gkr-valgrind.log.9871 (2.62 KB, text/plain)
2009-03-18 21:42 UTC, freggy1
  Details
Patch which should fix the problem (442 bytes, patch)
2009-04-02 03:32 UTC, Stef Walter
committed Details | Review

Description freggy1 2009-03-13 13:07:56 UTC
I am using gnome-keyring 2.25.92 as an ssh agent on Mandriva 2009.1 Cooker x86_64. It happens fairly often that when I ssh to a remote system, the ssh process immediately  hangs when making the connection. I can ctrl-c the process, and when I try to connect again to the remote host, ssh asks my passphrase at the console, instead of using gnome-keyring's ssh agent. At that moment gnome-keyring is not running anymore.

I reproduced this problem in gdb:

1. So gnome-keyring is running and I entered my passphrase when connecting with ssh for the first time. Some time later I ssh to a remote host, and the ssh process hangs. I interrupted the gnome-keyring process and got some backtraces:

Thread 1 (Thread 0x7f66d49bb6f0 (LWP 32450))

  • #0 read
    from /lib64/libpthread.so.0
  • #1 gkr_wakeup_drain
    at /usr/include/bits/unistd.h line 45
  • #2 signal_events_prepare
    at gkr-unix-signal.c line 59
  • #3 IA__g_main_context_prepare
    at gmain.c line 2134
  • #4 g_main_context_iterate
    at gmain.c line 2428
  • #5 IA__g_main_loop_run
    at gmain.c line 2656
  • #6 main
    at gkr-daemon.c line 765

(possibly sensitive data in the backtraces replaced by FOO)
Comment 1 Stef Walter 2009-03-17 23:43:06 UTC
Thanks for all the research you've put into this. I've actually been trying to track down this bug (or a similar one) myself. I'm eager to track it down. It's good to hear that this is somewhat reproducible for you.

One thing that would help, is if you would build 2.26.0 with the following configure option:

--enable-valgrind=run

This will cause gnome-keyring-daemon to be started up running under the valgrind memory debugger. Log files will be written to /tmp/gkr-valgrind.* 

Could you attach the log files here (after looking over them)? Thanks!
Comment 2 Stef Walter 2009-03-18 00:00:03 UTC
*** Bug 574247 has been marked as a duplicate of this bug. ***
Comment 3 freggy1 2009-03-18 21:41:05 UTC
I reproduced the problem with a gnome-keyring rebuilt with --enable-valgrind=run. I don't have the impression that there is lots of information though.

Also important to note is that the gnome-keyring daemon did not abort completely. As soon as connecting to an ssh host started to hang, I could still log in to other remote hosts without any problem using my key, however, all subsequent attempts to connect to the ssh host where it hung the first time, were hanging again.
Comment 4 freggy1 2009-03-18 21:41:44 UTC
Created attachment 130925 [details]
gkr-valgrind.log.
Comment 5 freggy1 2009-03-18 21:42:32 UTC
Created attachment 130926 [details]
gkr-valgrind.log.9871
Comment 6 Stef Walter 2009-03-19 01:17:43 UTC
Thanks. Appreciate it. Well that rules out some other part overwriting memory in the allocator. 

Would you have time to build gnome-keyring with --enable-debug and post the stack traces again? The ones above include optimization. Thanks again!
Comment 7 Stef Walter 2009-03-20 21:26:49 UTC
Richard, did you bump into this same problem with 2.26.0? If so, I'd love a stack current trace with --enable-debug. Thanks in advance!
Comment 8 Richard Hughes 2009-03-25 10:19:44 UTC
Yes, I seem to get this on every logon, after a few minutes heavy keyring use the daemon locks up in a tight loop, and has to be kill -9'd.

I'll try to compile with --enable-debug, but it's tricky to do as I don't know how to "restart" the keyring-daemon when the session is already up.

Richard.
Comment 9 Stef Walter 2009-03-31 04:07:55 UTC
Thanks, I'm looking forward to any additional info. 
Comment 10 Stef Walter 2009-04-02 03:31:28 UTC
I think I found this bug. Sorry for all the hassle...

I'll attach a patch for anyone to test if interested. 

The code has also been committed to SVN, along with a bunch of other changes that help verify that these memory allocation subroutines do their job properly.
Comment 11 Stef Walter 2009-04-02 03:32:22 UTC
Created attachment 131888 [details] [review]
Patch which should fix the problem
Comment 12 Richard Hughes 2009-04-02 13:37:56 UTC
I've pushed that patch into Fedora 11. Thanks!
Comment 13 Yanko Kaneti 2009-04-06 15:46:45 UTC
Using the rawhide package with this fix applied and I get the following assertion when trying to use the same key for another ssh session.

Program received signal SIGABRT, Aborted.

Thread 140527134984464 (LWP 626)

  • #0 *__GI_raise
    at ../nptl/sysdeps/unix/sysv/linux/raise.c line 64
  • #1 *__GI_abort
    at abort.c line 88
  • #2 *__GI___assert_fail
  • #3 sec_check_guards
    at egg-secure-memory.c line 324
  • #4 sec_neighbor_after
    at egg-secure-memory.c line 446
  • #5 sec_free
    at egg-secure-memory.c line 570
  • #6 egg_secure_free_full
    at egg-secure-memory.c line 1062
  • #7 _gcry_free
    at global.c line 825
  • #8 gck_sexp_unref
    at gck-sexp.c line 56
  • #9 cleanup_crypto
    at gck-session.c line 93

Doesn't happen with 2.26.0 without the patch.
Comment 14 Sebastien Bacher 2009-04-07 09:40:01 UTC
confirmed on jaunty the patch makes gnome-keyring crash easily
Comment 15 Sebastien Bacher 2009-04-09 08:19:05 UTC
the patch added to this bug is not the same version than the one commited to svn, the svn variant seems to work correctly
Comment 16 Yanko Kaneti 2009-04-09 08:29:40 UTC
(In reply to comment #15)
> the patch added to this bug is not the same version than the one commited to
> svn, the svn variant seems to work correctly
> 

I maybe blind, but I can't see the difference between the attachment in comment #11 and http://svn.gnome.org/viewvc/gnome-keyring/trunk/egg/egg-secure-memory.c?r1=1707&r2=1708 or the patch that was acutally tested and reverted in rawhide http://cvs.fedoraproject.org/viewvc/rpms/gnome-keyring/devel/gnome-keyring-2.26.0-egg-endless-loop.patch?revision=1.1&view=markup
Comment 18 Stef Walter 2009-04-10 20:05:24 UTC
Yes, that's an additional fix. 

I'll mark this fixed. Please reopen if this bug continues to be a problem with the SVN gnome-2-26 branch (or the upcoming 2.26.1 release).
Comment 19 Stef Walter 2009-04-10 20:06:54 UTC
*** Bug 577587 has been marked as a duplicate of this bug. ***
Comment 20 Yanko Kaneti 2009-04-11 10:10:13 UTC
I've just tried with both the endless loop and the assert fixes and it still dies for me on attempt to use the same key second time with the backtrace from comment 13. Fixed by reverting the endless loop patch.
Comment 21 Stef Walter 2009-04-11 13:11:31 UTC
Yanko, are you building with the latest from SVN gnome-2-26 branch? There's a number of fixes, and it may be hard to track all the patches. Anyone testing this can get it like so:

svn co http://svn.gnome.org/svn/gnome-keyring/branches/gnome-2-26 gnome-keyring-2-26
Comment 22 Sebastien Bacher 2009-04-11 13:19:06 UTC
do you still plan svn change before 2.26.1? otherwise you could roll the tarball today and let people test it and roll a new tarball if required later
Comment 23 Yanko Kaneti 2009-04-11 13:58:57 UTC
(In reply to comment #21)
> Yanko, are you building with the latest from SVN gnome-2-26 branch? There's a
> number of fixes, and it may be hard to track all the patches. Anyone testing
> this can get it like so:
> 
> svn co http://svn.gnome.org/svn/gnome-keyring/branches/gnome-2-26
> gnome-keyring-2-26

I was just trying 2.26.0 + r1708 and r1706 , with r1708 being the problem.

I rolled myslef a rpm of 2.26.0 + diff to gnome-2-26  and I can't reproduce the crash any more. Those semee like a quite a number of changes, a 2.26.1 would be appreciated.
Comment 24 Stef Walter 2009-04-11 16:12:04 UTC
Good news. I want to roll 2.26.1 as soon as possible, but I'd like some feedback on the following patches first (if at all possible):

 * Bug #577614
 * Bug #578708