mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 03:41:45 +00:00
Merge pull request #64324 from cofyc/fix62102
Automatic merge from submit-queue (batch tested with PRs 64399, 64324, 64404, 64406, 64396). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. Should use `hostProcMountinfoPath` constant in nsenter_mount.go. **What this PR does / why we need it**: In nsenter mounter implementation, we should read mountinfo from `/rootfs/proc/1/mountinfo` instead of `/proc/self/mountinfo`. **Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*: Fixes # **Special notes for your reviewer**: `/proc/self/mountinfo` will prefix `/rootfs` on mount point path, see ``` $ mkdir /mnt/test $ mount -t tmpfs tmpfs /mnt/test/ $ docker run -it --volume=/:/rootfs:ro,rslave --net=host --pid=host --privileged=true busybox:latest cat /rootfs/proc/1/mountinfo | grep '\/mnt\/test' 442 25 0:80 / /mnt/test rw,relatime shared:70 - tmpfs tmpfs rw $ docker run -it --volume=/:/rootfs:ro,rslave --net=host --pid=host --privileged=true busybox:latest cat /proc/self/mountinfo | grep '\/mnt\/test' 1075 985 0:80 / /rootfs/mnt/test rw,relatime master:70 - tmpfs tmpfs rw ``` **Release note**: ```release-note NONE ```
This commit is contained in:
commit
881c3cf508
@ -333,7 +333,7 @@ func (mounter *NsenterMounter) GetMountRefs(pathname string) ([]string, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return searchMountPoints(hostpath, procMountInfoPath)
|
||||
return searchMountPoints(hostpath, hostProcMountinfoPath)
|
||||
}
|
||||
|
||||
func (mounter *NsenterMounter) GetFSGroup(pathname string) (int64, error) {
|
||||
@ -345,5 +345,5 @@ func (mounter *NsenterMounter) GetFSGroup(pathname string) (int64, error) {
|
||||
}
|
||||
|
||||
func (mounter *NsenterMounter) GetSELinuxSupport(pathname string) (bool, error) {
|
||||
return getSELinuxSupport(pathname, procMountInfoPath)
|
||||
return getSELinuxSupport(pathname, hostProcMountsPath)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user