D9966: [KIO] Fix issues with sharing of file descriptor

Chinmoy Ranjan Pradhan noreply at phabricator.kde.org
Wed Jan 24 17:44:38 UTC 2018


chinmoyr marked 2 inline comments as done.
chinmoyr added inline comments.

INLINE COMMENTS

> fvogt wrote in fdreceiver.cpp:60
> A quick question: Is it possible that there are two FdReceivers with the same pid?
> In that case they would end up removing each other's sockets.

No. Currently only one FdReceiver is created.

> fvogt wrote in file_unix.cpp:91
> That looks like a hack. If errno is that important, save and keep it in a variable. Every call into a library can change errno, it's extremely volatile.

It is the only case for which this hack seems necessary. For all other cases a library call (to perform a file operation) is immediately followed by a call to helper.  IMO the chances of errno changing to something unrelated in between these two calls are very slim (is it even possible?) 
Although errno is important, saving it for every call will result in unnecessary code. Can't we make an exception for this case?

> fvogt wrote in sharefd_p.h:66
> The socket permissions only work that way for linux, so if other OSs can use this code as well it's insecure and should `#error` out.

I didn't follow you here. Can you explain why working of this code on other OSs, specifically FreeBsd and OSX, will be insecure?

REPOSITORY
  R241 KIO

REVISION DETAIL
  https://phabricator.kde.org/D9966

To: chinmoyr, #frameworks, thiago, fvogt
Cc: ngraham, fvogt, lbeltrame, dfaure
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20180124/832b7c9c/attachment.html>


More information about the Kde-frameworks-devel mailing list