mirrored from git://git.sv.gnu.org/coreutils.git
-
Notifications
You must be signed in to change notification settings - Fork 894
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
Potential race condition #82
Comments
Well I repro'd with: - monitored_pid = fork ();
+ int tpid = fork ();
+ if (tpid) sleep(10); /* delay monitor */
+ monitored_pid = tpid; If you run |
Actually I think I see a related race. |
Fixed with commit ab4ffc8 |
hubot
pushed a commit
that referenced
this issue
Mar 12, 2024
* src/timeout.c (main): Block cleanup signals earlier so that cleanup() is not runnable until monitored_pid is in a deterministic state. This ensures we always send a termination signal to the child once it's forked. * NEWS: Mention the bug fix. Reported at #82
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
According to Execution of signals signal handler may be called whenever there's transition between kernel and user mode. fork() is a syscall, so there should be such transition when it returns here. cleanup() function is installed for the number of termination signals before fork(). So it seems like it might be possible that cleanup() is called between the moment when fork() has finished and monitored_pid is assigned. This would make cleanup() to _exit() here. Then child process would continue running as long as it wants instead of being terminated.
I wasn't able to reproduce this issue.
The text was updated successfully, but these errors were encountered: