@@ -48,13 +48,25 @@ func (l *linuxStandardInit) Init() error {
4848 ringname , keepperms , newperms := l .getSessionRingParams ()
4949
5050 // Do not inherit the parent's session keyring.
51- sessKeyId , err := keys .JoinSessionKeyring (ringname )
52- if err != nil {
53- return errors .Wrap (err , "join session keyring" )
54- }
55- // Make session keyring searcheable.
56- if err := keys .ModKeyringPerm (sessKeyId , keepperms , newperms ); err != nil {
57- return errors .Wrap (err , "mod keyring permissions" )
51+ if sessKeyId , err := keys .JoinSessionKeyring (ringname ); err != nil {
52+ // If keyrings aren't supported then it is likely we are on an
53+ // older kernel (or inside an LXC container). While we could bail,
54+ // the security feature we are using here is best-effort (it only
55+ // really provides marignal protection since VFS credentials are
56+ // the only significant protection of keyrings).
57+ //
58+ // TODO(cyphar): Log this so people know what's going on, once we
59+ // have proper logging in 'runc init'.
60+ if errors .Cause (err ) != unix .ENOSYS {
61+ return errors .Wrap (err , "join session keyring" )
62+ }
63+ } else {
64+ // Make session keyring searcheable. If we've gotten this far we
65+ // bail on any error -- we don't want to have a keyring with bad
66+ // permissions.
67+ if err := keys .ModKeyringPerm (sessKeyId , keepperms , newperms ); err != nil {
68+ return errors .Wrap (err , "mod keyring permissions" )
69+ }
5870 }
5971 }
6072
0 commit comments