HomeFreeBSD

jaildesc: Publish the new fd only after the jaildesc is initialized

Description

jaildesc: Publish the new fd only after the jaildesc is initialized

jaildesc_alloc() finishes initializing the file structure only after it
is made visible from the file descriptor table via finit(). In that
window, other threads could try to perform operations on the descriptor
and thus access an incompletely initialized jaildesc.

Defer the finit() call until locks are initialized. While here,
simplify the error path for falloc_caps().

Reported by: Yuxiang Yang, Yizhou Zhao, Ao Wang, Xuewei Feng, Qi Li,

		and Ke Xu from Tsinghua University using GLM-5.2 from Z.ai

Reviewed by: jamie
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D58049

Details

Provenance
markjAuthored on Jul 6 2026, 12:51 PM
Reviewer
jamie
Differential Revision
D58049: jaildesc: Publish the new fd only after the jaildesc is initialized
Parents
rG92dfe30ba254: inotify.2: Fix formatting and lint
Branches
Unknown
Tags
Unknown