mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-21 12:30:06 +00:00
Linux: Block signals around _Fork (bug 32215)
This hides the inconsistent TCB state (missing robust mutex list) from signal handlers. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
This commit is contained in:
parent
a7b5eb821d
commit
b300078d97
@ -22,6 +22,11 @@
|
||||
pid_t
|
||||
_Fork (void)
|
||||
{
|
||||
/* Block all signals to avoid revealing the inconsistent TCB state
|
||||
to a signal handler after fork. */
|
||||
internal_sigset_t original_sigmask;
|
||||
internal_signal_block_all (&original_sigmask);
|
||||
|
||||
pid_t pid = arch_fork (&THREAD_SELF->tid);
|
||||
if (pid == 0)
|
||||
{
|
||||
@ -44,6 +49,8 @@ _Fork (void)
|
||||
INTERNAL_SYSCALL_CALL (set_robust_list, &self->robust_head,
|
||||
sizeof (struct robust_list_head));
|
||||
}
|
||||
|
||||
internal_signal_restore_set (&original_sigmask);
|
||||
return pid;
|
||||
}
|
||||
libc_hidden_def (_Fork)
|
||||
|
Loading…
Reference in New Issue
Block a user