Attempt to implement a safer process Fork utility.#22
Closed
pawelchcki wants to merge 14 commits into
Closed
Conversation
fa20b50 to
dc60231
Compare
…lead_to_deadlock' into pawel/attempt_a_safe_fork_implementation
ivoanjo
reviewed
Jun 8, 2022
ivoanjo
left a comment
Member
There was a problem hiding this comment.
This looks reasonable, but I'm missing the context for what this will be used for. Could you share a few notes on the plan here?
…ork_implementation
Co-authored-by: Ivo Anjo <ivo.anjo@datadoghq.com>
Co-authored-by: Ivo Anjo <ivo.anjo@datadoghq.com>
…fork_implementation
This reverts commit 29d4f68.
…:DataDog/libdatadog into pawel/attempt_a_safe_fork_implementation
Contributor
Author
|
closing in favor of using explicit unsafe whenever fork is used |
ivoanjo
pushed a commit
that referenced
this pull request
Jun 18, 2025
* Deliver shared library alongside static library * Add exporter example * Activate LTO * Optimize for size instead of speed * Reduce number of codegen units to further reduce ouput library size. * Make dynamic linking the default for libddprof_ffi.pc and provide libddprof_ffi-static.pc for static linking * Remove RPATH/RUNPATH from cdylib on alpine-musl Rust adds some weird RPATH/RUNPATH to cdylibs on alpine-musl (cf. https://git.alpinelinux.org/aports/tree/community/rust/alpine-target.patch,https://git.alpinelinux.org/aports/tree/community/rust/need-rpath.patch).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
implement "safer_fork" function, that turns passed function pointer into separate process. Additional data can be passed to the process as long as its been marked as
ForkSafe.Care must be taken that only the types known to behave well when forked will be marked as ForkSafe.
This should reduce the chance where e.g. a Mutex shared with another thread will be passed to forked process.
Motivation
I've found the Rust type checker to not be very useful when safeguarding semantics around fork - this implementation can help a little - by y making the data that goes into a forked process explicit and better vetted.