Skip to content

Commit b48bbdd

Browse files
committed
vendor: opencontainers/selinux v1.5.1, update deprecated uses
full diff: https://github.com/opencontainers/selinux/v1.4.0...v1.5.1 Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
1 parent a57358e commit b48bbdd

File tree

7 files changed

+94
-38
lines changed

7 files changed

+94
-38
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ require (
1414
github.com/moby/sys/mountinfo v0.1.3
1515
github.com/mrunalp/fileutils v0.0.0-20171103030105-7d4729fb3618
1616
github.com/opencontainers/runtime-spec v1.0.2
17-
github.com/opencontainers/selinux v1.4.0
17+
github.com/opencontainers/selinux v1.5.1
1818
github.com/pkg/errors v0.9.1
1919
github.com/seccomp/libseccomp-golang v0.9.1
2020
github.com/sirupsen/logrus v1.6.0

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ github.com/opencontainers/runtime-spec v1.0.2 h1:UfAcuLBJB9Coz72x1hgl8O5RVzTdNia
2929
github.com/opencontainers/runtime-spec v1.0.2/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0=
3030
github.com/opencontainers/selinux v1.4.0 h1:cpiX/2wWIju/6My60T6/z9CxNG7c8xTQyEmA9fChpUo=
3131
github.com/opencontainers/selinux v1.4.0/go.mod h1:yTcKuYAh6R95iDpefGLQaPaRwJFwyzAJufJyiTt7s0g=
32+
github.com/opencontainers/selinux v1.5.1 h1:jskKwSMFYqyTrHEuJgQoUlTcId0av64S6EWObrIfn5Y=
33+
github.com/opencontainers/selinux v1.5.1/go.mod h1:yTcKuYAh6R95iDpefGLQaPaRwJFwyzAJufJyiTt7s0g=
3234
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
3335
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
3436
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=

libcontainer/setns_init_linux.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,8 @@ import (
1111
"github.com/opencontainers/runc/libcontainer/keys"
1212
"github.com/opencontainers/runc/libcontainer/seccomp"
1313
"github.com/opencontainers/runc/libcontainer/system"
14-
"github.com/opencontainers/selinux/go-selinux/label"
14+
"github.com/opencontainers/selinux/go-selinux"
1515
"github.com/pkg/errors"
16-
1716
"golang.org/x/sys/unix"
1817
)
1918

@@ -34,10 +33,10 @@ func (l *linuxSetnsInit) Init() error {
3433
defer runtime.UnlockOSThread()
3534

3635
if !l.config.Config.NoNewKeyring {
37-
if err := label.SetKeyLabel(l.config.ProcessLabel); err != nil {
36+
if err := selinux.SetKeyLabel(l.config.ProcessLabel); err != nil {
3837
return err
3938
}
40-
defer label.SetKeyLabel("")
39+
defer selinux.SetKeyLabel("")
4140
// Do not inherit the parent's session keyring.
4241
if _, err := keys.JoinSessionKeyring(l.getSessionRingName()); err != nil {
4342
// Same justification as in standart_init_linux.go as to why we
@@ -62,10 +61,10 @@ func (l *linuxSetnsInit) Init() error {
6261
return err
6362
}
6463
}
65-
if err := label.SetProcessLabel(l.config.ProcessLabel); err != nil {
64+
if err := selinux.SetExecLabel(l.config.ProcessLabel); err != nil {
6665
return err
6766
}
68-
defer label.SetProcessLabel("")
67+
defer selinux.SetExecLabel("")
6968
// Without NoNewPrivileges seccomp is a privileged operation, so we need to
7069
// do this before dropping capabilities; otherwise do it as late as possible
7170
// just before execve so as few syscalls take place after it as possible.

libcontainer/standard_init_linux.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
"github.com/opencontainers/runc/libcontainer/keys"
1414
"github.com/opencontainers/runc/libcontainer/seccomp"
1515
"github.com/opencontainers/runc/libcontainer/system"
16-
"github.com/opencontainers/selinux/go-selinux/label"
16+
"github.com/opencontainers/selinux/go-selinux"
1717
"github.com/pkg/errors"
1818

1919
"golang.org/x/sys/unix"
@@ -47,10 +47,10 @@ func (l *linuxStandardInit) Init() error {
4747
runtime.LockOSThread()
4848
defer runtime.UnlockOSThread()
4949
if !l.config.Config.NoNewKeyring {
50-
if err := label.SetKeyLabel(l.config.ProcessLabel); err != nil {
50+
if err := selinux.SetKeyLabel(l.config.ProcessLabel); err != nil {
5151
return err
5252
}
53-
defer label.SetKeyLabel("")
53+
defer selinux.SetKeyLabel("")
5454
ringname, keepperms, newperms := l.getSessionRingParams()
5555

5656
// Do not inherit the parent's session keyring.
@@ -83,7 +83,8 @@ func (l *linuxStandardInit) Init() error {
8383
return err
8484
}
8585

86-
label.Init()
86+
// initialises the labeling system
87+
selinux.GetEnabled()
8788
if err := prepareRootfs(l.pipe, l.config); err != nil {
8889
return err
8990
}
@@ -145,10 +146,10 @@ func (l *linuxStandardInit) Init() error {
145146
if err := syncParentReady(l.pipe); err != nil {
146147
return errors.Wrap(err, "sync ready")
147148
}
148-
if err := label.SetProcessLabel(l.config.ProcessLabel); err != nil {
149+
if err := selinux.SetExecLabel(l.config.ProcessLabel); err != nil {
149150
return errors.Wrap(err, "set process label")
150151
}
151-
defer label.SetProcessLabel("")
152+
defer selinux.SetExecLabel("")
152153
// Without NoNewPrivileges seccomp is a privileged operation, so we need to
153154
// do this before dropping capabilities; otherwise do it as late as possible
154155
// just before execve so as few syscalls take place after it as possible.

vendor/github.com/opencontainers/selinux/go-selinux/selinux_linux.go

Lines changed: 65 additions & 23 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/opencontainers/selinux/go-selinux/selinux_stub.go

Lines changed: 13 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/modules.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ github.com/mrunalp/fileutils
4040
# github.com/opencontainers/runtime-spec v1.0.2
4141
## explicit
4242
github.com/opencontainers/runtime-spec/specs-go
43-
# github.com/opencontainers/selinux v1.4.0
43+
# github.com/opencontainers/selinux v1.5.1
4444
## explicit
4545
github.com/opencontainers/selinux/go-selinux
4646
github.com/opencontainers/selinux/go-selinux/label

0 commit comments

Comments
 (0)