Bug 10145 - xdm passes file descriptors to children
Summary: xdm passes file descriptors to children
Alias: None
Product: xorg
Classification: Unclassified
Component: App/xdm (show other bugs)
Version: 7.1 (2006.05)
Hardware: Other All
: medium normal
Assignee: Xorg Project Team
QA Contact: Xorg Project Team
Keywords: patch
Depends on:
Reported: 2007-03-01 14:42 UTC by Samuel Thibault
Modified: 2008-05-06 17:57 UTC (History)
0 users

See Also:
i915 platform:
i915 features:

Don't leak sockets in started scripts (462 bytes, patch)
2008-02-28 06:58 UTC, Samuel Thibault
no flags Details | Splinter Review

Description Samuel Thibault 2007-03-01 14:42:59 UTC
There is an old bug report on http://bugs.debian.org/#67086 :

``xdm seems to be passing the TCP socket it opens to child processes
invoked from the Xsetup script.

This should be fixed.

sobolev:/home/roessler# lsof -i tcp:1169
xdm       13471 root    5u  IPv4 1325982       TCP *:1169 (LISTEN)
xdm       14419 root    5u  IPv4 1325982       TCP *:1169 (LISTEN)
xconsole. 14428 root    5u  IPv4 1325982       TCP *:1169 (LISTEN)''

I can still reproduce it.  Are Xsetup script expected to inherit this descriptor?
Comment 1 Alan Coopersmith 2007-03-01 15:02:17 UTC
I wouldn't expect Xsetup children to inherit any open listening TCP sockets,
but I also wouldn't expect xdm to be listening on TCP port 1169.   (The only
port I expect xdm to be listening on is UDP port 177, which is the XDMCP
protocol port, and XDMCP is UDP only.)

Any idea why your xdm is listening on that TCP port?
Comment 2 Samuel Thibault 2007-03-01 15:14:04 UTC
socket(PF_INET6, SOCK_STREAM, IPPROTO_IP) = 3 listen(3, 5)                            = 0  It looks like it's the chooser socket (xdm/socket.c:CreateWellKnownSockets()) 
Comment 3 Benjamin Close 2008-01-11 02:39:23 UTC
Bugzilla Upgrade Mass Bug Change

NEEDSINFO state was removed in Bugzilla 3.x, reopening any bugs previously listed as NEEDSINFO.

  - benjsc
    fd.o Wrangler
Comment 4 Samuel Thibault 2008-02-28 06:58:05 UTC
Created attachment 14644 [details] [review]
Don't leak sockets in started scripts

This adds a call to DestroyWellKnownSockets() so as to properly close the chooser fd, as commented below CleanUpChild() in other places.

Note: no, we don't want to register in CloseOnFork, because in the chooser case, we _need_ that socket (see StartDisplay which calls RunChooser after calling CleanUpChild)
Comment 5 Alan Coopersmith 2008-05-06 17:57:48 UTC
Thanks for the patch - applied to git master for xdm 1.1.8

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.