Skip to content

Commit

Permalink
check nil for selinuxLabel
Browse files Browse the repository at this point in the history
Signed-off-by: Lifubang <[email protected]>
Signed-off-by: lifubang <[email protected]>
  • Loading branch information
lifubang committed Apr 3, 2019
1 parent da20211 commit b1ea070
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,5 +224,5 @@ func getProcess(context *cli.Context, bundle string) (*specs.Process, error) {
}
p.User.AdditionalGids = append(p.User.AdditionalGids, uint32(gid))
}
return p, nil
return p, validateProcessSpec(p)
}
4 changes: 4 additions & 0 deletions utils_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
"github.com/opencontainers/runc/libcontainer/specconv"
"github.com/opencontainers/runc/libcontainer/utils"
"github.com/opencontainers/runtime-spec/specs-go"
selinux "github.com/opencontainers/selinux/go-selinux"

"github.com/coreos/go-systemd/activation"
"github.com/pkg/errors"
Expand Down Expand Up @@ -387,6 +388,9 @@ func validateProcessSpec(spec *specs.Process) error {
if len(spec.Args) == 0 {
return fmt.Errorf("args must not be empty")
}
if spec.SelinuxLabel != "" && !selinux.GetEnabled() {
return fmt.Errorf("selinux label is specified in config, but selinux is disabled or not supported")
}
return nil
}

Expand Down

0 comments on commit b1ea070

Please sign in to comment.