[PATCH] initialize variable for RtlLookupFunctionEntry

Corinna Vinschen corinna@vinschen.de
Mon Oct 9 16:59:00 GMT 2017


On Oct  9 18:15, Michael Haubenwallner wrote:
> 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
> 

Pushed.


Thanks,
Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin-patches/attachments/20171009/9db199e1/attachment.sig>


More information about the Cygwin-patches mailing list