Skip to content

Fix privileged container sysfs can't be rw because pod is ro by default#11271

Merged
AkihiroSuda merged 1 commit intocontainerd:mainfrom
fengwei0328:dev2
Feb 28, 2025
Merged

Fix privileged container sysfs can't be rw because pod is ro by default#11271
AkihiroSuda merged 1 commit intocontainerd:mainfrom
fengwei0328:dev2

Conversation

@fengwei0328
Copy link
Copy Markdown
Contributor

fix #11270

@k8s-ci-robot
Copy link
Copy Markdown

Hi @fengwei0328. Thanks for your PR.

I'm waiting for a containerd member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@dosubot dosubot Bot added area/cri Container Runtime Interface (CRI) kind/bug labels Jan 17, 2025
Comment thread internal/cri/server/podsandbox/sandbox_run.go Outdated
Comment thread internal/cri/server/podsandbox/sandbox_run.go Outdated
@AkihiroSuda
Copy link
Copy Markdown
Member

CI is failing

Comment thread internal/cri/server/podsandbox/sandbox_run.go Outdated
Comment thread internal/cri/server/podsandbox/sandbox_run.go Outdated
@fengwei0328 fengwei0328 force-pushed the dev2 branch 2 times, most recently from 5854bf3 to b05dbdf Compare January 23, 2025 06:09
@fengwei0328 fengwei0328 force-pushed the dev2 branch 2 times, most recently from 4d99780 to b8a320c Compare January 23, 2025 07:45
@fengwei0328
Copy link
Copy Markdown
Contributor Author

fengwei0328 commented Jan 23, 2025

CI is failing

All problems have been solved @AkihiroSuda @djdongjin

Comment thread internal/cri/server/podsandbox/sandbox_run.go Outdated
Copy link
Copy Markdown
Member

@djdongjin djdongjin left a comment

Choose a reason for hiding this comment

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

Left a few comments.

Also I didn't quite understand the issue. Why would setting ro option in a sandbox/pause container mount impact your container mount? And why fixing the sandbox mount also fix the issue in your container? Is it because when you launch a container, it inherient these mounts from the sandbox?

Comment thread internal/cri/server/podsandbox/sandbox_run.go Outdated
Comment thread integration/main_test.go
@fengwei0328
Copy link
Copy Markdown
Contributor Author

Also I didn't quite understand the issue. Why would setting ro option in a sandbox/pause container mount impact your container mount? And why fixing the sandbox mount also fix the issue in your container? Is it because when you launch a container, it inherient these mounts from the sandbox?

Even if the config.json of the container is set to rw, the container inherits the NetNS of the sandbox, so the mount property permissions of sysfs will not be higher than that of the sandbox.

{
  "destination": "/sys",
  "type": "sysfs",
  "source": "sysfs",
  "options": [
    "nosuid",
    "noexec",
    "nodev",
    "rw"
  ]
}

@djdongjin
Copy link
Copy Markdown
Member

/ok-to-test

Comment thread integration/container_stats_test.go Outdated
@fengwei0328 fengwei0328 force-pushed the dev2 branch 2 times, most recently from 53c560f to 2602220 Compare February 8, 2025 02:50
Copy link
Copy Markdown
Member

@djdongjin djdongjin left a comment

Choose a reason for hiding this comment

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

LGTM on CI green

@djdongjin
Copy link
Copy Markdown
Member

The CI failure is due to vagrantcloud throttling: #11364

pull-containerd-node-e2e failure seems k8s upstream flakiness. I saw it fails across multiple PRs.

@fengwei0328
Copy link
Copy Markdown
Contributor Author

@fengwei0328: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-containerd-node-e2e 1fc4972 link true /test pull-containerd-node-e2e
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

/retest

@fengwei0328
Copy link
Copy Markdown
Contributor Author

LGTM on CI green

PTAL, thanks! @AkihiroSuda @djdongjin

Copy link
Copy Markdown
Member

@djdongjin djdongjin left a comment

Choose a reason for hiding this comment

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

LGTM

@fengwei0328
Copy link
Copy Markdown
Contributor Author

PTAL, thanks! @AkihiroSuda

@AkihiroSuda AkihiroSuda added this pull request to the merge queue Feb 27, 2025
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Feb 27, 2025
@fengwei0328
Copy link
Copy Markdown
Contributor Author

Today, An error was generated with many PR in MacOS unit tests
Like this:
level=error msg="error flushing stderr" error="read |0: i/o timeout"

some PR:
#11444 #11360

@fengwei0328
Copy link
Copy Markdown
Contributor Author

added this pull request to the merge queue

Today, An error was generated with many PR in MacOS unit tests Like this: level=error msg="error flushing stderr" error="read |0: i/o timeout"

some PR: #11444 #11360

Problem seems to have been solved
Please Re-added this pull request to the merge queue
@AkihiroSuda

@AkihiroSuda AkihiroSuda added this pull request to the merge queue Feb 28, 2025
Merged via the queue into containerd:main with commit daf776c Feb 28, 2025
@github-project-automation github-project-automation Bot moved this from Review In Progress to Done in Pull Request Review Feb 28, 2025
@djdongjin
Copy link
Copy Markdown
Member

@AkihiroSuda should we cherrypick this to 2.0.x given it's a bug fix?

@AkihiroSuda
Copy link
Copy Markdown
Member

/cherry-pick release/2.0

@k8s-infra-cherrypick-robot
Copy link
Copy Markdown

@AkihiroSuda: new pull request created: #11456

Details

In response to this:

/cherry-pick release/2.0

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@champtar
Copy link
Copy Markdown
Contributor

champtar commented Mar 3, 2025

note: This fix aligns behavior with cri-o (cri-o/cri-o#2627) and with the spec,
BUT "fat" containers that have udevd in them might now run udevd (and some other services) if they where just checking if /sys is ro.
This is true for containers with debian + sysvinit + udev:

systemd doesn't seem to start udevd even if it has ConditionPathIsReadWrite=/sys, there is likely something else actually starting the unit (unit and sockets are static)

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

Labels

area/cri Container Runtime Interface (CRI) cherry-picked/2.0.x PR commits are cherry picked into the release/2.0 branch kind/bug ok-to-test size/L

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

privileged container's disk attribute is ro because the namespace of pause container is added

7 participants