Skip to content

Fix O(N^2) behavior of bind mounting. - #385

Open
brown wants to merge 1 commit into
containers:mainfrom
brown:fix-mount-speed
Open

brown wants to merge 1 commit into
containers:mainfrom
brown:fix-mount-speed

Conversation

@brown

@brown brown commented Aug 14, 2020

Copy link
Copy Markdown

Read /proc/self/mountinfo only once instead reading it for every "--bind" flag
on the command line.

@brown

brown commented Aug 14, 2020

Copy link
Copy Markdown
Author

This pull request is a work in progress. The intent is to fix #384
I'll need some help from the bubblewrap maintainers to land this change.

@rh-atomic-bot

Copy link
Copy Markdown

Can one of the admins verify this patch?
I understand the following commands:

  • bot, add author to whitelist
  • bot, test pull request
  • bot, test pull request once

@brown
brown force-pushed the fix-mount-speed branch 3 times, most recently from fac3f78 to 9e10887 Compare August 18, 2020 13:31
Read /proc/self/mountinfo only once instead reading it for every "--bind" flag
on the command line.
@alexlarsson

Copy link
Copy Markdown
Collaborator

I didn't really review this, but clearly its not doing recursive bind mounts correctly as it only adds one mount info for the mount.
Also, it doesn't do anything about flags on remount.

In the setuid case, any time we get a wrong value for current_flags for some reason we risk changing the mount flags of an existing mount and accidentally dropping a sysadmin-set flag (such as nosetuid, or read-only) which is a security failure.

@brown

brown commented Aug 25, 2020 via email

Copy link
Copy Markdown
Author

@Maryse47

Copy link
Copy Markdown

Having alternative for constantly reading /proc/self/mountinfo was recently requested on lkml which also means such alternative may not exist right for now.

@smcv

smcv commented Sep 15, 2026

Copy link
Copy Markdown
Collaborator

In current git main (to be released as 0.13.0 in future), performance should only be O(n^2) in the number of mounts if you have a very old kernel that doesn't support mount_setattr(). I think that's probably good enough to consider this solved, and close this PR as no longer needed?

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.

5 participants