|
|
Subscribe / Log in / New account

Race-free process creation in the GNU C Library

Race-free process creation in the GNU C Library

Posted Sep 14, 2023 19:03 UTC (Thu) by the8472 (guest, #144969)
Parent article: Race-free process creation in the GNU C Library

For the rust standard library we've found a pattern that gets use a race-free pidfd without using clone3.

Open a unix socket pair, fork, pidfd_open in the child, send the fd to the parent, do other process setup stuff, exec. We already had a communication channel to the parent anyway for error handling, previously it was a pipe, so it wasn't a big change.


to post comments

Race-free process creation in the GNU C Library

Posted Jun 23, 2024 19:51 UTC (Sun) by heiner (guest, #158880) [Link]

This is correct, if cumbersome, but only necessary in the parent if you cannot rule out other threads in the parent process doing a generic wait(). PIDs are not reused until they are reaped.

I guess in a library context one cannot actually rule that out.


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds