DragonFlyBSD Kernel Audit
← triage · dashboard
DF-2735

socket_wait() leaks one file descriptor into the caller's fd table on every call (and on its error path)

Field Value
ID DF-2735
Status new
Severity Low
CVSS 3.1 CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:L
CWE CWE-401 / CWE-772
File sys/kern/sys_generic.c
Lines 1699-1727
Area kern
Confidence certain
Discovered 2026-08-30
Pass 2 (GLM 5.3 second pass)
Bucket base:kern
Reported pending
Known CVE none
CVE match novel

Summary

socket_wait() does falloc+fsetfd (which publishes a new fd holding its own reference) but never closes/uninstalls it: on the kqueue_register error path it fdrop()s only the caller's reference (fd remains), and on the success path it swaps fp->f_ops to badfileops and fdrop()s — the fd stays permanently installed in curproc's table, unknown to the caller. No UAF (fsetfd takes its own reference), purely an fd leak: each call permanently consumes one descriptor until process exit. Only in-tree caller is netproto/smb/smb_trantcp.c:226 (legacy bucket) — repeated SMB transactions exhaust the caller's fd limit.

Track the reserved fd and uninstall it before returning (funsetfd on the error path; pass the fd back or close it on completion).

Timeline

  • 2026-08-30 Discovered during pass-2 audit of sys_generic.c (GLM 5.3).

Discussion (0)

No comments yet.