HomeFreeBSD

ktls: Close a race with setting so_error when dropping a connection.

Description

ktls: Close a race with setting so_error when dropping a connection.

pr_abort calls tcp_usr_abort which calls tcp_drop with ECONNABORTED.
After pr_abort returns, the so_error is then set to a more specific
error. However, a reader can observe and return the ECONNABORTED
error before so_error is set to the desired error value. This is
resulting in spurious test failures of recently added tests for
invalid conditions such as invalid headers.

To fix, refactor the code to abort a connection to call tcp_drop
directly with the desired error value. ktls_reset_send_tag already
calls tcp_drop directly when it aborts a connection due to an error.

Reviewed by: gallatin
Reported by: CI (jenkins), gallatin, olivier
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D37692

Details

Provenance
jhbAuthored on Dec 15 2022, 8:06 PM
Reviewer
gallatin
Differential Revision
D37692: ktls: Close a race with setting so_error when dropping a connection.
Parents
rG883d1742d3d7: ktls_tests: Log more details when a test fails.
Branches
Unknown
Tags
Unknown