Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kernel keyring control #950

Open
justincormack opened this issue Feb 14, 2018 · 6 comments · May be fixed by #1112
Open

kernel keyring control #950

justincormack opened this issue Feb 14, 2018 · 6 comments · May be fixed by #1112

Comments

@justincormack
Copy link
Contributor

currently runc run has a command line option --no-new-keyring which disables the creation of an isolated kernel keyring for the process. This is kind of weird - I think this should be part of the OCI spec as it is just a specification of resource allocation, like having a new namespace. I can write up a proposal for this; obviously though this will be a breaking change so want to know what anyone else thinks.

@wking
Copy link
Contributor

wking commented Feb 14, 2018 via email

@justincormack
Copy link
Contributor Author

I think the most general interface would be for creating a new session keyring to match the config for namespaces

"keyrings": [
{
  "type": "session"
}
]

joining an existing keyring/creating a new named on as session keyring:

"keyrings": [
{
  "type": "session",
  "name": "mykeyring",
}
]

Initially "session" is probably the only supported value, but it is extensible in future. In theory setting the process keyring might make sense too, but almost all use cases use session.

--no-new-keyring would correspond to an empty keyrings list; the first example above corresponds to the current default.

If this looks sane I will do a spec PR.

@wking
Copy link
Contributor

wking commented Feb 15, 2018

Would you ever need multiple keyrings of the same type? I can't think of a reason, if it's possible at all. If it's not possible, I recommend using an object with ring-type keys:

"keyrings": {
  "session": {
    "name": "mykeyring"
  }
}

@justincormack
Copy link
Contributor Author

I followed what we do for namespaces, where you also can't have more than one of a type. The problem is if name is empty, which is the normal null case for create a new keyring, then the session object is empty as far as Go is concerned. Its a bit of a Go-kernel mismatch where we are trying to distinguish between not set and null.

@wking
Copy link
Contributor

wking commented Feb 15, 2018 via email

@justincormack
Copy link
Contributor Author

Ah yes, you can distinguish between empty but nil map value and non existent one, if you try. So default as per current behaviour could be

"keyrings": {
  "session": {}
}

kailun-qin added a commit to kailun-qin/runtime-spec that referenced this issue Aug 3, 2021
Currently, with `runc` we have a special cmdline flag `--no-new-keyring`
for `runc run` that enables/disables the creation of a new kernel
keyring. The main reason we have the option is that older kernels had
issues with allocating a lot of keyrings (so in order to run containers
on old kernels you need to disable the creation of a new keyring).

This patch adds keyring support into part of the OCI spec which allows
managers to drive this behavior in a runtime-agnostic way and helps make
swapping in other runtimes easier.

Fixes opencontainers#754
Fixes opencontainers#950

Signed-off-by: Kailun Qin <[email protected]>
@kailun-qin kailun-qin linked a pull request Aug 3, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants