Page MenuHomeFreeBSD

tests/procdesc: Fix race in pdopenpid_pdwait_only_one
ClosedPublic

Authored by olivier on Wed, Jul 29, 8:22 PM.
Tags
None
Referenced Files
F165249842: D58546.diff
Fri, Aug 7, 4:25 AM
F165249328: D58546.id183080.diff
Fri, Aug 7, 4:19 AM
Unknown Object (File)
Thu, Aug 6, 2:54 PM
Unknown Object (File)
Sun, Aug 2, 12:18 PM
Unknown Object (File)
Sun, Aug 2, 6:01 AM
Unknown Object (File)
Sun, Aug 2, 5:31 AM
Unknown Object (File)
Sat, Aug 1, 8:34 AM
Unknown Object (File)
Sat, Aug 1, 6:51 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