-
Notifications
You must be signed in to change notification settings - Fork 2.3k
libct: close the mount source fd ASAP! #5177
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -104,7 +104,27 @@ function setup_idmap_single_mount() { | |
|
|
||
| function setup_idmap_basic_mount() { | ||
| mountname="${1:-1}" | ||
| setup_idmap_single_mount 0:100000:65536 0:100000:65536 "$mountname" | ||
| destname="${2:-}" | ||
| setup_idmap_single_mount 0:100000:65536 0:100000:65536 "$mountname" "$destname" | ||
| } | ||
|
Comment on lines
+107
to
+109
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why are you changing this? It's not really need it in the test, right?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is necessary because I need to mount to more than three target directories within the container. |
||
|
|
||
| @test "Check mount source fds are cleaned up with idmapped mounts [userns]" { | ||
| setup_idmap_userns | ||
| for i in {1..10}; do | ||
| setup_idmap_basic_mount 1 "1$i" | ||
| setup_idmap_basic_mount 2 "2$i" | ||
| done | ||
|
|
||
| update_config '.process.args = ["sh", "-c", "stat -c =%u=%g= /tmp/mount-11/foo.txt"]' | ||
| update_config '.process.rlimits = [{ | ||
| "type": "RLIMIT_NOFILE", | ||
| "soft": 20, | ||
| "hard": 20 | ||
|
Comment on lines
+119
to
+122
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The test is using exactly 20, right? I think there are many things that can use fds and this might be flaky or failing in the future. But if this is important for your environment, I'm fine having it. If it causes CI issues in the future, we can decide then what to do
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Yes, the test explicitly adds 20 mounts. Before this patch, this would have caused a failure due to the limit. |
||
| }]' | ||
|
|
||
| runc run test_debian | ||
| [ "$status" -eq 0 ] | ||
| [[ "$output" == *"=0=0="* ]] | ||
| } | ||
|
|
||
| @test "simple idmap mount [userns]" { | ||
|
|
||
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.
nit: I think something like
doMountorapplyMountwould be a little less specific (I thinksetupAndMountToRootfsis too descriptive without telling you what stage in the process it is) but I don't really like any of those names to be honest... 🤔