Skip to content

Attempt to implement a safer process Fork utility.#22

Closed
pawelchcki wants to merge 14 commits into
mainfrom
pawel/attempt_a_safe_fork_implementation
Closed

Attempt to implement a safer process Fork utility.#22
pawelchcki wants to merge 14 commits into
mainfrom
pawel/attempt_a_safe_fork_implementation

Conversation

@pawelchcki

Copy link
Copy Markdown
Contributor

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.

@pawelchcki pawelchcki requested review from a team as code owners June 7, 2022 13:16
@pawelchcki pawelchcki force-pushed the pawel/attempt_a_safe_fork_implementation branch from fa20b50 to dc60231 Compare June 7, 2022 17:59
…lead_to_deadlock' into pawel/attempt_a_safe_fork_implementation

@ivoanjo ivoanjo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Comment thread ddtelemetry/src/fork.rs Outdated
Comment thread ddtelemetry/src/fork.rs Outdated
Comment thread ddtelemetry/src/fork.rs Outdated
Comment thread ddtelemetry/src/fork.rs Outdated
Comment thread ddtelemetry/src/fork.rs Outdated
Comment thread ddtelemetry/src/fork.rs Outdated
Comment thread ddtelemetry/src/fork.rs Outdated
@pawelchcki

Copy link
Copy Markdown
Contributor Author

closing in favor of using explicit unsafe whenever fork is used

@pawelchcki pawelchcki closed this Aug 31, 2022
@bantonsson bantonsson deleted the pawel/attempt_a_safe_fork_implementation branch March 7, 2024 07:15
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).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants