1. 04 Dec, 2020 4 commits
    • arcnmx's avatar
      event/SocketEvent: remove FD before closing socket · 0a81e462
      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]
      0a81e462
    • Max Kellermann's avatar
      event/SocketEvent: add comment · cea8db7e
      Max Kellermann authored
      cea8db7e
    • Max Kellermann's avatar
      b56c0e69
    • Max Kellermann's avatar
      event/SocketEvent: allow Schedule() with IMPLICIT_FLAGS · b27e82e4
      Max Kellermann authored
      Relax the API (instead of tightening it further like commit
      7bc1c992 tried to do unsuccessfully).
      b27e82e4
  2. 02 Dec, 2020 2 commits
  3. 28 Oct, 2020 1 commit
  4. 18 Oct, 2020 1 commit
  5. 15 Oct, 2020 4 commits
  6. 14 Oct, 2020 6 commits
  7. 13 Oct, 2020 1 commit
  8. 09 Oct, 2020 1 commit
  9. 08 Oct, 2020 1 commit
  10. 23 Apr, 2020 1 commit
  11. 12 Mar, 2020 1 commit
  12. 18 Jan, 2020 1 commit
  13. 18 Dec, 2019 1 commit
  14. 05 Jul, 2019 1 commit
  15. 17 Jun, 2019 1 commit
  16. 04 Apr, 2019 1 commit
  17. 19 Nov, 2018 1 commit
    • Max Kellermann's avatar
      check.h: remove obsolete header · ce49d99c
      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.
      ce49d99c
  18. 31 Oct, 2018 1 commit
  19. 12 Dec, 2017 1 commit
  20. 10 Nov, 2017 4 commits
  21. 11 Aug, 2017 1 commit
  22. 10 Aug, 2017 1 commit
  23. 03 Jan, 2017 1 commit
  24. 01 Mar, 2016 1 commit
  25. 26 Feb, 2016 1 commit