mirror of
https://github.com/aljazceru/kata-containers.git
synced 2025-12-18 06:44:23 +01:00
runtime-rs: fix sandbox_cgroup_only=false panic
When run with configuration `sandbox_cgroup_only=false`, we will call
`gen_overhead_path()` as the overhead path. The `cgroup-rs` will push
the path with the subsystem prefix by `PathBuf::push()`. When the path
has prefix “/” it will act as root path, such as
```
let mut path = PathBuf::from("/tmp");
path.push("/etc");
assert_eq!(path, PathBuf::from("/etc"));
```
So we shoud not set overhead path with prefix "/".
Fixes: #4687
Signed-off-by: Quanwei Zhou <quanweiZhou@linux.alibaba.com>
This commit is contained in:
committed by
quanwei.zqw
parent
9f49f7adca
commit
e9988f0c68
@@ -12,5 +12,5 @@
|
||||
// /sys/fs/cgroup/memory/kata_overhead/$CGPATH where $CGPATH is
|
||||
// defined by the orchestrator.
|
||||
pub(crate) fn gen_overhead_path(path: &str) -> String {
|
||||
format!("/kata_overhead/{}", path.trim_start_matches('/'))
|
||||
format!("kata_overhead/{}", path.trim_start_matches('/'))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user