- 04 Dec, 2020 4 commits
-
-
arcnmx authored
SocketEvent knows the FD is still open and is about to close it, so it's unnecessary to rely on the kernel (via AbandonFD) to clean up the epoll_wait list. ### Why this is relevant - `AbandonFD` assumes that upon closing the socket, the FD will be automatically removed from the epoll list. That fd is associated with a reference to the `SocketEvent`, so this is an important and dangerous assumption to get wrong. In the case that the FD isn't immediately removed from the list by the kernel, the event loop can crash due to the `SocketEvent` being destroyed and it being a use-after-free bug at that point. - If a socket FD happens to be duplicated, then closing the SocketEvent FD will not automatically remove it from epoll, and will trigger said bug/crash. It is only automatically removed when all FD references to the underlying socket/resource are closed? - A `fork()` is one example where a socket FD can be duplicated and result in this situation. - `CLOEXEC` might be considered mitigation for this but also introduces a race condition where the crash can occur between a `fork()` and `exec()` without additional synchronization to freeze the event loop. One could argue the mpd event loop isn't fork-safe, and thus should be allowed to use `AbandonFD` however it likes. A decision on whether this is intended should probably be declared; but either way this fix seems appropriate in cases where `Abandon` isn't actually necessary. It also might be possible to fix `AbandonFD` to mark the `SocketEvent` as removed without using `EPOLL_CTL_DEL`? [edit: made this dependent on HAVE_THREADED_EVENT_LOOP which is always true for MPD, but not for ncmpc, for example - mk]
-
Max Kellermann authored
-
Max Kellermann authored
-
Max Kellermann authored
Relax the API (instead of tightening it further like commit 7bc1c992 tried to do unsuccessfully).
-
- 02 Dec, 2020 2 commits
-
-
Max Kellermann authored
This reverts commit 7bc1c992. It caused a crash with the ALSA plugin family (through MultiSocketMonitor::ReplaceSocketList() and MultiSocketMonitor::AddSocket()). Until we have a proper fix, the assertion patch is reverted. Closes https://github.com/MusicPlayerDaemon/MPD/issues/1020
-
Max Kellermann authored
-
- 28 Oct, 2020 1 commit
-
-
Max Kellermann authored
-
- 18 Oct, 2020 1 commit
-
-
Max Kellermann authored
Not only those which are "ready".
-
- 15 Oct, 2020 4 commits
-
-
Max Kellermann authored
-
Max Kellermann authored
-
Max Kellermann authored
-
Max Kellermann authored
-
- 14 Oct, 2020 6 commits
-
-
Max Kellermann authored
Fixes regression by commit 521e573b
-
Max Kellermann authored
-
Max Kellermann authored
-
Max Kellermann authored
-
Max Kellermann authored
-
Max Kellermann authored
Similar to commits 1686f4e8 and 30a5dd26
-
- 13 Oct, 2020 1 commit
-
-
Max Kellermann authored
-
- 09 Oct, 2020 1 commit
-
-
Max Kellermann authored
By making each SocketMonitor keep track of its ready flags, this removes a lot of overhead from EventLoop::RemoveFD().
-
- 08 Oct, 2020 1 commit
-
-
Max Kellermann authored
By bit-wise ANDing the reported flags with GetScheduledFlags(), ERROR/HANGUP always get cleared. This means the MPD event loop could never report those conditions.
-
- 23 Apr, 2020 1 commit
-
-
Max Kellermann authored
This fixes a freeze bug in the NFS input/storage plugins: when libnfs auto-reconnets after a failure, it installs the new socket on the same file descriptor number. MPD's attempt to unregister the old socket by calling SocketMonitor::Steal() from NfsConnection::ScheduleSocket() fails because the new/old socket number is not registered in epoll, so epoll_ctl() returns ENOENT. The problem is that it left `scheduled_flags`, and so subsequent Schedule() calls will use `EPOLL_CTL_MOD`, which will fail again and again. Instead, we need to use `EPOLL_CTL_ADD` to register the new socket. Closes https://github.com/MusicPlayerDaemon/MPD/issues/806 Closes https://github.com/MusicPlayerDaemon/MPD/issues/756
-
- 12 Mar, 2020 1 commit
-
-
Rosen Penev authored
The former was deprecated with C++14. According to the C++11 and C++17 standards, both files are identical. Signed-off-by:
Rosen Penev <rosenp@gmail.com>
-
- 18 Jan, 2020 1 commit
-
-
Max Kellermann authored
-
- 18 Dec, 2019 1 commit
-
-
Max Kellermann authored
-
- 05 Jul, 2019 1 commit
-
-
Max Kellermann authored
-
- 17 Jun, 2019 1 commit
-
-
Max Kellermann authored
-
- 04 Apr, 2019 1 commit
-
-
Max Kellermann authored
Expect OnSocketReady() to cancel events. If it returns false, the SocketMonitor may be destructed already. This fixes a use-after-free bug in the "httpd" output plugin.
-
- 19 Nov, 2018 1 commit
-
-
Max Kellermann authored
Since we switched from autotools to Meson in commit 94592c14, we don't need to include `config.h` early to properly enable large file support. Meson passes the required macros on the compiler command line instead of defining them in `config.h`. This means we can include `config.h` at any time, whenever we want to check its macros, and there are no ordering constraints.
-
- 31 Oct, 2018 1 commit
-
-
Max Kellermann authored
-
- 12 Dec, 2017 1 commit
-
-
Max Kellermann authored
Only _WIN32 is defined by the compiler, and WIN32 is not standardized and may be missing. Closes #169
-
- 10 Nov, 2017 4 commits
-
-
Max Kellermann authored
-
Max Kellermann authored
Migrate callers to GetSocket().Read(), GetSocket.Write(), which is the same.
-
Max Kellermann authored
-
Max Kellermann authored
-
- 11 Aug, 2017 1 commit
-
-
Max Kellermann authored
-
- 10 Aug, 2017 1 commit
-
-
Max Kellermann authored
-
- 03 Jan, 2017 1 commit
-
-
Max Kellermann authored
-
- 01 Mar, 2016 1 commit
-
-
Max Kellermann authored
-
- 26 Feb, 2016 1 commit
-
-
Max Kellermann authored
-