-
Notifications
You must be signed in to change notification settings - Fork 641
restore: do mount proc in usernsd on certain conditions #2600
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
base: criu-dev
Are you sure you want to change the base?
Conversation
82068d3
to
cbe9e92
Compare
int fd, ret; | ||
|
||
if ((root_ns_mask & CLONE_NEWUSER) && !(root_ns_mask & CLONE_NEWNS)) | ||
fd = ret = userns_call(userns_mount_proc, UNS_FDOUT, NULL, sizeof(NULL), -1); |
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.
will it be mounted in the target pid namespace?
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.
No i don't think it will be mounted and it's gonna be rejected. I fixed this now. The corner case is only when the user namespace is isolated while keeping both mount namespace and pid namespace be shared with host. If either of two namespaces are isolated, the proc fs will be mounted successfully.
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.
If a target workload is restored in just separate userns and pid namespaces, userns_mount_proc will fail, because the current process doesn't have CAP_SYS_ADMIN in the current mount namespace. The only way to workaround that is to mount proc from usernsd, and the userns mount callback has to enter the target pid namespace before mounting proc.
cbe9e92
to
89d1e1c
Compare
43dbd40
to
eda5ab0
Compare
Rebased to criu-dev |
When the user namespace is separate from both pid and mount namespace in the given task, cr-restore will fail to mount the procfs in the new user namespace because of the loss of privileges. Delegate usernsd to do the mount job if that corner case arises. Signed-off-by: Yiyang Wu <toolmanp@tlmp.cc>
A friendly reminder that this PR had no activity for 30 days. |
When only the user namespace is isolated in the given task, cr-restore will fail to mount the procfs in the new user namespace because of the loss of privileges.
Delegate usernsd to do the mount job if that corner case arises.
Fixes: #2597