aboutsummaryrefslogtreecommitdiff
path: root/winsup/cygwin/signal.cc
diff options
context:
space:
mode:
authorTakashi Yano <takashi.yano@nifty.ne.jp>2024-12-04 11:53:41 +0900
committerTakashi Yano <takashi.yano@nifty.ne.jp>2024-12-06 19:13:04 +0900
commit496fa7b2ce0052550eab8900723ebb59c33d25e7 (patch)
treee1f30fa47bc65137b29ffe3b2da8014f823436b1 /winsup/cygwin/signal.cc
parentd565aca46f06117ef16ec37c51767a5e140ee9e2 (diff)
downloadnewlib-496fa7b2ce0052550eab8900723ebb59c33d25e7.zip
newlib-496fa7b2ce0052550eab8900723ebb59c33d25e7.tar.gz
newlib-496fa7b2ce0052550eab8900723ebb59c33d25e7.tar.bz2
Cygwin: signal: Introduce a lock for the signal queue
Currently, the signal queue is touched by the thread sig as well as other threads that call sigaction_worker(). This potentially has a possibility to destroy the signal queue chain. A possible worst result may be a self-loop chain which causes infinite loop. With this patch, lock()/unlock() are introduce to avoid such a situation. Fixes: 474048c26edf ("* sigproc.cc (pending_signals::add): Just index directly into signal array rather than treating the array as a heap.") Suggested-by: Corinna Vinschen <corinna@vinschen.de> Reviewed-by: Corinna Vinschen <corinna@vinschen.de> Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
Diffstat (limited to 'winsup/cygwin/signal.cc')
-rw-r--r--winsup/cygwin/signal.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/winsup/cygwin/signal.cc b/winsup/cygwin/signal.cc
index a7af604..0bd6496 100644
--- a/winsup/cygwin/signal.cc
+++ b/winsup/cygwin/signal.cc
@@ -451,9 +451,9 @@ sigaction_worker (int sig, const struct sigaction *newact,
if (!(gs.sa_flags & SA_NODEFER))
gs.sa_mask |= SIGTOMASK(sig);
if (gs.sa_handler == SIG_IGN)
- sig_clear (sig);
+ sig_clear (sig, true);
if (gs.sa_handler == SIG_DFL && sig == SIGCHLD)
- sig_clear (sig);
+ sig_clear (sig, true);
if (sig == SIGCHLD)
{
myself->process_state &= ~PID_NOCLDSTOP;