Page MenuHomeFreeBSD

truss: Make control message header parsing more robust
ClosedPublic

Authored by markj on Jun 13 2022, 9:07 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Dec 22, 4:46 PM
Unknown Object (File)
Dec 3 2024, 11:00 AM
Unknown Object (File)
Nov 21 2024, 12:15 AM
Unknown Object (File)
Nov 7 2024, 7:25 AM
Unknown Object (File)
Nov 7 2024, 5:52 AM
Unknown Object (File)
Oct 20 2024, 12:34 AM
Unknown Object (File)
Oct 20 2024, 12:34 AM
Unknown Object (File)
Oct 20 2024, 12:34 AM
Subscribers

Details

Summary

print_cmsg() was assuming that the control message chain is well-formed,
but that isn't necessarily the case for sendmsg(2). In particular, if
cmsg_len is zero, print_cmsg() will loop forever. Check for truncated
headers and try to recover if possible.

Test Plan

This was found by running a syzkaller reproducer under truss. Now it prints:

94908: sendmsg(3,{NULL,0,0x0,0,{{level=SOL_SOCKET,type=SCM_RIGHTS,data={}}{<invalid cmsg len=0>}},108,0},0) ERR#22 'Invalid argument'

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable