Skip to content

Commit 8b98e82

Browse files
authored
Merge pull request #4676 from kolyshkin/keyring-log
libct: log a warning on join session keyring failure
2 parents 4c22153 + 5393155 commit 8b98e82

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

libcontainer/setns_init_linux.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,9 @@ func (l *linuxSetnsInit) Init() error {
3939
defer selinux.SetKeyLabel("") //nolint: errcheck
4040
// Do not inherit the parent's session keyring.
4141
if _, err := keys.JoinSessionKeyring(l.getSessionRingName()); err != nil {
42-
// Same justification as in standart_init_linux.go as to why we
42+
logrus.Warnf("KeyctlJoinSessionKeyring: %v", err)
43+
// Same justification as in standard_init_linux.go as to why we
4344
// don't bail on ENOSYS.
44-
//
45-
// TODO(cyphar): And we should have logging here too.
4645
if !errors.Is(err, unix.ENOSYS) {
4746
return fmt.Errorf("unable to join session keyring: %w", err)
4847
}

libcontainer/standard_init_linux.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,12 @@ func (l *linuxStandardInit) Init() error {
5555

5656
// Do not inherit the parent's session keyring.
5757
if sessKeyId, err := keys.JoinSessionKeyring(ringname); err != nil {
58+
logrus.Warnf("KeyctlJoinSessionKeyring: %v", err)
5859
// If keyrings aren't supported then it is likely we are on an
5960
// older kernel (or inside an LXC container). While we could bail,
6061
// the security feature we are using here is best-effort (it only
6162
// really provides marginal protection since VFS credentials are
6263
// the only significant protection of keyrings).
63-
//
64-
// TODO(cyphar): Log this so people know what's going on, once we
65-
// have proper logging in 'runc init'.
6664
if !errors.Is(err, unix.ENOSYS) {
6765
return fmt.Errorf("unable to join session keyring: %w", err)
6866
}

0 commit comments

Comments
 (0)