storage, overlay: use openat2 instead of using procfs#820
storage, overlay: use openat2 instead of using procfs#820mtrmac merged 2 commits intocontainers:mainfrom
Conversation
| Flags: unix.O_RDONLY | unix.O_CLOEXEC | unix.O_PATH, | ||
| Resolve: unix.RESOLVE_NO_SYMLINKS | unix.RESOLVE_BENEATH, | ||
| }) | ||
| if err != nil { |
There was a problem hiding this comment.
I'm thinking if we should be more specific here and only continue on certain errors. Previous code, using Getxattr for example returned an error in case the path did not exist or couldn't be opened, while the code introduced in this PR ignores these issues.
I don't have a strong opinion, just something to think about.
There was a problem hiding this comment.
you are right, we should ignore only ENOENT. I'll fix it
There was a problem hiding this comment.
Yes, this was previously noted by @cgwalters somewhere in #651 (although I can't find it now; github is terrible in that regard).
There was a problem hiding this comment.
Ah! There was also a comment from @cgwalters about RESOLVE_NO_SYMLINKS -- this might be a change in behavior here -- intermediate symlinks were followed before and are not followed now.
Or are we sure we do not use symlinks here at all?
There was a problem hiding this comment.
I think a reasonable reading of https://github.com/opencontainers/image-spec/blob/main/layer.md implies that layers never refer to files by paths that indirect through symlinks (and certainly that’s the only reasonable way to implement creating layers from diffs), but the spec doesn’t quite say so explicitly.
I’m personally very comfortable with enforcing that assumption .
|
LGTM once you address the issue with ignoring the openat2 errors (either by fixing or acknowledging in the comment). |
17aecd6 to
75ed086
Compare
the kernel accepts only few flags with O_PATH, these do not include O_RDONLY, it works only because `O_RDONLY == 0`. followup for containers#820 (comment) Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
75ed086 to
363943a
Compare
|
I assume this code path was not tested, my simple vendor PR is failing: Is it expected that we do not have any code coverage in the storage tests? should there be a overlay + composefs test here as part of the CI matrix? The O_PATH docs are clear that this wont work.
I opened a PR #824 |
No description provided.