criu: Add support for pidfds
A PR for support of process file descriptors.
Here's a article that talks about features of pidfds, which we might have to support (and test): http://www.corsix.org/content/what-is-a-pidfd
To Do:
- [x] Check if the
pidofpidfdis part of the process tree we are dumping. So, that we can ensure it exists on restore. - [x] Add support for
pidfdsthat point to dead processes. (waiting for feedback) If the process for which a pidfd is open dies, the Pid and NSPid entries change to -1. So, we don't have the Pid necessary to recreate the process. We cannot just create a random process, open a pidfd to it, and kill it since pidfds opened for a specific process have the same inode number used to compare them. - [x] Change the magic in
criu/include/magic.h - [x] test for
pidfd_getfd - [x] Make CI green
- [x] Check functionality before and after 6.9
- [x] Better commit messages (add related issues that are fixed as a result of this PR)
Support for PIDFD_THREAD (allows creation of a pidfd that points to a specific thread) not a part of this PR.
Known Limitations: CRIU doesn't support nested PID namespaces. As such we cannot C/R pidfd's that point to PIDs in nested namespaces. If we introduce support for nested PID namespaces we will have to rework some of this code.
This is work being done as part of Google Summer of Code 2024 (https://summerofcode.withgoogle.com/programs/2024/projects/vgpqxIxx) A huge thank you to Alex @mihalicyn for guiding me and making this a wonderful experience :)
Better commit messages (add related issues that are fixed as a result of this PR)
@bsach64 The following blog post provides information on how to write good commit messages: https://cbea.ms/git-commit/
Similar to the Linux kernel, we use the commit history to make it easier for reviewers (and maintainers) to understand the problem that motivated particular patch and how this problem is being addressed.
Better commit messages (add related issues that are fixed as a result of this PR)
@bsach64 The following blog post provides information on how to write good commit messages: https://cbea.ms/git-commit/
Similar to the Linux kernel, we use the commit history to make it easier for reviewers (and maintainers) to understand the problem that motivated particular patch and how this problem is being addressed.
Hello @rst0git! I have updated the commit messages and have tried to follow the rules stated here: https://cbea.ms/git-commit/
I am having a hard time understanding why the Vagrant Fedora Rawhide and Vagrant Fedora Rawhide (No VDSO) fail on the pidfd_child test.
Can I get some help regarding this?
I am having a hard time understanding why the Vagrant Fedora Rawhide and Vagrant Fedora Rawhide (No VDSO) fail on the
pidfd_childtest. Can I get some help regarding this?
Fixed now! Vagrant Fedora Rawhide Test failure seems unrelated.
All tests pass for me locally on 6.10.4-200.fc40.x86_64!
@avagin Any update? :)
@mihalicyn could you help with reviewing this pr?
Hey @bsach64, if you have a time and interest, we can discuss support for threaded pidfds. Next week I'll be on LPC 2024, but just after that I'll be happy chat with you.
@mihalicyn could you help with reviewing this pr?
yeah, sorry, I just forgot to press an "approve" button earlier. As I was following a whole development process of this thing there is no doubt that it's approved/reviewed from my side :-)
Hey @bsach64, if you have a time and interest, we can discuss support for threaded pidfds.
Next week I'll be on LPC 2024, but just after that I'll be happy chat with you.
Sure Alex :) Please send me an email, whenever you are free!
LGTM. Good job.