HomeFreeBSD

unix/*: rewrite unp_internalize() cmsg parsing cycle

Description

unix/*: rewrite unp_internalize() cmsg parsing cycle

Make it a complex, but a single for(;;) statement. The previous cycle
with some loop logic in the beginning and some loop logic at the end
was confusing. Both me and markj@ were misleaded to a conclusion that
some checks are unnecessary, while they actually were necessary.

While here, handle an edge case found by Mark, when on 64-bit platform
an incorrect message from userland would underflow length counter, but
return without any error. Provide a test case for such message.

Reviewed by: markj
Differential revision: https://reviews.freebsd.org/D35375

Details

Provenance
glebiusAuthored on Jun 6 2022, 5:05 PM
Reviewer
markj
Differential Revision
D35375: unix/*: rewrite unp_internalize() cmsg parsing cycle
Parents
rG8d95f5005211: smp: Use local copies of the setup function pointer and argument
Branches
Unknown
Tags
Unknown