forked from msys2/MSYS2-packages
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
msys2-runtime: update to c8a785a36ea04007da7119b867874a5e8cd9045c
Signed-off-by: Johannes Schindelin <[email protected]>
- Loading branch information
Showing
7 changed files
with
430 additions
and
6 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
msys2-runtime/0056-fixup-Avoid-sharing-cygheaps-across-Cygwin-versions.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
From 25700873e499a7611158f6cd50511d028d37adda Mon Sep 17 00:00:00 2001 | ||
From: Johannes Schindelin <[email protected]> | ||
Date: Thu, 26 Dec 2024 11:40:02 +0100 | ||
Subject: [PATCH 56/N] fixup! Avoid sharing cygheaps across Cygwin versions | ||
|
||
There was a spurious double-quote in the error message that is shown | ||
when the commit could not be determined. | ||
|
||
Signed-off-by: Johannes Schindelin <[email protected]> | ||
--- | ||
winsup/configure.ac | 2 +- | ||
1 file changed, 1 insertion(+), 1 deletion(-) | ||
|
||
diff --git a/winsup/configure.ac b/winsup/configure.ac | ||
index 0fc607a..4dd5ccb 100644 | ||
--- a/winsup/configure.ac | ||
+++ b/winsup/configure.ac | ||
@@ -74,7 +74,7 @@ yes|auto) | ||
MSYS2_RUNTIME_COMMIT_SHORT="$(expr "$MSYS2_RUNTIME_COMMIT" : '\(.\{,8\}\)')" | ||
MSYS2_RUNTIME_COMMIT_HEX="0x${MSYS2_RUNTIME_COMMIT_SHORT}ul" | ||
else | ||
- AC_MSG_WARN([Could not determine msys2-runtime commit"]) | ||
+ AC_MSG_WARN([Could not determine msys2-runtime commit]) | ||
MSYS2_RUNTIME_COMMIT= | ||
MSYS2_RUNTIME_COMMIT_SHORT= | ||
MSYS2_RUNTIME_COMMIT_HEX=0 |
75 changes: 75 additions & 0 deletions
75
msys2-runtime/0057-Revert-Cygwin-signal-Do-not-handle-signal-when-__SIG.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
From 674137e51c7739707af23e04b9bb78df760746b0 Mon Sep 17 00:00:00 2001 | ||
From: Takashi Yano <[email protected]> | ||
Date: Tue, 21 Jan 2025 12:15:33 +0900 | ||
Subject: [PATCH 57/N] Revert "Cygwin: signal: Do not handle signal when | ||
__SIGFLUSHFAST is sent" | ||
|
||
This reverts commit a22a0ad7c4f0 to apply a new patch for the same | ||
purpose. | ||
|
||
Signed-off-by: Takashi Yano <[email protected]> | ||
--- | ||
winsup/cygwin/release/3.5.6 | 5 ----- | ||
winsup/cygwin/sigproc.cc | 20 +++++--------------- | ||
2 files changed, 5 insertions(+), 20 deletions(-) | ||
delete mode 100644 winsup/cygwin/release/3.5.6 | ||
|
||
diff --git a/winsup/cygwin/release/3.5.6 b/winsup/cygwin/release/3.5.6 | ||
deleted file mode 100644 | ||
index 643d58e..0000000 | ||
--- a/winsup/cygwin/release/3.5.6 | ||
+++ /dev/null | ||
@@ -1,5 +0,0 @@ | ||
-Fixes: | ||
------- | ||
- | ||
-- Fix zsh hang at startup. | ||
- Addresses: https://cygwin.com/pipermail/cygwin/2024-December/256954.html | ||
diff --git a/winsup/cygwin/sigproc.cc b/winsup/cygwin/sigproc.cc | ||
index c298527..cf43aa9 100644 | ||
--- a/winsup/cygwin/sigproc.cc | ||
+++ b/winsup/cygwin/sigproc.cc | ||
@@ -751,14 +751,10 @@ sig_send (_pinfo *p, siginfo_t& si, _cygtls *tls) | ||
res = WriteFile (sendsig, leader, packsize, &nb, NULL); | ||
if (!res || packsize == nb) | ||
break; | ||
- if (cygwait (NULL, 10, cw_sig_eintr) == WAIT_SIGNALED | ||
- && pack.si.si_signo != __SIGFLUSHFAST) | ||
+ if (cygwait (NULL, 10, cw_sig_eintr) == WAIT_SIGNALED) | ||
_my_tls.call_signal_handler (); | ||
res = 0; | ||
} | ||
- /* Re-assert signal_arrived which has been cleared in cygwait(). */ | ||
- if (_my_tls.sig) | ||
- _my_tls.set_signal_arrived (); | ||
|
||
if (!res) | ||
{ | ||
@@ -789,16 +785,7 @@ sig_send (_pinfo *p, siginfo_t& si, _cygtls *tls) | ||
if (wait_for_completion) | ||
{ | ||
sigproc_printf ("Waiting for pack.wakeup %p", pack.wakeup); | ||
- do | ||
- { | ||
- rc = cygwait (pack.wakeup, WSSC, cw_sig_eintr); | ||
- if (rc == WAIT_SIGNALED && pack.si.si_signo != __SIGFLUSHFAST) | ||
- _my_tls.call_signal_handler (); | ||
- } | ||
- while (rc != WAIT_OBJECT_0 && rc != WAIT_TIMEOUT); | ||
- /* Re-assert signal_arrived which has been cleared in cygwait(). */ | ||
- if (_my_tls.sig) | ||
- _my_tls.set_signal_arrived (); | ||
+ rc = cygwait (pack.wakeup, WSSC); | ||
ForceCloseHandle (pack.wakeup); | ||
} | ||
else | ||
@@ -819,6 +806,9 @@ sig_send (_pinfo *p, siginfo_t& si, _cygtls *tls) | ||
rc = -1; | ||
} | ||
|
||
+ if (wait_for_completion && si.si_signo != __SIGFLUSHFAST) | ||
+ _my_tls.call_signal_handler (); | ||
+ | ||
out: | ||
if (communing && rc) | ||
{ |
143 changes: 143 additions & 0 deletions
143
msys2-runtime/0058-Cygwin-cygwait-Make-cygwait-reentrant.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,143 @@ | ||
From 16b83734dabb2fa5dfeaf30caaf62e4fac599b44 Mon Sep 17 00:00:00 2001 | ||
From: Takashi Yano <[email protected]> | ||
Date: Mon, 20 Jan 2025 23:54:56 +0900 | ||
Subject: [PATCH 58/N] Cygwin: cygwait: Make cygwait() reentrant | ||
|
||
To allow cygwait() to be called in the signal handler, a locally | ||
created timer is used instead of _cygtls::locals.cw_timer if it is | ||
in use. | ||
|
||
Co-Authored-By: Corinna Vinschen <[email protected]> | ||
Signed-off-by: Takashi Yano <[email protected]> | ||
(cherry picked from commit ea1914000adcbed5c16fc0ba2676173b2f6016c4) | ||
--- | ||
winsup/cygwin/cygtls.cc | 2 ++ | ||
winsup/cygwin/cygwait.cc | 22 +++++++++++++++------- | ||
winsup/cygwin/local_includes/cygtls.h | 3 ++- | ||
winsup/cygwin/select.cc | 10 +++++++++- | ||
4 files changed, 28 insertions(+), 9 deletions(-) | ||
|
||
diff --git a/winsup/cygwin/cygtls.cc b/winsup/cygwin/cygtls.cc | ||
index afaee8e..b8b5a01 100644 | ||
--- a/winsup/cygwin/cygtls.cc | ||
+++ b/winsup/cygwin/cygtls.cc | ||
@@ -64,6 +64,7 @@ _cygtls::init_thread (void *x, DWORD (*func) (void *, void *)) | ||
initialized = CYGTLS_INITIALIZED; | ||
errno_addr = &(local_clib._errno); | ||
locals.cw_timer = NULL; | ||
+ locals.cw_timer_inuse = false; | ||
locals.pathbufs.clear (); | ||
|
||
if ((void *) func == (void *) cygthread::stub | ||
@@ -85,6 +86,7 @@ _cygtls::fixup_after_fork () | ||
signal_arrived = NULL; | ||
locals.select.sockevt = NULL; | ||
locals.cw_timer = NULL; | ||
+ locals.cw_timer_inuse = false; | ||
locals.pathbufs.clear (); | ||
wq.thread_ev = NULL; | ||
} | ||
diff --git a/winsup/cygwin/cygwait.cc b/winsup/cygwin/cygwait.cc | ||
index dbbe1db..bb653f6 100644 | ||
--- a/winsup/cygwin/cygwait.cc | ||
+++ b/winsup/cygwin/cygwait.cc | ||
@@ -58,16 +58,20 @@ cygwait (HANDLE object, PLARGE_INTEGER timeout, unsigned mask) | ||
} | ||
|
||
DWORD timeout_n; | ||
+ HANDLE local_timer = NULL; | ||
+ HANDLE &wait_timer = | ||
+ _my_tls.locals.cw_timer_inuse ? local_timer : _my_tls.locals.cw_timer; | ||
if (!timeout) | ||
timeout_n = WAIT_TIMEOUT + 1; | ||
else | ||
{ | ||
+ if (!_my_tls.locals.cw_timer_inuse) | ||
+ _my_tls.locals.cw_timer_inuse = true; | ||
timeout_n = WAIT_OBJECT_0 + num++; | ||
- if (!_my_tls.locals.cw_timer) | ||
- NtCreateTimer (&_my_tls.locals.cw_timer, TIMER_ALL_ACCESS, NULL, | ||
- NotificationTimer); | ||
- NtSetTimer (_my_tls.locals.cw_timer, timeout, NULL, NULL, FALSE, 0, NULL); | ||
- wait_objects[timeout_n] = _my_tls.locals.cw_timer; | ||
+ if (!wait_timer) | ||
+ NtCreateTimer (&wait_timer, TIMER_ALL_ACCESS, NULL, NotificationTimer); | ||
+ NtSetTimer (wait_timer, timeout, NULL, NULL, FALSE, 0, NULL); | ||
+ wait_objects[timeout_n] = wait_timer; | ||
} | ||
|
||
while (1) | ||
@@ -100,7 +104,7 @@ cygwait (HANDLE object, PLARGE_INTEGER timeout, unsigned mask) | ||
{ | ||
TIMER_BASIC_INFORMATION tbi; | ||
|
||
- NtQueryTimer (_my_tls.locals.cw_timer, TimerBasicInformation, &tbi, | ||
+ NtQueryTimer (wait_timer, TimerBasicInformation, &tbi, | ||
sizeof tbi, NULL); | ||
/* if timer expired, TimeRemaining is negative and represents the | ||
system uptime when signalled */ | ||
@@ -108,7 +112,11 @@ cygwait (HANDLE object, PLARGE_INTEGER timeout, unsigned mask) | ||
timeout->QuadPart = tbi.SignalState || tbi.TimeRemaining.QuadPart < 0LL | ||
? 0LL : tbi.TimeRemaining.QuadPart; | ||
} | ||
- NtCancelTimer (_my_tls.locals.cw_timer, NULL); | ||
+ NtCancelTimer (wait_timer, NULL); | ||
+ if (local_timer) | ||
+ NtClose(local_timer); | ||
+ else | ||
+ _my_tls.locals.cw_timer_inuse = false; | ||
} | ||
|
||
if (res == WAIT_CANCELED && is_cw_cancel_self) | ||
diff --git a/winsup/cygwin/local_includes/cygtls.h b/winsup/cygwin/local_includes/cygtls.h | ||
index e4e3889..4bd79c3 100644 | ||
--- a/winsup/cygwin/local_includes/cygtls.h | ||
+++ b/winsup/cygwin/local_includes/cygtls.h | ||
@@ -135,6 +135,7 @@ struct _local_storage | ||
|
||
/* thread.cc */ | ||
HANDLE cw_timer; | ||
+ bool cw_timer_inuse; | ||
|
||
tls_pathbuf pathbufs; | ||
char ttybuf[32]; | ||
@@ -180,7 +181,7 @@ public: /* Do NOT remove this public: line, it's a marker for gentls_offsets. */ | ||
siginfo_t *sigwait_info; | ||
HANDLE signal_arrived; | ||
bool will_wait_for_signal; | ||
-#if 0 | ||
+#if 1 | ||
long __align; /* Needed to align context to 16 byte. */ | ||
#endif | ||
/* context MUST be aligned to 16 byte, otherwise RtlCaptureContext fails. | ||
diff --git a/winsup/cygwin/select.cc b/winsup/cygwin/select.cc | ||
index bc02c3f..48e811e 100644 | ||
--- a/winsup/cygwin/select.cc | ||
+++ b/winsup/cygwin/select.cc | ||
@@ -385,10 +385,14 @@ next_while:; | ||
to create the timer once per thread. Since WFMO checks the handles | ||
in order, we append the timer as last object, otherwise it's preferred | ||
over actual events on the descriptors. */ | ||
- HANDLE &wait_timer = _my_tls.locals.cw_timer; | ||
+ HANDLE local_timer = NULL; | ||
+ HANDLE &wait_timer = | ||
+ _my_tls.locals.cw_timer_inuse ? local_timer : _my_tls.locals.cw_timer; | ||
if (us > 0LL) | ||
{ | ||
NTSTATUS status; | ||
+ if (!_my_tls.locals.cw_timer_inuse) | ||
+ _my_tls.locals.cw_timer_inuse = true; | ||
if (!wait_timer) | ||
{ | ||
status = NtCreateTimer (&wait_timer, TIMER_ALL_ACCESS, NULL, | ||
@@ -431,6 +435,10 @@ next_while:; | ||
{ | ||
BOOLEAN current_state; | ||
NtCancelTimer (wait_timer, ¤t_state); | ||
+ if (local_timer) | ||
+ NtClose (local_timer); | ||
+ else | ||
+ _my_tls.locals.cw_timer_inuse = false; | ||
} | ||
|
||
wait_states res; |
63 changes: 63 additions & 0 deletions
63
msys2-runtime/0059-Cygwin-signal-Do-not-handle-signal-when-__SIGFLUSHFA.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
From ae26e1742aab63051e6dd790de4e5a516e3ef854 Mon Sep 17 00:00:00 2001 | ||
From: Takashi Yano <[email protected]> | ||
Date: Tue, 21 Jan 2025 00:13:04 +0900 | ||
Subject: [PATCH 59/N] Cygwin: signal: Do not handle signal when | ||
__SIGFLUSHFAST is sent | ||
|
||
The commit a22a0ad7c4f0 was not entirely correct. Even with the patch, | ||
some hangs still occur. This patch overrides the previous commit along | ||
with the patch that makes cygwait() reentrant, to fix these hangs. | ||
|
||
Addresses: https://cygwin.com/pipermail/cygwin/2024-December/256954.html | ||
Fixes: d243e51ef1d3 ("Cygwin: signal: Fix deadlock between main thread and sig thread") | ||
Reported-by: Daisuke Fujimura <[email protected]> | ||
Reviewed-by: Corinna Vinschen <[email protected]> | ||
Signed-off-by: Takashi Yano <[email protected]> | ||
(cherry picked from commit 83afe3e238cd12fb7d4799ba6b3c77e9e3618d91) | ||
--- | ||
winsup/cygwin/sigproc.cc | 11 +++++------ | ||
1 file changed, 5 insertions(+), 6 deletions(-) | ||
|
||
diff --git a/winsup/cygwin/sigproc.cc b/winsup/cygwin/sigproc.cc | ||
index cf43aa9..858a7fd 100644 | ||
--- a/winsup/cygwin/sigproc.cc | ||
+++ b/winsup/cygwin/sigproc.cc | ||
@@ -742,6 +742,9 @@ sig_send (_pinfo *p, siginfo_t& si, _cygtls *tls) | ||
memcpy (p, si._si_commune._si_str, n); p += n; | ||
} | ||
|
||
+ unsigned cw_mask; | ||
+ cw_mask = pack.si.si_signo == __SIGFLUSHFAST ? 0 : cw_sig_restart; | ||
+ | ||
DWORD nb; | ||
BOOL res; | ||
/* Try multiple times to send if packsize != nb since that probably | ||
@@ -751,8 +754,7 @@ sig_send (_pinfo *p, siginfo_t& si, _cygtls *tls) | ||
res = WriteFile (sendsig, leader, packsize, &nb, NULL); | ||
if (!res || packsize == nb) | ||
break; | ||
- if (cygwait (NULL, 10, cw_sig_eintr) == WAIT_SIGNALED) | ||
- _my_tls.call_signal_handler (); | ||
+ cygwait (NULL, 10, cw_mask); | ||
res = 0; | ||
} | ||
|
||
@@ -785,7 +787,7 @@ sig_send (_pinfo *p, siginfo_t& si, _cygtls *tls) | ||
if (wait_for_completion) | ||
{ | ||
sigproc_printf ("Waiting for pack.wakeup %p", pack.wakeup); | ||
- rc = cygwait (pack.wakeup, WSSC); | ||
+ rc = cygwait (pack.wakeup, WSSC, cw_mask); | ||
ForceCloseHandle (pack.wakeup); | ||
} | ||
else | ||
@@ -806,9 +808,6 @@ sig_send (_pinfo *p, siginfo_t& si, _cygtls *tls) | ||
rc = -1; | ||
} | ||
|
||
- if (wait_for_completion && si.si_signo != __SIGFLUSHFAST) | ||
- _my_tls.call_signal_handler (); | ||
- | ||
out: | ||
if (communing && rc) | ||
{ |
Oops, something went wrong.