HomeFreeBSD

linux(4): Check the socket before any others sanity checks

Description

linux(4): Check the socket before any others sanity checks

Strictly speaking, this check is performed by the kern_recvit(), but in
the Linux emulation layer before calling the kernel we do other sanity
checks and conversions from Linux types to the native types. This changes
an order of the error returning that is critical for some buggy Linux
applications.

For recvmmsg() syscall this fixes a panic in case when the user-supplied
vlen value is 0, then error is not initialized and garbage passed to the
bsd_to_linux_errno().

MFC after: 2 weeks

(cherry picked from commit 3a99aac66f8d12386e8382aaf29d2e82e6b5353b)

Details

Provenance
dchaginAuthored on May 28 2022, 8:29 PM
Parents
rG089a76e915e1: Finish cpuset_getaffinity() after f35093f8
Branches
Unknown
Tags
Unknown