libcontainer/cgroups/fscommon: add openat2 support#2668
Merged
AkihiroSuda merged 2 commits intoopencontainers:masterfrom Dec 7, 2020
Merged
libcontainer/cgroups/fscommon: add openat2 support#2668AkihiroSuda merged 2 commits intoopencontainers:masterfrom
AkihiroSuda merged 2 commits intoopencontainers:masterfrom
Conversation
4 tasks
Contributor
Author
|
Rebased on top of #2666 to fix CI |
AkihiroSuda
requested changes
Oct 30, 2020
cyphar
reviewed
Oct 31, 2020
Contributor
Author
|
CI failure is shfmt that went crazy; caused by mvdan/sh#628. Restarted travis. |
Contributor
Author
Should be fixed by #2671 |
cyphar
reviewed
Nov 4, 2020
kolyshkin
commented
Nov 7, 2020
kolyshkin
commented
Nov 7, 2020
Contributor
Author
|
@AkihiroSuda @cyphar @mrunalp can you please re-review? I think I have addressed all concerns and review comments |
Contributor
Author
|
@AkihiroSuda @cyphar @mrunalp PTAL |
In case openat2 is available, it will be used to guarantee that we're not accessing anything other than cgroupfs[2] files. In cases when openat2 is not available, or when cgroup has a non-standard prefix (not "/sys/fs/cgroup", which might theoretically be the case on some very old installs and/or very custom systems), fall back to using securejoin + os.Open like we did before. Signed-off-by: Kir Kolyshkin <[email protected]>
In case we get ENOSYS from openat2(2), this is expected, so log that we're falling back to using securejoin as debug. Otherwise, log it as a warning (as the error is unexpected, but we're still good to go). Signed-off-by: Kir Kolyshkin <[email protected]>
AkihiroSuda
approved these changes
Dec 7, 2020
This file contains hidden or 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
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.
(based on previous work in PRs #2604, #2605, #2635; originally part of #2598)
In case
openat2is available, it will be used to guaranteethat we're not accessing anything other than cgroupfs[2] files.
In cases when
openat2is not available, or when cgroup has anon-standard prefix (not
"/sys/fs/cgroup", which might theoreticallybe the case on some very old installs and/or very custom systems),
fall back to using
securejoin+os.Openlike we did before.