-
Notifications
You must be signed in to change notification settings - Fork 377
linux: fix regression mounting within userns #1857
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
Conversation
commit 4a27212 introduced the regression. Detect when running inside a user namespace and treat the mounts in the same way as they would be treated if creating a new user namespace. Closes: containers#1855 Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Reviewer's guide (collapsed on small PRs)Reviewer's GuideIntroduces runtime detection of existing user namespaces when preparing mounts and applies the same mount handling logic as for newly created user namespaces to avoid regression. Sequence diagram for mount preparation with user namespace detectionsequenceDiagram
participant Container
participant LinuxMountHandler
participant UserNamespaceChecker
Container->>LinuxMountHandler: prepare_and_send_mount_mounts()
LinuxMountHandler->>UserNamespaceChecker: check_running_in_user_namespace()
UserNamespaceChecker-->>LinuxMountHandler: is_in_userns (bool)
LinuxMountHandler->>LinuxMountHandler: Set has_userns based on detection
LinuxMountHandler->>LinuxMountHandler: Apply userns mount logic if has_userns
LinuxMountHandler->>Container: Mounts prepared
Class diagram for user namespace detection in mount preparationclassDiagram
class LinuxMountHandler {
+prepare_and_send_mount_mounts(container, pid, sys)
-has_userns: bool
-mount_fds
}
class UserNamespaceChecker {
+check_running_in_user_namespace(err): int
}
LinuxMountHandler --> UserNamespaceChecker: uses
LinuxMountHandler : has_userns set by check_running_in_user_namespace()
LinuxMountHandler : applies userns mount logic if has_userns
File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
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.
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
commit 4a27212 introduced the regression.
Detect when running inside a user namespace and treat the mounts in the same way as they would be treated if creating a new user namespace.
Closes: #1855
Summary by Sourcery
Bug Fixes: