[PATCH 4/7] Add support for receiving fds in replies

Mouse mouse at Rodents-Montreal.ORG
Wed Nov 6 09:14:21 PST 2013


> Same comment about not using the CMSG_ API properly.

Same comment about it being a broken API; I would say it's broken
enough that it's not possible to use it properly.

But my real point here is not to broken-record that, but to add a
remark which I neglected to mention when I wrote about SCM_RIGHTS and
CMSG_* before.

NetBSD used to have the property that, upon receiving a message with
file descriptors in it, all the descriptors would arrive in the
recipient process's open file descriptors table even if their actual
numbers were dropped for MSG_CTRUNC reasons; this makes it difficult to
prevent malicious senders from running you out of file descriptors.  I
think modern NetBSD has this fixed, but I'd be surprised if there
weren't some systems out there that still misbehave in that way.

You may not want to do anything about it - it's rather difficult to
work around, especially on systems with nothing like the F_MAXFD fcntl
available - but I haven't seen it mentioned, which, in a discussion of
MSG_CTRUNC and closing stray file descriptors, leads me to suspect
people weren't aware of it.  (Of course, it's also possible I just
missed something in the discussion.)

/~\ The ASCII				  Mouse
\ / Ribbon Campaign
 X  Against HTML		mouse at rodents-montreal.org
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B


More information about the xorg-devel mailing list