mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-30 15:05:27 +00:00
Avoid setting S_ISGID on files in volumes.
Directories in volumes are set S_ISGID to ensure files created inside them inherit group ownership. Currently, files are also set S_ISGID however this is not relevant to the original intent, and indicates 'mandatory file locking' (stat(2)). With this commit, only directories are set S_ISGID.
This commit is contained in:
parent
dbc4121e16
commit
67f3134232
@ -71,7 +71,11 @@ func SetVolumeOwnership(mounter Mounter, fsGroup *int64) error {
|
||||
mask = roMask
|
||||
}
|
||||
|
||||
err = chmodRunner.Chmod(path, info.Mode()|mask|os.ModeSetgid)
|
||||
if info.IsDir() {
|
||||
mask |= os.ModeSetgid
|
||||
}
|
||||
|
||||
err = chmodRunner.Chmod(path, info.Mode()|mask)
|
||||
if err != nil {
|
||||
glog.Errorf("Chmod failed on %v: %v", path, err)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user