Skip to content

Commit

Permalink
proposed fix
Browse files Browse the repository at this point in the history
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
  • Loading branch information
kolyshkin committed Oct 9, 2023
1 parent 34e12ee commit dbca1b5
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions libcontainer/container_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@ import (
"path"
"path/filepath"
"reflect"
"runtime"
"strconv"
"strings"
"sync"
"time"

"github.com/opencontainers/runtime-spec/specs-go"
"github.com/opencontainers/selinux/go-selinux"
"github.com/sirupsen/logrus"
"github.com/vishvananda/netlink/nl"
"golang.org/x/sys/execabs"
Expand Down Expand Up @@ -512,7 +514,18 @@ func (c *Container) newParentProcess(p *Process) (parentProcess, error) {
} else {
var err error
if isDmzBinarySafe(c.config) {
if label := c.config.ProcessLabel; label != "" {
runtime.LockOSThread()
if err := selinux.SetFSCreateLabel(label); err != nil {
runtime.UnlockOSThread()
return nil, fmt.Errorf("unable to set selinux fs create label: %w", err)
}
}
dmzExe, err = dmz.Binary(c.stateDir)
if c.config.ProcessLabel != "" {
selinux.SetFSCreateLabel("")
runtime.UnlockOSThread()
}
if err == nil {
// We can use our own executable without cloning if we are using
// runc-dmz.
Expand Down

0 comments on commit dbca1b5

Please sign in to comment.