[Xcb] [PATCH] Open the X11 socket with close-on-exec flag

Barton C Massey bart at cs.pdx.edu
Sun Feb 14 19:58:00 PST 2010


Some reason why the child doesn't just close the connection?
I'm not very comfortable with either of these patches; I
think we've got all the useful SOCK_CLOEXEC bits already,
and I certainly don't want to increase our amount of
platform-specific bugs, as they are the hardest kind to
debug.

    Bart

In message <201002131349.10544.remi at remlab.net> you wrote:
> Le samedi 13 f=E9vrier 2010 12:47:37 Julien Danjou, vous avez =E9crit :
> > R=E9mi Denis-Courmont <remi at remlab.net> writes:
> > > This saves the X11 connection from leaking into children processes.
> > > On Linux, this is fully thread-safe using SOCK_CLOEXEC. On other
> > > systems, there is a small race condition.
> > =
> 
> > Seems good to me, except I don't see if it's very useful, since there's
> > already close on exec set when the socket go through
> > xcb_connect_to_fd().
> 
> On Linux, that's not thread-safe. SOCK_CLOEXEC sets the flag atomically whi=
> le =
> 
> allocating the descriptor from the process file table.
> On other platforms, this patch merely shrinks the window of opportunity for =
> 
> the race, which cannot be fully fixed.
> 
> You have a point that the later close-on-exec setting becomes useless if =
> 
> called through xcb_connect() though.


More information about the Xcb mailing list