11 ms·
> Plenty of things that applications that do this will have to have successfully dealt with. If I have a choice of accommodating broken applications that close
by quotemstr 12y ago
> Plenty of things that applications that do this will have to have successfully dealt with.
If I have a choice of accommodating broken applications that close all file descriptors (and you have still not named one) and having a system in which libraries can retain internal kernel handles, I'll take the latter. LibreSSL already breaks compatibility with OpenSSL in areas like FIPS compliance. Compatibility with broken applications is another "feature" that would be best to remove.
> Strawman. munmap() on random addresses is not something I have seen. Looping over all file descriptors and closing is something I have seen in lots of code. Code that works fine unless someone introduces a breaking change like suddenly holding onto a file descriptor the library previously didn't.
There is no fundamental difference between a library-internal resource that happens to be a memory mapping and one that happens to be a file descriptor. Are you claiming that no libraries in the future should be able to use internal file descriptors because there are a few broken applications out there that like to go on close(2)-sprees?
If that level of compatibility is important to you, do what Microsoft did and implement appcompat shims. Did you know the Windows heap code has modes designed specifically for applications that corrupt the heap?
If you're not prepared to go down that road, please recognize that broken behavior is not guaranteed to work forever. There was a time when use-after-free was a very common pattern: on a single-thread system, why not use a piece of memory after free but before the next malloc? That pattern had to be beaten out of software in order to allow progress to be made. As it was then with memory, now it is again with indiscriminate file descriptor closing.
> There is: [proper error plumbing] would mean LibreSSL does not work as a drop-in replacement for OpenSSL
This claim is simply untrue. The OpenSSL API has a rich error-reporting interface. No compatibility break is required for reporting entropy-gathering failures. The only needed changes are inside LibreSSL, and its developers appear to be refusing to make these changes.
> for me, it's a matter of a basic principle
Another basic principle is that you can't get very far if you assume everything can fail. You have to have a certain axiomatic base. The ability to have private resources in a library is a perfectly reasonable basic assumption.
- anon1385 12y ago>applications that close all file descriptors (and you have still not named one) elinks: https://github.com/yggi49/elinks/blob/master/src/protocol/file/mailcap.c#L111 https://github.com/yggi49/elinks/blob/master/src/protocol/fi... https://github.com/yggi49/elinks/blob/master/src/protocol/common.c#L32 https://github.com/yggi49/elinks/blob/master/src/protocol/co...
- devicenull 12y agoAnd example of what happens if you don't close all file descriptors: https://bugs.php.net/bug.php?id=38915 https://bugs.php.net/bug.php?id=38915
- quotemstr 12y agoYes, letting child processes inherit stray file descriptors is dangerous. We're not talking about calling all file descriptors immediately before exec. We're talking about applications that say, "Ok now, I'm going to close all file descriptors and go back to what I was doing". You can't expect libraries to work when you're freed their internal resources from under them.
- quotemstr 12y agoThat doesn't count. It's closing file descriptors before exec (and in one case, before doing some tightly-scoped work). It has nothing to do with closing all file descriptors, then expecting to use arbitrary third-party libraries.