HomeFreeBSD

fd: Avoid truncating output buffers for KERN_PROC_{CWD,FILEDESC}

Description

fd: Avoid truncating output buffers for KERN_PROC_{CWD,FILEDESC}

These sysctls failed to return an error if the caller had provided too
short an output buffer. Change them to return ENOMEM instead, to ensure
that callers can detect truncation in the face of a concurrently
changing fd table.

PR: 228432
Discussed with: cem, jhb
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D15607

Details

Provenance
markjAuthored on Dec 16 2021, 9:07 PM
Differential Revision
D15607: Improve error handling for KERN_PROC_{CWD,FILEDESC}.
Parents
rG327060bd7799: fd: Initialize more export_fd_buf fields in kern_proc_cwd_out()
Branches
Unknown
Tags
Unknown