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

rustjail: fix the issue of invalid cgroup_parent path #694

Merged
merged 1 commit into from
Sep 11, 2020

Conversation

lifupan
Copy link
Member

@lifupan lifupan commented Sep 9, 2020

The cgroup_parent path is expected to be absolute path,
if it was passed a relative path, change it to be an
absolute path.

Fixes: #336

Signed-off-by: fupan.lfp fupan.lfp@antfin.com

@lifupan
Copy link
Member Author

lifupan commented Sep 9, 2020

/test

@@ -1404,9 +1406,9 @@ impl Manager {
}

let p = if value == "/" {
format!("{}{}", mnt.unwrap(), cpath)
format!("{}{}", mnt.unwrap(), cgroup_path)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you also change these unwrap()'s to map_err()?'s?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @jodh-intel

Those unwraps are on Option variables and they had been tested with is_some(), so here it's safe to unwrap on them.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what happen if cpath doesn't start with '/' ?, cgroup_path will be empty, so p will be equal to mnt.unwrap(), is this expected ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @devimc good point, I had updated.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about just using format!("{}/{}", xxx, xxx), adding an extra / in between in all cases?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that's an option, which let the kernel do the '/' deduplication.

@lifupan
Copy link
Member Author

lifupan commented Sep 10, 2020

/test

The cgroup_parent path is expected to be absolute path,
add an '/' prefix to the passed cgroup_parent path to make
sure it's an absolute path.

Fixes: kata-containers#336

Signed-off-by: fupan.lfp <fupan.lfp@antfin.com>
@lifupan
Copy link
Member Author

lifupan commented Sep 10, 2020

/test

Copy link

@devimc devimc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm - thanks @lifupan

@snir911
Copy link
Member

snir911 commented Sep 10, 2020

lgtm, I can confirm it fixed the issue for me #336

Copy link
Member

@bergwolf bergwolf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@bergwolf bergwolf merged commit e3ea854 into kata-containers:2.0-dev Sep 11, 2020
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

Successfully merging this pull request may close these issues.

2.0: cri-o tests failing with: CreateContainer failed: EINVAL: Invalid argument: unknown
5 participants