f8612da68c
axeld's solution from 2015 worked in that it solved the panics and problems with leaking FDs ... but only if nobody actually tried to use the FDs again. As you can see in the diff of the previous commit, in allowing closed FDs (which have NULL "ops") to be returned by get_fd, all consumers of the get_fd API (so, pretty much most functions in vfs.cpp and fd.cpp) have to check *both* that (1) the fd is not NULL, and (2) the fd does not have O_DISCONNECT set. Besides missing a large majority of consumers of get_fd (which caused ticket #14532 and also the first half of ticket #14756, probably among others, as I haven't reviewed all NULL-dereference-in-VFS tickets yet) this solution missed the fact that calling get_fd increments the reference count, but then exiting the exact same way as if the FD was NULL (without putting it) when it is disconnected *also* leaks the FD. As it turns out, a not insignificant number of applications try to do this, which (depending on whether you went through one of the 'lucky' functions axeld's commit touched) either (1) leaked the FD, or (2) caused a kernel panic. Now, we could go through and add O_DISCONNECT checks to every single consumer of get_fd followed by put_fd to get the proper behavior ... but that would be the same thing as just returning NULL here and not incrementing the reference count. So it seems the first part of axeld's solution (don't set open_count or ref_count to -1 but leave them as-is) is the only change necessary. A few places where there were legitimately missing O_DISCONNECT checks (some originally added by axeld) are (re-)added in the next commit. Otherwise this seems to be the more robust solution. (But I wonder why nobody caught this in the code review axeld asked for in the commit and the ticket back in 2015? Did nobody notice the unbalanced get/put?) Fixes #14532, part of #14756, and probably any other NULL dereferences in VFS I/O functions (XHCI is especially good at exposing these) that are lingering around on the bugtracker. |
||
---|---|---|
3rdparty | ||
build | ||
data | ||
docs | ||
headers | ||
src | ||
.editorconfig | ||
.gitignore | ||
.gitreview | ||
configure | ||
Jamfile | ||
Jamrules | ||
License.md | ||
ReadMe.Compiling.md | ||
ReadMe.md |
Haiku
Homepage | Mailing Lists | IRC Channels | Issue Tracker | API docs
Haiku is an open-source operating system that specifically targets personal computing. Inspired by the BeOS, Haiku is fast, simple to use, easy to learn and yet very powerful.
Goals
- Sensible defaults with minimal configuration required.
- Clean, clear, concise code.
- Unified desktop environment.
Trying Haiku
Haiku provides pre-built nightly images and release images. Haiku is compatible with a large variety of hardware, but in case you don't want to "take the plunge" and install Haiku on bare metal, you can install it on a virtual machine (VM) instead. If you've never used a VM before, you can follow one of the "Emulating Haiku" guides.
Compiling Haiku
See ReadMe.Compiling
.
Contributing
Haiku is a meritocratic open source project with a large variety of tasks. Even if you can't write code, you can still help! Haiku needs designers, (technical) writers, translators, testers... Get involved and help out!
Contributing code
If you're submitting a patch to us, please make sure you're following the patch submitting guidelines.
If you're having trouble finding something in the source tree, you can use one of our OpenGrok servers:
- http://xref.plausible.coop/ (provided by Landon Fuller)
- http://code.metager.de/source/xref/haiku (provided by MetaGer)
Contributing documentation
The main piece of documentation that still needs work are the API docs (found
in the tree at docs/user
). Just find an undocumented class, write
documentation for it, and submit a patch.
Contributing translations
See wiki:i18n.
Contributing software ports
See HaikuPorts.
Contributing to our infrastructure
See Infrastructure.