Skip to content

libct/configs/validate: allow / in sysctl names#3254

Merged
mrunalp merged 1 commit intoopencontainers:masterfrom
kolyshkin:sysctl-slash
Oct 29, 2021
Merged

libct/configs/validate: allow / in sysctl names#3254
mrunalp merged 1 commit intoopencontainers:masterfrom
kolyshkin:sysctl-slash

Conversation

@kolyshkin
Copy link
Copy Markdown
Contributor

Runtime spec says:

sysctl (object, OPTIONAL) allows kernel parameters to be modified at
runtime for the container. For more information, see the sysctl(8)
man page.

and sysctl(8) says:

variable
The name of a key to read from. An example is
kernel.ostype. The '/' separator is also accepted in place of a '.'.

Apparently, runc config validator do not support sysctls with / as a
separator. Fortunately this is a one-line fix.

Add some more test data where / is used as a separator.

Related to: kubernetes/kubernetes#102393

Runtime spec says:

> sysctl (object, OPTIONAL) allows kernel parameters to be modified at
> runtime for the container. For more information, see the sysctl(8)
> man page.

and sysctl(8) says:

> variable
>    The name of a key to read from. An example is
>    kernel.ostype. The '/' separator is also accepted in place of a '.'.

Apparently, runc config validator do not support sysctls with / as a
separator. Fortunately this is a one-line fix.

Add some more test data where / is used as a separator.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Comment on lines +191 to +195
"fs/mqueue/ctl": "ctl",
"net.ctl": "ctl",
"net/ctl": "ctl",
"kernel.ctl": "ctl",
"kernel/ctl": "ctl",
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

In the unit test, the sysctl value with existing dots and slashes is also added.

)

for s := range config.Sysctl {
s := strings.Replace(s, "/", ".", -1)
Copy link
Copy Markdown

@mengjiao-liu mengjiao-liu Nov 1, 2021

Choose a reason for hiding this comment

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

I think there is a problem with your conversion:
If the ssyctl value is net/pv4/conf/eno2.100/rp_filter
The correct conversion result should be net.ipv4.conf.eno2/100.rp_filter

see kubernetes/kubernetes#102393 (comment)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@mengjiao-liu Could you open a github issue?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Ok, I will open a issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants