This repository has been archived by the owner on May 12, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 376
vc: do not follow symlink when umounting contanier host path #2475
Merged
+22
−2
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
So that if a guest changes it, we do not end up propergating the error. Fixes: kata-containers#2474 Signed-off-by: Peng Tao <bergwolf@hyper.sh>
devimc
approved these changes
Feb 19, 2020
/test |
Codecov Report
@@ Coverage Diff @@
## master #2475 +/- ##
=========================================
Coverage ? 50.79%
=========================================
Files ? 114
Lines ? 16381
Branches ? 0
=========================================
Hits ? 8321
Misses ? 7035
Partials ? 1025 |
Codecov Report
@@ Coverage Diff @@
## master #2475 +/- ##
=========================================
Coverage ? 50.78%
=========================================
Files ? 114
Lines ? 16392
Branches ? 0
=========================================
Hits ? 8325
Misses ? 7041
Partials ? 1026 |
lifupan
approved these changes
Feb 19, 2020
A malicious can trick us with a crafted container rootfs symlink and make runtime umount other mountpoints. Make sure we do not walk through symlinks when umounting. Signed-off-by: Peng Tao <bergwolf@hyper.sh>
/test |
laijs
reviewed
Feb 20, 2020
virtcontainers/mount.go
Outdated
if dest, err := filepath.EvalSymlinks(destination); err == nil && !strings.HasPrefix(dest, filepath.Clean(topDir)) { | ||
return fmt.Errorf("Invalid mount destination %s must not escape", destination) | ||
} | ||
|
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.
there is a "TOCTOU" here
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.
I dropped it as it also breaks vm template.
/test |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
So that if a guest changes it, we do not end up
propagating the error.
Fixes: #2474