Skip to content
  • Simon McVittie's avatar
    dbus-daemon, dbus-launch: cope with callers having closed standard fds · f518165b
    Simon McVittie authored
    In Debian bug <https://bugs.debian.org/829348>, lightdm appears to
    have been starting dbus-launch with at least one of the three
    standard fds 0, 1, 2 (stdin, stdout, stderr) closed. This resulted
    in the dbus-daemon's epoll_create1() returning a fd less than 3.
    Later, _dbus_become_daemon() replaces fds 0-2 with /dev/null. As a
    result, a subsequent call to _dbus_loop_add_watch() for the reload
    pipe resulted in calling epoll_ctl on the non-epoll fd pointing to
    /dev/null, which fails with EINVAL, resulting in the dbus-daemon
    exiting unsuccessfully.
    
    Unix programs are not normally expected to behave correctly when
    launched with the standard fds not already open; but at the same time,
    X11 autolaunching means that dbus-launch (and hence the dbus-daemon)
    can get started from an arbitrarily precarious situation.
    
    Bug: https://bugs.freedesktop.org/show_bug.cgi?id=97008
    
    
    Signed-off-by: default avatarSimon McVittie <smcv@debian.org>
    Reviewed-by: Thiago Macieira ...
    f518165b