-
Notifications
You must be signed in to change notification settings - Fork 93
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
[feature] add support of a runc sandboxer #94
Conversation
f04a84c
to
b9c97a8
Compare
any update on it? |
Maybe we will have a community meeting next week to discuss the design. @xiaods |
any update on it? |
any update on this community meeting? |
I just want to learn about the latest project progress and it doesn't matter about the time. I also need more time to understand this project, so there is no need to worry about time pressure. Thank you. |
@abel-von if the runc sandboxer feature is implemented, can I replace the containerd with the kuasar component? |
any update? |
runc/src/exitsnoop.c
Outdated
{ | ||
struct task_struct *task = (typeof(task)) bpf_get_current_task(); | ||
struct process_exit_data_t data = {}; | ||
//data.start_time = PROCESS_START_TIME_NS, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does this line of code mean? If it's not necessary, it can be removed.
The code is basically complete but still needs some time. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
File Header and CI are needed, the other comment could be resolved in follow up.
runc/src/exitsnoop.c
Outdated
@@ -0,0 +1,36 @@ | |||
#include<linux/sched.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need CopyRight file header.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new version removed the eBPF file
runc/src/exitsnoop.rs
Outdated
@@ -0,0 +1,64 @@ | |||
use bcc::{BPF, Tracepoint}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we also shoule update CI workflow to test runc
package.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new version removed the eBPF file
runc/src/main.rs
Outdated
mod exitsnoop; | ||
|
||
pub const TASK_ADDRESS_SOCK: &str = "/run/kuasar/task.sock"; | ||
const DEFAULT_CONTAINERD_STATE_DIR: &str = "/run/containerd/"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should BOUDLE_DIR
be better? Runc sandboxer does not care about what exactly the container engine is, it only care about the bundle dir of container.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
codes removed of the new version
runc/src/sandbox.rs
Outdated
} | ||
let log_pipe = format!("{}/log", self.base_dir); | ||
unsafe { | ||
mkfifo(&*log_pipe, Mode::from_bits_unchecked(0700)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nix::unistd::mkfifo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
codes removed
runc/src/sandbox.rs
Outdated
} | ||
let child = cmd | ||
.spawn() | ||
.map_err(|e| anyhow!("failed to spawn shim {}", e))?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
spawn runc sandbox parent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
codes removed
runc/task/src/runc.rs
Outdated
|
||
pub async fn copy_io(pio: &ProcessIO, stdio: &Stdio, exit_signal: Arc<ExitSignal>) -> Result<()> { | ||
if !pio.copy { | ||
return Ok(()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should open the read end of fifo.
We also have to provide a |
b9c97a8
to
353536e
Compare
Signed-off-by: Abel Feng <[email protected]>
Signed-off-by: Abel Feng <[email protected]>
Signed-off-by: Abel Feng <[email protected]>
Signed-off-by: Abel Feng <[email protected]>
Signed-off-by: Abel Feng <[email protected]>
Signed-off-by: Abel Feng <[email protected]>
Signed-off-by: Abel Feng <[email protected]>
Signed-off-by: Abel Feng <[email protected]>
6dbd861
to
121951d
Compare
loop { | ||
let buffer = read_count(reqr, 512).unwrap(); | ||
let id = String::from_utf8_lossy(&buffer[0..64]).to_string(); | ||
let mut zero_index = 64; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's the meaning of the 64, a static const maybe suitable
runc/src/main.rs
Outdated
close(reqw).unwrap_or_default(); | ||
close(respr).unwrap_or_default(); | ||
prctl::set_child_subreaper(true).unwrap(); | ||
let comm = format!("[sandbox-parent]"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I find the naming convention for sandbox-parent
somewhat ambiguous, conflicting with the naming convention of kernel threads in the Linux system.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just want to to highlight the process as a special process, do you have any good suggestion?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's sufficient to distinguish using the unique process name directly, there's no need to add square brackets.
exit(0); | ||
} | ||
ForkResult::Child => { | ||
let comm = format!("[sandbox-{}]", id); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as before, naming convention is confused with kernel threads.
4e5874e
to
228d3a9
Compare
Signed-off-by: Abel Feng <[email protected]>
228d3a9
to
d0bd129
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
A remote runc sandboxer which will run a process in seperate namespaces and this process will serve the Task API by a unix domain socket, and this process will also be the process to carry the common namespaces of containers in the same pod. so that we don't have a pause process, the "shim" process will act as the "pause" process