Skip to content

libcontainer: improve "kernel.{domainname,hostname}" sysctl handling#1827

Merged
hqhq merged 1 commit into
opencontainers:masterfrom
cyphar:domainname-sysctl-validator
Jun 25, 2018
Merged

libcontainer: improve "kernel.{domainname,hostname}" sysctl handling#1827
hqhq merged 1 commit into
opencontainers:masterfrom
cyphar:domainname-sysctl-validator

Conversation

@cyphar

@cyphar cyphar commented Jun 18, 2018

Copy link
Copy Markdown
Member

These sysctls are namespaced by CLONE_NEWUTS, and we need to use
"kernel.domainname" if we want users to be able to set an NIS domainname
on Linux. However we disallow "kernel.hostname" because it would
conflict with the "hostname" field and cause confusion (but we include a
helpful message to make it clearer to the user).

Signed-off-by: Aleksa Sarai [email protected]

These sysctls are namespaced by CLONE_NEWUTS, and we need to use
"kernel.domainname" if we want users to be able to set an NIS domainname
on Linux. However we disallow "kernel.hostname" because it would
conflict with the "hostname" field and cause confusion (but we include a
helpful message to make it clearer to the user).

Signed-off-by: Aleksa Sarai <[email protected]>
@cyphar

cyphar commented Jun 18, 2018

Copy link
Copy Markdown
Member Author

This is a part of moby/moby#37302.

switch s {
case "kernel.domainname":
// This is namespaced and there's no explicit OCI field for it.
continue

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i dont think we need to explicitly single out kernel.domainname here since its not a TODO for OCI either right ?

@cyphar cyphar Jun 19, 2018

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code is allowing kernel.domainname -- which is why it needs to be singled out (the comment explains why it's allowed and kernel.hostname isn't). If you try to use kernel.domainname without this patch it will fail because runc thinks its not namespaced and fails container creation.

We also can't enable everything under kernel..

@dqminh

dqminh commented Jun 19, 2018

Copy link
Copy Markdown
Contributor

LGTM

Approved with PullApprove

@cyphar

cyphar commented Jun 24, 2018

Copy link
Copy Markdown
Member Author

/cc @opencontainers/runc-maintainers

@hqhq

hqhq commented Jun 25, 2018

Copy link
Copy Markdown
Contributor

LGTM

Approved with PullApprove

@hqhq
hqhq merged commit 3ccfa2f into opencontainers:master Jun 25, 2018
@cyphar
cyphar deleted the domainname-sysctl-validator branch June 25, 2018 23:57
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 this pull request may close these issues.

3 participants