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

[rfc] Functionality to make it easy to use libcontainer safely #3027

Open
jprendes opened this issue Dec 19, 2024 · 1 comment
Open

[rfc] Functionality to make it easy to use libcontainer safely #3027

jprendes opened this issue Dec 19, 2024 · 1 comment

Comments

@jprendes
Copy link
Contributor

Context

Using libcontainer as a library requires some care, as shown in #3011 and #2425.

This is mainly related to the safety of executing code after cloning the process.
In general, the more complex the process using libcontainer is, the more likely it is to hit unexpected or undefined behaviours.

This is particularly true for projects writing container shims based on libcontainer, where the shim is a long running process, either using threads, or an async runtime, or both.

Solution

As I mentioned in #3011, in runwasi we are planning to address this using a zygote process.
This is a process that's cloned very early in the main process lifetime, while it's still safe to do so.
This zygote process uses very basic IPC to receive commands and create new containers using libcontainer.
The zygote process is kept very simple to guarantee that when libcontainer does a clone, it's is done safely.

Proposal

I've created a zygote library to do this: https://crates.io/crates/zygote
But I think that zygote would benefit from being part of libcontainer.
I also believe that many use cases for libcontainer would benefit from a functionality like the one provided by zygote.

I would like to donate zygote to youki, potentially as part of libcontainer and with a better name.
I would like to hear your opinions.

@utam0k
Copy link
Member

utam0k commented Dec 22, 2024

Thanks! I think this will be a kind of refactoring of libcontainer, but is my perception correct?
In other words, is it a proposal to use this library to create intermediate processes and init processes?

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

No branches or pull requests

2 participants