Skip to content
This repository has been archived by the owner on Feb 28, 2023. It is now read-only.

dist: Refactor user namespace overlayfs build mode to not use fork() #145

Open
Xanewok opened this issue Feb 10, 2022 · 0 comments
Open
Labels
good first issue Good for newcomers

Comments

@Xanewok
Copy link
Contributor

Xanewok commented Feb 10, 2022

Introduced in #128.

The original reason for that is purely technical - it is required to call unshare(CLONE_NEWUSER) in the main thread of a program. Since cachepot-dist is multi-threaded and the build is executed on a new thread, we used a hack in which we fork() and call unshare in the forked child (fork() forks the calling thread into a main thread of a forked child process).

Using fork carries a lot of subtle details we need to be aware of; the current implementation uses some async-signal-unsafe syscalls, which IIUC can hand our process in a signal handler - not ideal!

An initial idea is to provide yet another entrypoint (think cachepot-dist sandbox) to the binary that handles the sandbox setup and runs the actual build; we will have full control and can call everything on the main thread of a program.

@Xanewok Xanewok added the good first issue Good for newcomers label Feb 10, 2022
@Vovke Vovke added migration and removed migration labels Mar 22, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants