Page MenuHomeFreeBSD

tests/procdesc: Fix race in pdopenpid_pdwait_only_one
ClosedPublic

Authored by olivier on Jul 29 2026, 8:22 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Sep 11, 8:35 AM
Unknown Object (File)
Thu, Sep 10, 7:46 PM
Unknown Object (File)
Thu, Sep 10, 1:00 AM
Unknown Object (File)
Thu, Sep 10, 1:00 AM
Unknown Object (File)
Wed, Sep 9, 2:49 PM
Unknown Object (File)
Sun, Sep 6, 1:18 PM
Unknown Object (File)
Sun, Sep 6, 2:24 AM
Unknown Object (File)
Thu, Sep 3, 8:33 AM
Subscribers

Details

Summary

The child exited immediately after pdfork(), so the parent's pdopenpid() could catch it mid-exit (P_WEXIT) and fail with EBUSY.
Block the child on a pipe until the parent has opened the second descriptor, then release it

Test Plan

Without this patch, I sometimes meet this error:

tests/sys/kern/procdesc.c:534: pdopenpid: Device busy

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable