소스 검색

Fix relabel for SELinux

With the changes merged into runc/libcontainer, are now causing
SELinux to attempt a relabel always, even if the user did not
request the relabel.

If the user does not specify Z or z on the volume mount we should
not attempt a relabel.

Signed-off-by: Dan Walsh <dwalsh@redhat.com>
Dan Walsh 9 년 전
부모
커밋
d9011b3617
1개의 변경된 파일4개의 추가작업 그리고 3개의 파일을 삭제
  1. 4 3
      daemon/volumes.go

+ 4 - 3
daemon/volumes.go

@@ -135,9 +135,10 @@ func (daemon *Daemon) registerMountPoints(container *Container, hostConfig *runc
 			bind.Driver = v.DriverName()
 			bind.Driver = v.DriverName()
 			bind = setBindModeIfNull(bind)
 			bind = setBindModeIfNull(bind)
 		}
 		}
-		shared := label.IsShared(bind.Mode)
-		if err := label.Relabel(bind.Source, container.MountLabel, shared); err != nil {
-			return err
+		if label.RelabelNeeded(bind.Mode) {
+			if err := label.Relabel(bind.Source, container.MountLabel, label.IsShared(bind.Mode)); err != nil {
+				return err
+			}
 		}
 		}
 		binds[bind.Destination] = true
 		binds[bind.Destination] = true
 		mountPoints[bind.Destination] = bind
 		mountPoints[bind.Destination] = bind