Skip to content

Create bind-mount target directories before executing fuse-overlayfs#1156

Merged
PhilippWendler merged 10 commits into
sosy-lab:mainfrom
t0hsumi:add-mount-dirs-before-fuseoverlayfs
Apr 22, 2025
Merged

Create bind-mount target directories before executing fuse-overlayfs#1156
PhilippWendler merged 10 commits into
sosy-lab:mainfrom
t0hsumi:add-mount-dirs-before-fuseoverlayfs

Conversation

@t0hsumi
Copy link
Copy Markdown
Contributor

@t0hsumi t0hsumi commented Mar 21, 2025

Contributes to solving the following issue: #1136
Based on the discussion: #1155
get_bind_mount_points() is based on https://unix.stackexchange.com/questions/18048/list-only-bind-mounts.
However, I'm unsure whether the assumption holds that the oldest mount point with the shortest relative path to the root of the mounted file system is the original mount.

Copy link
Copy Markdown
Member

@PhilippWendler PhilippWendler left a comment

Choose a reason for hiding this comment

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

Thanks a lot!

Overall the code looks good, I liked it!

While reviewing I realized that maybe we can simplify this considerably, so I only did a quick test and not tried out all cases extensively. Could you think about this (creating directories for all mount points) and try it out?

Comment thread benchexec/container.py Outdated
Comment thread benchexec/container.py
Comment thread benchexec/container.py Outdated
Comment thread benchexec/util.py Outdated
Comment thread benchexec/container.py Outdated
@t0hsumi t0hsumi force-pushed the add-mount-dirs-before-fuseoverlayfs branch from f521d0e to 5501d41 Compare March 22, 2025 01:33
@t0hsumi
Copy link
Copy Markdown
Contributor Author

t0hsumi commented Mar 22, 2025

Thanks for the detailed review. I just replied the comment and add the commit!

Copy link
Copy Markdown
Member

@PhilippWendler PhilippWendler left a comment

Choose a reason for hiding this comment

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

The current solution does nothing more than creating a few directories in the upper dir of the overlayfs, which AFAIK has no side effects for us and should be completely safe. This is nice and we do not need to worry if it breaks something as long as the code does not crash during execution. But I don't think this can happen, even for inaccessible mount points (which are typically a problem) because isdir just returns False for them.

And in my tests it works fine as a solution for #1136.

Also, the code is nicely readable and well explained, thanks!

So this looks ready to merge, only one question about path decoding remains.

Thank you a lot! Your thorough work on this problem and all the iterations and tests have paid off!

Comment thread benchexec/container.py Outdated
t0hsumi added 6 commits April 11, 2025 23:57
Generally, container.py use `bytes` instances.
Use immutable tuple instead of mutable list and add link where the
base implementation is described.
The assumption made by the base implementation have is unreliable
(See https://unix.stackexchange.com/questions/18048/list-only-bind-mounts).
Also, creating empty directories in `upperdir` that already exist in
`lowerdir` does no harm. So for simplicity, create all the mount points.
@t0hsumi t0hsumi force-pushed the add-mount-dirs-before-fuseoverlayfs branch from 5501d41 to c1a51be Compare April 11, 2025 14:00
Copy link
Copy Markdown
Member

@PhilippWendler PhilippWendler left a comment

Choose a reason for hiding this comment

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

Great, thanks a lot again!

@PhilippWendler PhilippWendler changed the title Make the mount bind target directories before executing fuse-overlayfs Create bind-mount target directories before executing fuse-overlayfs Apr 22, 2025
@PhilippWendler PhilippWendler merged commit 191fdd4 into sosy-lab:main Apr 22, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants