Skip to content

Commit

Permalink
In certain cases, setting the process label will not happen.
Browse files Browse the repository at this point in the history
When the code attempts to set the ProcessLabel, it checks if SELinux Is
enabled.  We have seen a case with some of our patches where the code
is fooled by the container to think that SELinux is not enabled.  Calling
label.Init before setting up the rest of the container, tells the library that
SELinux is enabled and everything works fine.

Docker-DCO-1.1-Signed-off-by: Dan Walsh <[email protected]> (github: rhatdan)
  • Loading branch information
rhatdan committed Apr 1, 2014
1 parent 9498779 commit 30815cf
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions nsinit/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ func (ns *linuxNs) Init(container *libcontainer.Container, uncleanRootfs, consol
if err := system.ParentDeathSignal(uintptr(syscall.SIGTERM)); err != nil {
return fmt.Errorf("parent death signal %s", err)
}

label.Init()
ns.logger.Println("setup mount namespace")
if err := setupNewMountNamespace(rootfs, container.Mounts, console, container.ReadonlyFs, container.NoPivotRoot, container.Context["mount_label"]); err != nil {
return fmt.Errorf("setup mount namespace %s", err)
Expand Down

0 comments on commit 30815cf

Please sign in to comment.