public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin@cygwin.com
Subject: Re: Segmentation fault before main
Date: Fri, 30 Oct 2015 21:23:00 -0000	[thread overview]
Message-ID: <20151030191826.GQ5319@calimero.vinschen.de> (raw)
In-Reply-To: <56338BCC.40709@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2680 bytes --]

On Oct 30 16:25, Marco Atzeri wrote:
> Hi Corinna,
> 
> as mention some time ago, testing netcdf 4.4.0 release candidates
> I see a puzzling SIGSEGV before reaching main, so something goes wrong
> on cygwin loading/inizialization of the program.
> 
> It happens in a simple test programs that is linked to
> cygnetcdf-7.dll and its only job is to create a test file
> called ctest0.nc.
> 
> Previous 4.3.3.1 test case runs fine.
> The new ctest.c fails both with the new and with the old library.
> Test case and binaries are here :
>   http://matzeri.altervista.org/works/segfault/
> 
> $ gcc ctest.c -o ctest.exe -lnetcdf
> 
> $ gdb ./ctest.exe
> (gdb) break main
> Breakpoint 1 at 0x100401171
> (gdb) run
> Starting program: /cygdrive/e/cyg_pub/devel/netcdf/tests/ctest-440.exe
> [New Thread 8404.0x18f4]
> [New Thread 8404.0xa8c]
> [New Thread 8404.0x2270]
> 
> Program received signal SIGSEGV, Segmentation fault.
> ___chkstk_ms () at
> /usr/src/debug/gcc-4.9.3-1/libgcc/config/i386/cygwin.S:146
> 146             orq     $0x0, (%rcx)            /* probe there */
> 
> 
> $ uname -svrm
> CYGWIN_NT-6.1 2.2.1(0.289/5/3) 2015-08-20 11:42 x86_64
> 
> 
> libnetcdf-devel                         4.3.3.1-2
> libnetcdf7                              4.3.3.1-2
> netcdf                                  4.3.3.1-2
> netcdf-debuginfo                        4.3.3.1-2
> 
> 
> Unfortunately I have no clue about this code:
> 
> /* ___chkstk_ms is a *special* function call, which uses %rax as the
> argument.
>    We avoid clobbering any registers.  Unlike ___chkstk, it just probes the
>    stack and does no stack allocation.  */
>         .global ___chkstk_ms
> #ifdef __x86_64__
>         cfi_startproc()
> ___chkstk_ms:
>         pushq   %rcx                    /* save temps */
>         cfi_push(%rcx)
>         pushq   %rax
>         cfi_push(%rax)
>         cmpq    $0x1000, %rax           /* > 4k ?*/
>         leaq    24(%rsp), %rcx          /* point past return addr */
>         jb      2f
> 
> 1:      subq    $0x1000, %rcx           /* yes, move pointer down 4k */
>         orq     $0x0, (%rcx)            /* probe there */
> 
> Any help will be really appreciated.

Well, it's a stack probe.  It's typically called when trying to allocate
big datastructures on the stack, e.g. with alloca.  Did you try to raise
the default stacksize in the executable header (see peflags -x and -X
options).  There's not much else to work with...


HTH,
Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

[-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --]

  reply	other threads:[~2015-10-30 19:18 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-30 19:18 Marco Atzeri
2015-10-30 21:23 ` Corinna Vinschen [this message]
2015-10-31 16:47   ` Marco Atzeri
2015-11-04 21:42     ` Marco Atzeri
2015-11-05  8:49       ` Csaba Raduly
2015-11-05 13:11         ` Marco Atzeri
2015-11-05  9:21       ` Corinna Vinschen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20151030191826.GQ5319@calimero.vinschen.de \
    --to=corinna-cygwin@cygwin.com \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).