Bug 8663 - libXi XGetExtensionVersion does not release lock when extension is not present
Summary: libXi XGetExtensionVersion does not release lock when extension is not present
Status: RESOLVED FIXED
Alias: None
Product: xorg
Classification: Unclassified
Component: Lib/Xi (show other bugs)
Version: 7.2 (2007.02)
Hardware: All All
: high normal
Assignee: Daniel Stone
QA Contact: Xorg Project Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: xorg-7.3
  Show dependency treegraph
 
Reported: 2006-10-16 10:51 UTC by Magnus Kessler
Modified: 2007-08-01 10:42 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
Proposed locking cleanup for libXi (21.70 KB, patch)
2006-10-16 10:52 UTC, Magnus Kessler
no flags Details | Splinter Review
Proposed locking cleanup for libXi (21.70 KB, patch)
2006-10-16 14:22 UTC, Magnus Kessler
no flags Details | Splinter Review

Description Magnus Kessler 2006-10-16 10:51:38 UTC
The current head version of XGetExtensionVersion (XGetVers.c) does not release 
the display lock when the XInput extension is not enabled on the server. This 
can easily be tested by running an application that uses libXi over ssh -X 
with a recent ssh version. When libX11 is compiled with xcb it will fail on 
the next attempt to obtain a lock.

In order to get a better handle on locking in libXi I have created a patch 
that removes locking related side effects from internal functions 
(_XiCheckExtInit()) and gets rid of the recursive call from 
_XiGetExtensionVersion() into _XiCheckExtInit() and back into 
_XiGetExtensionVersion().

Please review.
Comment 1 Magnus Kessler 2006-10-16 10:52:51 UTC
Created attachment 7432 [details] [review]
Proposed locking cleanup for libXi
Comment 2 Magnus Kessler 2006-10-16 14:22:31 UTC
Created attachment 7437 [details] [review]
Proposed locking cleanup for libXi

fixed typo in previous patch
Comment 3 Daniel Stone 2006-11-14 11:00:23 UTC
i believe jamey already committed this?
Comment 4 Magnus Kessler 2006-11-14 11:44:23 UTC
(In reply to comment #3)
> i believe jamey already committed this?

No, this is a followup of Jamey's work. His fix didn't cover the situation 
where the extension wasn't present (such as when run over ssh -X)
Comment 5 Jamey Sharp 2006-11-15 14:40:08 UTC
Sorry I haven't gotten around to this yet. Your patch is a bit overwhelming ;-)
but I'll examine it soon.
Comment 6 Jamey Sharp 2006-11-19 01:27:35 UTC
I've committed a much simpler patch that I believe addresses this bug. Would you
inspect/re-test? If it isn't sufficient, please re-open this bug.

The clean-ups you've proposed are probably a good idea, but I'm unlikely to be
the person to review and apply them.
Comment 7 Magnus Kessler 2006-11-20 11:36:57 UTC
The patch checked into the libXi git repository works fine for me. Should it 
also be applied to the 1.0.x branch? This is the one for 7.2, isn't it?
Comment 8 Jamey Sharp 2006-11-20 12:07:23 UTC
Ah, that seems likely.
Comment 9 Jamey Sharp 2006-11-20 12:17:42 UTC
Daniel, I've fixed this bug in git master for libXi, and Magnus has verified the
fix. Should the fix be cherry-picked for other branches to be included in X.org
7.2? If so, I'll leave that to you.

You might also consider some variant of the larger refactoring Magnus proposed,
in your copious spare time. I went for a small fix that didn't affect the
locking postconditions on _XiCheckExtInit, but those postconditions are stupid
;-) so fixing them wouldn't be a bad thing.
Comment 10 Daniel Stone 2006-12-06 06:42:16 UTC
jamey: i don't have any experience in this area, so your insight is certainly
more than welcome.  we're shipping 1.1 with 7.2, so we should be okay if your
patch works?
Comment 11 Daniel Stone 2007-02-27 01:34:05 UTC
Sorry about the phenomenal bug spam, guys.  Adding xorg-team@ to the QA contact so bugs don't get lost in future.
Comment 12 Tilman Sauerbeck 2007-04-06 12:33:17 UTC
Shouldn't this bug be resolved? The fix has landed in git.
Comment 13 Adam Jackson 2007-04-08 13:39:07 UTC
Move to 7.3 tracker.
Comment 14 Daniel Stone 2007-04-10 14:29:52 UTC
already fixed.
Comment 15 Alan Coopersmith 2007-05-21 17:04:37 UTC
Does this also fix bug 5424?
(https://bugs.freedesktop.org/show_bug.cgi?id=5424 - Deadlock in XGetExtensionVersion() when XInitThreads() is called before)


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.