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

Fabian Vogt noreply at phabricator.kde.org
Wed Jan 24 18:21:34 UTC 2018


fvogt requested changes to this revision.
fvogt added inline comments.
This revision now requires changes to proceed.

INLINE COMMENTS

> chinmoyr wrote in file_unix.cpp:91
> 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?

I don't see how this could ever work. Even the line immediately below `errno = err` can change `errno`.
You must not assume that `errno` does not change if you call a function. Save it immediately after the function which errno you are interested in returns.
The famous "Could not perform operation: Success" - kind of error messages happens exactly because of bugs like these.

> chinmoyr wrote in sharefd_p.h:66
> I didn't follow you here. Can you explain why working of this code on other OSs, specifically FreeBsd and OSX, will be insecure?

Look at `man 7 unix`, section `Pathname socket ownership and permissions`.

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/bd949732/attachment-0001.html>


More information about the Kde-frameworks-devel mailing list