Page MenuHomeFreeBSD

auditdistd: fix hangs sending the socket type to a child
Needs ReviewPublic

Authored by asomers on Thu, Oct 8, 10:59 PM.
Tags
None
Referenced Files
F175390841: D60489.id189127.diff
Sat, Oct 10, 12:35 PM
F175322096: D60489.id189127.diff
Fri, Oct 9, 11:07 PM
Unknown Object (File)
Fri, Oct 9, 7:02 PM
Unknown Object (File)
Fri, Oct 9, 11:57 AM
Unknown Object (File)
Fri, Oct 9, 11:00 AM
Unknown Object (File)
Fri, Oct 9, 9:51 AM
Unknown Object (File)
Fri, Oct 9, 6:35 AM
Unknown Object (File)
Fri, Oct 9, 4:58 AM
Subscribers

Details

Reviewers
des
js
Summary

When handing off a socket to a worker child, auditdistd sends a
variable-length string identifying the type of socket being passed. The
child tries to read that string into an oversized buffer, and then read
the socket itself with recvmsg. That used to work because the ancillary
data would interrupt the recv() call. But in FreeBSD 15.1, the recv()
call does a better job of honoring MSG_WAITALL, and does not get
interrupted. The result is a hang; recv() never returns because its
oversized buffer never fills up.

The the bug by omitting MSG_WAITALL when the receiver is expecting
ancillary data. Instead, read both the string and the ancillary data
with a single call to recvmsg(), looping if necessary.

PR: 296107
Reported by: Daniel Porsch <daniel.porsch@loopia.se>
Sponsored by: ConnectWise
MFC after: 1 week

Test Plan

Manually tested using the config provided in Bugzilla

Diff Detail

Repository
rG FreeBSD src repository
Lint
No Lint Coverage
Unit
No Test Coverage
Build Status
Buildable 77874
Build 74757: arc lint + arc unit