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
F170633941: D59139.diff
Sat, Sep 5, 5:58 PM
F170577026: D59139.id.diff
Sat, Sep 5, 11:53 AM
F170569027: D59139.id.diff
Sat, Sep 5, 11:06 AM
F170548123: D59139.id184864.diff
Sat, Sep 5, 8:45 AM
F170486331: D59139.id.diff
Sat, Sep 5, 1:30 AM
F170482758: D59139.diff
Sat, Sep 5, 1:03 AM
F170436376: D59139.diff
Fri, Sep 4, 7:57 PM
Unknown Object (File)
Thu, Sep 3, 2:25 PM
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