Skip to content

Conversation

@purplesyringa
Copy link

Error::other allocates memory (see rust-lang/rust#148971). This is bad in multi-threaded programs, which FeOS AFAIK is. If the fork occurs while the allocator lock is held by another thread, deadlocks can occur, since there's no one left in the new process to unlock the mutex. I do not believe this is UB, and modern libc offer protections against this issue, but this isn't POSIX-compliant and should preferably be avoided.

nix provides a non-allocating impl From<Errno> for std::io::Error, which can be used instead. This also ensures that the correct error code is forwarded to the parent process, instead of the default -EINVAL.

@hardikdr hardikdr added the area/operatingsystem Operating system-related concerns. label Nov 21, 2025
@hardikdr hardikdr added this to Roadmap Nov 21, 2025
@purplesyringa purplesyringa changed the title Avoid allocating in pre_exec closure Avoid allocating in pre_exec closure Nov 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/operatingsystem Operating system-related concerns.

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants