The Samba-Bugzilla – Bug 13309
Fix winbind child process exit bug
Last modified: 2018-02-27 15:49:10 UTC
Fix a bug when a child dies when a request is pending in the child. If the signal handler fires before epoll finds out the other end of the parent-child socket is closed, we close the socket on our side without taking care of the pending request. This causes two problems: First, that one pending request never is replied to properly, and secondly, we might end up with EPOLL_DEL on a wrong file descriptor. This causes all sorts of trouble if we hit an active one.
The fix for this problem is not to close the socket in winbind_child_died(). This however stops an idle child that dies hard from being properly cleaned up. The fix for that is to add the child->monitor_fde that is set pending only when no child request is active. This way we can remove the close(sock) in the signal handler.