aboutsummaryrefslogtreecommitdiff
path: root/include/gcc-c-interface.h
diff options
context:
space:
mode:
authorTakashi Yano <takashi.yano@nifty.ne.jp>2024-11-29 16:46:48 +0900
committerTakashi Yano <takashi.yano@nifty.ne.jp>2024-12-06 19:13:04 +0900
commitd565aca46f06117ef16ec37c51767a5e140ee9e2 (patch)
tree296858c6c9f0ef6940471bf1154410a63eb4c74d /include/gcc-c-interface.h
parentf71550e0dbef51e0a4a706edae49c33c5372db19 (diff)
downloadnewlib-d565aca46f06117ef16ec37c51767a5e140ee9e2.zip
newlib-d565aca46f06117ef16ec37c51767a5e140ee9e2.tar.gz
newlib-d565aca46f06117ef16ec37c51767a5e140ee9e2.tar.bz2
Cygwin: signal: Remove queue entry from the queue chain when cleared
The queue is cleaned up by removing the entries having si_signo == 0 while processing the queued signals, however, sigpacket::process() may set si_signo in the queue to 0 of the entry already processed but not succeed by calling sig_clear(). This patch ensures the sig_clear() to remove the entry from the queue chain. For this purpose, the pointer prev has been added to the sigpacket. This is to handle the following case appropriately. Consider the queued signal chain of: A->B->C->D without pointer prev. Assume that the pointer 'q' and 'qnext' point to C, and process() is processing C. If B is cleared in process(), A->next should be set to to C in sigpacket::clear(). Then, if process() for C succeeds, C should be removed from the queue, so A->next should be set to D. However, we cannot do that because we do not have the pointer to A in the while loop in wait_sig(). With the pointer prev, we can easily access A and C in sigpacket::clear() as well as A and D in the while loop in wait_sig() using the pointer prev and next without pursuing the chain. Addresses: https://cygwin.com/pipermail/cygwin/2024-November/256744.html Fixes: 9d2155089e87 ("(wait_sig): Define variable q to be the start of the signal queue. Just iterate through sigq queue, deleting processed or zeroed signals") Reported-by: Christian Franke <Christian.Franke@t-online.de> Reviewed-by: Corinna Vinschen <corinna@vinschen.de> Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
Diffstat (limited to 'include/gcc-c-interface.h')
0 files changed, 0 insertions, 0 deletions