Page MenuHomeFreeBSD

dma: do not busy-loop when a remote closes a plaintext connection
Needs ReviewPublic

Authored by nick_spun.io on Mon, Aug 24, 4:37 AM.
Tags
None
Referenced Files
F168809091: D59139.id184864.diff
Sun, Aug 30, 6:30 AM
F168774245: D59139.id.diff
Sun, Aug 30, 2:22 AM
Unknown Object (File)
Thu, Aug 27, 2:42 PM
Unknown Object (File)
Thu, Aug 27, 2:06 PM
Unknown Object (File)
Thu, Aug 27, 2:03 PM
Unknown Object (File)
Tue, Aug 25, 10:08 AM
Unknown Object (File)
Tue, Aug 25, 8:38 AM
Unknown Object (File)
Tue, Aug 25, 8:16 AM
Subscribers
This revision needs review, but there are no reviewers specified.

Details

Reviewers
None
Summary

read_remote() only treated -1 as a read error on the plaintext path, so
an end-of-file return of 0 left the buffer offsets unchanged and the
parse loop spun without making any progress. A remote that accepts the
connection and hangs up without sending a complete reply therefore
pinned a CPU until the connection timeout expired.

Treat a zero-length read as the closed connection it is. The identical
bug in the SSL_read() branch immediately above was fixed upstream in
2021; the plaintext branch was left behind, and is still reachable
whenever SECURETRANSFER is unset or STARTTLS is in use, since the
greeting before STARTTLS is read in the clear.

Signed-off-by: Nick Price <nprice@FreeBSD.org>

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 76042
Build 72925: arc lint + arc unit