This is the mail archive of the cygwin-patches mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] initialize variable for RtlLookupFunctionEntry


Hi,

for the records: The (random) situation leading to attached patch:

Reproducibly encountered the binutils-nm process falling into an
endless loop during some build process - but the reproducibility
depended on the length and/or the number of elements in the PATH
environment variable. Attaching with gdb shows endless wait for
tls::stacklock in _sigbe. More debugging outlines that nm first
received the expected SIGPIPE, but subsequently received SIGSEGV
while in the RtlLookupFunctionEntry windows function, causing no
signal handler to be finally executed, but returning to _sigbe.

The command in question (with longer PATH environment variable) was:
$ x86_64-pc-cygwin-nm -f posix -A /lib/libcygwin.a | sed 1q
It was important to locate nm via PATH, not with /path/to/nm.

Thanks!
/haubi/
>From b029e683e2a03879c3c1cee06bf6cd2af86b67d9 Mon Sep 17 00:00:00 2001
From: Michael Haubenwallner <michael.haubenwallner@ssi-schaefer.com>
Date: Mon, 9 Oct 2017 17:37:40 +0200
Subject: [PATCH] cygwin: initialize variable for stack unwinding

The third argument of RtlLookupFunctionEntry actually is documented as
_Inout_opt_ for both x64 and ARM, although generic doc says _Out_ only.

* exceptions.cc (__unwind_single_frame): Initialize hist variable.
---
 winsup/cygwin/exceptions.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc
index 743c73200..a3ee5cf71 100644
--- a/winsup/cygwin/exceptions.cc
+++ b/winsup/cygwin/exceptions.cc
@@ -280,7 +280,7 @@ __unwind_single_frame (PCONTEXT ctx)
 {
   PRUNTIME_FUNCTION f;
   ULONG64 imagebase;
-  UNWIND_HISTORY_TABLE hist;
+  UNWIND_HISTORY_TABLE hist = {0};
   DWORD64 establisher;
   PVOID hdl;
 
-- 
2.14.2


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]