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

Change Mount Detection to read /proc/mounts instead of using Device IDs #7

Closed
caleblloyd opened this issue Jan 11, 2018 · 1 comment

Comments

@caleblloyd
Copy link
Collaborator

Presently, fixuid prevents recursing into mounts by calling sys, ok := fileInfo.Sys().(*syscall.Stat_t) and reading the device ID from sys.Dev. If the Device ID of a current file or directory is different than the Device ID of the initially searched directory, the current file or directory is considered to be on a different mount and recursion into the mount is prevented.

I am now seeing a test failure on TravisCI, files are showing up with different Device IDs than their parent directories, even though the files and directories reside on the same mount:
https://travis-ci.org/boxboat/fixuid/builds/327907254

Logging output says that all of the directories in the / mount are on Device ID 41 but all of the files in the / mount are on Device ID 2049

I wondered if it was anything to do with the Storage Driver so I setup Overlay2 backed by EXT4 on my machine, and I could not recreate. At this point, I am not sure what environmental difference Travis CI has to cause this.

It seems that it would be more reliable to detect what mount a file is part of by parsing /proc/mounts instead of relying on the Device ID in the inode

@caleblloyd
Copy link
Collaborator Author

I have tried to recreate using the same storage driver and Docker Engine version as Travis CI and am unable to:

Travis CI: Tests fail

Server Version: 17.09.0-ce
Storage Driver: overlay2
 Backing Filesystem: extfs
 Supports d_type: true
 Native Overlay Diff: true
Kernel Version: 4.4.0-101-generic
Operating System: Ubuntu 14.04.5 LTS

My Laptop: All tests pass

Server Version: 17.09.0-ce
Storage Driver: overlay2
 Backing Filesystem: extfs
 Supports d_type: true
 Native Overlay Diff: true
Kernel Version: 4.13.0-21-generic
Operating System: Ubuntu 16.04.3 LTS

At this point I am wondering if it is a kernel difference in the implementation of Overlay2 or an option that TravisCI creates their EXT4 partitions with

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

No branches or pull requests

1 participant