mirror of
https://github.com/fluencelabs/musl
synced 2025-04-25 15:22:15 +00:00
fix breakage in synccall due to incorrect signal restoration in sigqueue
commit 07827d1a82fb33262f686eda959857f0d28cd8fa seems to have introduced this issue. sigqueue is called from the synccall core, at which time, even implementation-internal signals are blocked. however, pthread_sigmask removes the implementation-internal signals from the old mask before returning, so that a process which began life with them blocked will not be able to save a signal mask that has them blocked, possibly causing them to become re-blocked later. however, this was causing sigqueue to unblock the implementation-internal signals during synccall, leading to deadlock.
This commit is contained in:
parent
d0f0fa484c
commit
7cc49f98a2
@ -3,6 +3,7 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include "syscall.h"
|
#include "syscall.h"
|
||||||
|
#include "pthread_impl.h"
|
||||||
|
|
||||||
int sigqueue(pid_t pid, int sig, const union sigval value)
|
int sigqueue(pid_t pid, int sig, const union sigval value)
|
||||||
{
|
{
|
||||||
@ -14,9 +15,9 @@ int sigqueue(pid_t pid, int sig, const union sigval value)
|
|||||||
si.si_code = SI_QUEUE;
|
si.si_code = SI_QUEUE;
|
||||||
si.si_value = value;
|
si.si_value = value;
|
||||||
si.si_uid = getuid();
|
si.si_uid = getuid();
|
||||||
pthread_sigmask(SIG_BLOCK, (void *)(uint64_t[1]){-1}, &set);
|
__block_app_sigs(&set);
|
||||||
si.si_pid = getpid();
|
si.si_pid = getpid();
|
||||||
r = syscall(SYS_rt_sigqueueinfo, pid, sig, &si);
|
r = syscall(SYS_rt_sigqueueinfo, pid, sig, &si);
|
||||||
pthread_sigmask(SIG_SETMASK, &set, 0);
|
__restore_sigs(&set);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user