Bug 10145

Summary: xdm passes file descriptors to children
Product: xorg Reporter: Samuel Thibault <samuel.thibault>
Component: App/xdmAssignee: Xorg Project Team <xorg-team>
Status: RESOLVED FIXED QA Contact: Xorg Project Team <xorg-team>
Severity: normal    
Priority: medium Keywords: patch
Version: 7.1 (2006.05)   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments:
Description Flags
Don't leak sockets in started scripts none

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
COMMAND     PID USER   FD   TYPE  DEVICE SIZE NODE NAME
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.