Bug 29994

Summary: xauth list hangs in resolver
Product: xorg Reporter: Andreas Schwab <schwab>
Component: App/xauthAssignee: Xorg Project Team <xorg-team>
Status: CLOSED FIXED QA Contact: Xorg Project Team <xorg-team>
Severity: normal    
Priority: medium CC: ajax, mcepl
Version: unspecifiedKeywords: patch
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments:
Description Flags
Patch none

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.