Bug 29994 - xauth list hangs in resolver
Summary: xauth list hangs in resolver
Status: CLOSED FIXED
Alias: None
Product: xorg
Classification: Unclassified
Component: App/xauth (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: Xorg Project Team
QA Contact: Xorg Project Team
URL:
Whiteboard:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2010-09-03 04:52 UTC by Andreas Schwab
Modified: 2011-10-15 16:45 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Attachments
Patch (1.79 KB, patch)
2010-09-03 04:53 UTC, Andreas Schwab
no flags Details | Splinter Review

Description Andreas Schwab 2010-09-03 04:52:23 UTC
$ export XAUTHORITY=/tmp/xauth
$ xauth add 169.254.0.1:0 foo aa
xauth:  creating new authority file /tmp/xauth
$ xauth add 169.254.0.2:0 foo aa
$ xauth list
169.254.0.1:0  foo  aa
[hangs]

The problem is that gethost.c:get_hostname sets up an alarm handler that jumps out of the handler, but gethostbyaddr is not (required to be) async signal safe.  Thus when the resolver takes more than 4 seconds the alarm handler interrupts the call and jumps out of it, leaving behind some internal mutexes in locked state.  The next call to gethostbyaddr will wait for the mutexes to be released, which will never happen.  The whole alarm setup should be removed.
Comment 1 Andreas Schwab 2010-09-03 04:53:33 UTC
Created attachment 38399 [details] [review]
Patch
Comment 2 Jeremy Huddleston Sequoia 2011-10-06 00:55:04 UTC
commit fbc307f3445a549815efb2476e9476bd51250cf6
Author: Andreas Schwab <schwab@linux-m68k.org>
Date:   Fri Sep 3 13:45:49 2010 +0200

    Remove alarm handler in get_hostname
    
    gethostbyaddr is not (required to be) async-signal-safe.
    
    Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.