Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RootFs need to be cloneable, so the whole state can be copies instead of inherit a reference on fork()/clone() #105

Open
michalfita opened this issue Nov 26, 2021 · 3 comments

Comments

@michalfita
Copy link
Contributor

At the moment Process::fork() seem to clone the Arc<RootFs> instead of content of the RootFs itself, what leads to shared RootFs between processes, not independent file system states.

Found during work on #88 and belongs to Multithreading milestone (I can't add myself).

More details in the flags mask of clone(2), scroll down to CLONE_FS. I haven't checked yet how it's implemented in Linux Kernel.

@nuta nuta added this to the User Multi-threading milestone Nov 26, 2021
@nuta
Copy link
Owner

nuta commented Nov 26, 2021

I agree. We should make RootFs cloneable. Simply adding #[derive(Clone)] should work.

@nuta
Copy link
Owner

nuta commented Nov 26, 2021

Just letting you know that according to clone(2)'s man page, mount points are controlled through another flag CLONE_NEWNS despite Kerla maintains them in RootFs. We'll need to isolate the mount_points field some day but for now, I think we don't need to support the flag unless we support running something like Docker.

@michalfita
Copy link
Contributor Author

Yes, @nuta - all flags related to namespaces are for now excluded from my attempts, namespaces are huge topic related to contenerization.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants