-
Notifications
You must be signed in to change notification settings - Fork 609
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
Fix VMA handling for shmem maps #2022
Fix VMA handling for shmem maps #2022
Conversation
8ea5bbe
to
8e4550c
Compare
@imachug, can you take a look at these patches and confirm they work as expected on top of current criu-dev? Are you OK with the co-authored-by tag as it is? Also, can you suggest how test cases might be written? |
Hmm, I don't think this handles the case I described here? I'm a bit unsure if it's really a problem because I was thinking about the problem from a theoretical point of view, but do my concerns about this seem reasonable to you? |
Sorry, we may be misunderstanding each other. I meant does current criu-dev plus the patches here allow you to restore a containerized httpd via Podman as you mentioned in #1930? The problem of how to handle deleted files with only partial mappings across one or more processes can be discussed in #2019, but since it's currently a theoretical problem and there are no patches I don't think it should hold up the next CRIU release. |
Yes, it works. I'd rather you added a note that Co-Authored-By is fine by me. I don't think I can give an advice on the test cases except for running the whole hole test suite in podman and disabling the tests that seem to break due to permission errors? |
8e4550c
to
f6546e3
Compare
I've added the following text to the man-page in the unprivileged mode section:
|
Then maybe let's add a small check to fail the dump if the mmap'ed offset of a shared memory region is not 0? This would allow us to say "If it works, it works" instead of "It might or might not work and you'll never know which one it is" |
Codecov ReportBase: 70.73% // Head: 70.68% // Decreases project coverage by
📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more Additional details and impacted files@@ Coverage Diff @@
## criu-dev #2022 +/- ##
============================================
- Coverage 70.73% 70.68% -0.05%
============================================
Files 132 132
Lines 33120 33137 +17
============================================
- Hits 23428 23424 -4
- Misses 9692 9713 +21
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
I think our CI has to run zdtm.py from a sub-user-namespace. You can try to do something like this:
|
f6546e3
to
0236c51
Compare
Thanks. Needs
Not clear to me why the dumped process is being cleaned up under an interactive shell but not otherwise... but at least it effectively tests the patches here. Fails as expected on criu-dev, passes with these patches. |
0236c51
to
adb39ac
Compare
@imachug, I'm not clear on this. A non-zero offset for anonymous shared mappings is not allowed; do you mean we should check this for shared mappings backed by deleted files? If so, the current code will not fall back to
|
Yes, that was what I deemed the problem. I think you're right. Sorry for confusion. Deleted mappings should perhaps be addressed in a separate PR, if possible. I'm a bit iffy on trying to open a path ending with |
I have merged this pr, so let's do fixes on top. |
@ymanton I think the next command has to work:
The echo after zdtm doesn't allow bach to exec the last command and so it continues collecting zombies like init. |
e885358
to
9c1f939
Compare
|
4ec4018
to
bce7510
Compare
@ymanton could you try out this patch:
|
bce7510
to
89a672b
Compare
Thanks @avagin, it works in some cases, but it fails the same way as my previous attempt on Fedora. It fails on Ubuntu 20.04 because libcap doesn't know about I don't have easy access to Fedora, but I can get on a RHEL machine. I'll try to reproduce it there and see what's going on. |
|
89a672b
to
0cf19fa
Compare
Works on RHEL 9 as well. I got on a Fedora 37 VM and finally it fails like above. The error is from Lines 349 to 353 in 0965eab
When it fails it seems to be because the device number we get from For failing cases:
In working environments it looks like:
I do not know why this is, but comments near the top of If anyone thinks they know what is going on I would appreciate some info, otherwise I'll see if I can find an explanation. |
@ymanton could you show /proc/self/mountinfo from this host? It can be a btrfs issue. |
@avagin you're right, file is on btrfs.
Looks like this is a known issue: https://criu.org/Filesystems_pecularities Seems we should use something like |
0cf19fa
to
0640188
Compare
I think I've fixed the btrfs issue, and it looks like the test passes elsewhere but Fedora and Cent Stream still fail on restore; |
@adrianreber, any idea about the above? It works as expected when I run in unprivileged mode without using unshare, but for some reason cap_checkpoint_restore inside a namespace doesn't work as expected, and only on Fedora/Cent Stream. |
Is it selinux related? Can you switch to permissive to test it? |
0640188
to
388ad7c
Compare
Yeah that was it, works in Permissive mode, thanks. |
You could report it here: https://github.com/fedora-selinux/selinux-policy Ask to have the same access to clone3 and ns_last_pid in a user namespace. |
388ad7c
to
ec01921
Compare
Signed-off-by: Younes Manton <[email protected]>
ec01921
to
9e0d819
Compare
If we don't have access to map_files and instead have to get the data from /proc/$pid/mem we can close and reset the fd before passing it to do_dump_one_shmem() which can then check it before trying to seek past holes, eliminating the need for a separate seek_data_supported boolean. Signed-off-by: Younes Manton <[email protected]>
9e0d819
to
0ae799a
Compare
CAP_CHECKPOINT_RESTORE does not give access to /proc/$pid/map_files in user namespaces. In order to test that CRIU in unprivileged mode can dump and restore anonymous shared memory pages we will run the maps00 tests in a user namespace. Signed-off-by: Younes Manton <[email protected]>
If we can't access a map_files entry directly and instead have to follow the link and access the file via a filesystem path we need to properly deal with files on btrfs subvolumes. Signed-off-by: Younes Manton <[email protected]>
0ae799a
to
66f6ac4
Compare
Finally, all green. |
Merged. Thanks a lot! |
Patch originally written by @imachug to get httpd restored inside a container in unprivileged mode.
Fixes #2019.