BUG/MEDIUM: ssl/fd: unexpected fd close using async engine

Before 2.3, after an async crypto processing or on session close, the engine
async file's descriptors were removed from the fdtab but not closed because
it is the engine which has created the file descriptor, and it is responsible
for closing it. In 2.3 the fd_remove() call was replaced by fd_stop_both()
which stops the polling but does not remove the fd from the fdtab and the
fd remains indefinitively in the fdtab.

A simple replacement by fd_delete() is not a valid fix because fd_delete()
removes the fd from the fdtab but also closes the fd. And the fd will be
closed twice: by the haproxy's core and by the engine itself.

Instead, let's set FD_DISOWN on the FD before calling fd_delete() which will
take care of not closing it.

This patch must be backported on branches >= 2.3, and it relies on this
previous patch:

   MINOR: fd: add a new FD_DISOWN flag to prevent from closing a deleted FD

As mentioned in the patch above, a different flag will be needed in 2.3.

(cherry picked from commit 7d392a592d5341df43086a2a48f34658b0ba432f)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit 6a372a4b34b72164a6772570a42761a5f22ef678)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit 8def9112488a08e1a38aed06b7068f3791244b71)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
1 file changed