-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
[1.0] Fix failure with read-only /dev in spec #3277
Merged
kolyshkin
merged 3 commits into
opencontainers:release-1.0
from
kolyshkin:1.0-fix-ro-dev
Nov 29, 2021
Merged
[1.0] Fix failure with read-only /dev in spec #3277
kolyshkin
merged 3 commits into
opencontainers:release-1.0
from
kolyshkin:1.0-fix-ro-dev
Nov 29, 2021
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
kolyshkin
force-pushed
the
1.0-fix-ro-dev
branch
from
November 15, 2021 18:44
0f99754
to
7bf1ad5
Compare
Signed-off-by: Kailun Qin <kailun.qin@intel.com> (cherry picked from commit c508a7b) Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com> (cherry picked from commit f252eb5) Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Commit fb4c27c (went into v1.0.0-rc93) fixed a bug with read-only tmpfs, but introduced a bug with read-only /dev. This happens because /dev is a tmpfs mount and is therefore remounted read-only a bit earlier than before. To fix, 1. Revert the part of the above commit which remounts all tmpfs mounts as read-only in mountToRootfs. 2. Reuse finalizeRootfs (which is already used to remount /dev read-only) to also remount all ro tmpfs mounts that were previously mounted rw in mountPropagate. 3. Remove the break in finalizeRootfs, as now we have more than one mount to care about. 4. Reorder the if statements in finalizeRootfs to perform the fast check (for ro flag) first, and compare the strings second. Since /dev is most probably also a tmpfs mount, do the m.Device check first. Add a test case to validate the fix and prevent future regressions; make sure it fails before the fix: ✗ runc run [ro /dev mount] (in test file tests/integration/mounts.bats, line 45) `[ "$status" -eq 0 ]' failed runc spec (status=0): runc run test_busybox (status=1): time="2021-11-12T12:19:48-08:00" level=error msg="runc run failed: unable to start container process: error during container init: error mounting \"devpts\" to rootfs at \"/dev/pts\": mkdir /tmp/bats-run-VJXQk7/runc.0Fj70w/bundle/rootfs/dev/pts: read-only file system" Fixes: fb4c27c Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com> (cherry picked from commit b247cd3) Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
kolyshkin
force-pushed
the
1.0-fix-ro-dev
branch
from
November 16, 2021 21:51
7bf1ad5
to
cbb2367
Compare
#3276 merged |
cyphar
approved these changes
Nov 25, 2021
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
AkihiroSuda
approved these changes
Nov 26, 2021
thaJeztah
approved these changes
Nov 29, 2021
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
guess this can be moved out of draft, @kolyshkin
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a backport of #3276 to release-1.0 branch. Original description follows.
NOTE: draft pending merge of
#3282 and#3276.Commit fb4c27c (PR #2570, went into v1.0.0-rc93) fixed a bug with
read-only tmpfs, but introduced a bug with read-only /dev (#3248).
This happens because /dev is a tmpfs mount and is therefore remounted
read-only a bit earlier than before.
To fix,
Revert the part of the above commit which remounts all tmpfs mounts
as read-only in mountToRootfs.
Reuse finalizeRootfs (which is already used to remount /dev
read-only) to also remount all ro tmpfs mounts that were previously
mounted rw in mountPropagate.
Add a test case to validate the fix and prevent future regressions;
make sure it fails before the fix:
Fixes: #3248