Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/winsup
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2015-08-24 19:37:53 +0300
committerCorinna Vinschen <corinna@vinschen.de>2015-08-24 19:37:53 +0300
commitdbc1cae5c50e358fa820fd3bff41e0990943054f (patch)
tree9589693f6d533543598e08e311974a0b49d8d292 /winsup
parent986069c7e33029281cc6971d103850e2fa90f127 (diff)
Fix hang stracing forking processes but not following child
* ntdll.h (PROCESSINFOCLASS): Define ProcessDebugFlags. * sigproc.cc (child_info::child_info): Only propagate _CI_STRACED to child if strace is actually tracing child processes. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Diffstat (limited to 'winsup')
-rw-r--r--winsup/cygwin/ChangeLog6
-rw-r--r--winsup/cygwin/ntdll.h3
-rw-r--r--winsup/cygwin/release/2.2.214
-rw-r--r--winsup/cygwin/sigproc.cc16
4 files changed, 37 insertions, 2 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index e6b222322..1ec6c714b 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,5 +1,11 @@
2015-08-24 Corinna Vinschen <corinna@vinschen.de>
+ * ntdll.h (PROCESSINFOCLASS): Define ProcessDebugFlags.
+ * sigproc.cc (child_info::child_info): Only propagate _CI_STRACED to
+ child if strace is actually tracing child processes.
+
+2015-08-24 Corinna Vinschen <corinna@vinschen.de>
+
* include/cygwin/version.h (CYGWIN_VERSION_DLL_MINOR): Bump to 2.
2015-08-18 Corinna Vinschen <corinna@vinschen.de>
diff --git a/winsup/cygwin/ntdll.h b/winsup/cygwin/ntdll.h
index 8088e40a2..13a131deb 100644
--- a/winsup/cygwin/ntdll.h
+++ b/winsup/cygwin/ntdll.h
@@ -532,7 +532,8 @@ typedef enum _PROCESSINFOCLASS
ProcessTimes = 4,
ProcessSessionInformation = 24,
ProcessWow64Information = 26,
- ProcessImageFileName = 27
+ ProcessImageFileName = 27,
+ ProcessDebugFlags = 31
} PROCESSINFOCLASS;
/* Checked on 64 bit. */
diff --git a/winsup/cygwin/release/2.2.2 b/winsup/cygwin/release/2.2.2
new file mode 100644
index 000000000..eb2162b1e
--- /dev/null
+++ b/winsup/cygwin/release/2.2.2
@@ -0,0 +1,14 @@
+What's new:
+-----------
+
+
+What changed:
+-------------
+
+
+Bug Fixes
+---------
+
+- Fix a hang when stracing a forking or spawning process without activating
+ stracing of child processes.
+ Addresses: https://cygwin.com/ml/cygwin/2015-08/msg00390.html
diff --git a/winsup/cygwin/sigproc.cc b/winsup/cygwin/sigproc.cc
index 12f61d2fb..13392504b 100644
--- a/winsup/cygwin/sigproc.cc
+++ b/winsup/cygwin/sigproc.cc
@@ -772,7 +772,21 @@ child_info::child_info (unsigned in_cb, child_info_types chtype,
fhandler_union_cb = sizeof (fhandler_union);
user_h = cygwin_user_h;
if (strace.active ())
- flag |= _CI_STRACED;
+ {
+ NTSTATUS status;
+ ULONG DebugFlags;
+
+ /* Only propagate _CI_STRACED to child if strace is actually tracing
+ child processes of this process. The undocumented ProcessDebugFlags
+ returns 0 if EPROCESS->NoDebugInherit is TRUE, 1 otherwise.
+ This avoids a hang when stracing a forking or spawning process
+ with the -f flag set to "don't follow fork". */
+ status = NtQueryInformationProcess (GetCurrentProcess (),
+ ProcessDebugFlags, &DebugFlags,
+ sizeof (DebugFlags), NULL);
+ if (NT_SUCCESS (status) && DebugFlags)
+ flag |= _CI_STRACED;
+ }
if (need_subproc_ready)
{
subproc_ready = CreateEvent (&sec_all, FALSE, FALSE, NULL);