-
Notifications
You must be signed in to change notification settings - Fork 584
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
pidfd: block SIGCHLD during tmp process creation #2491
base: criu-dev
Are you sure you want to change the base?
Conversation
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.
Thank you for the PR @rst0git!
I was about to raise one myself!
This patch blocks SIGCHLD during temporary process creation to prevent a race condition between kill() and waitpid() where sigchld_handler() causes `criu restore` to fail with an error. Fixes: checkpoint-restore#2490 Signed-off-by: Bhavik Sachdev <b.sachdev1904@gmail.com> Signed-off-by: Radostin Stoyanov <rstoyanov@fedoraproject.org>
Hi Radostin! Thanks a lot for looking into it! We had a call with Bhavik today and he wants to see if we can use pstree helpers to solve this problem. So, let's wait a bit with merging this. |
No worries, I just wanted to confirm that the pidfd_dead test will pass with these changes in CI.
I'm not sure how easy it would be to do that but the messages in the following commits might help: c09ba04 5f72963 |
*/ | ||
sigemptyset(&blockmask); | ||
sigaddset(&blockmask, SIGCHLD); | ||
if (sigprocmask(SIG_BLOCK, &blockmask, &dead->oldmask) == -1) { |
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.
sigprocmask should be called right before killing this process. If I remember it right, a process can be created in one process, but killed in another process.
This pull request updates pidfd to block
SIGCHLD
during temporary process creation to prevent a race condition betweenkill()
andwaitpid()
wheresigchld_handler()
causescriu restore
to fail with an error.Fixes: #2490