X-Recipient: archive-cygwin@delorie.com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:date:from:to:subject:message-id:reply-to
	:references:mime-version:content-type:in-reply-to; q=dns; s=
	default; b=XiYxxQWP4vYt8HMY7qiokOuyuj1mu1nt5eNr4+CixoLBFiHgjUZZN
	Q0rHaZE3PTVdof7tWN2bPVAyWNRmvSHIDHU4KBc16VZG8PU4mJjM//SAzn9/WV/N
	LooYQ8jQaDoPPogT2Jo/4uNRmVO9BNvNQ0LTz/+9HdR4uDaS1SLA/M=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:date:from:to:subject:message-id:reply-to
	:references:mime-version:content-type:in-reply-to; s=default;
	 bh=j8TdQPKSUKMOYS+YfNdg0lzkZVE=; b=UDByi5w2g8Mq7jooYnU+uRsdEp9M
	Y0F8DM6p/0HZuURylO8t6NxNNAYencv15GlWXIiHYgXXc6+7dy2SG764n5eYDefH
	nIFUnT54kMLn1NLtA9KcI9ksQ0cD0TANqz6rCy5DLcSGaeUZqwNJUvaantj5LEqq
	31yTZXC6uITIdiU=
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-5.4 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY autolearn=no version=3.3.2
X-HELO: calimero.vinschen.de
Date: Fri, 30 Oct 2015 20:18:26 +0100
From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin@cygwin.com
Subject: Re: Segmentation fault before main
Message-ID: <20151030191826.GQ5319@calimero.vinschen.de>
Reply-To: cygwin@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
References: <56338BCC.40709@gmail.com>
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha256;	protocol="application/pgp-signature"; boundary="yTfYsguFsV8cp5cf"
Content-Disposition: inline
In-Reply-To: <56338BCC.40709@gmail.com>
User-Agent: Mutt/1.5.23 (2014-03-12)

--yTfYsguFsV8cp5cf
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Oct 30 16:25, Marco Atzeri wrote:
> Hi Corinna,
>=20
> 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.
>=20
> 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.
>=20
> 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/
>=20
> $ gcc ctest.c -o ctest.exe -lnetcdf
>=20
> $ 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]
>=20
> 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 */
>=20
>=20
> $ uname -svrm
> CYGWIN_NT-6.1 2.2.1(0.289/5/3) 2015-08-20 11:42 x86_64
>=20
>=20
> 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
>=20
>=20
> Unfortunately I have no clue about this code:
>=20
> /* ___chkstk_ms is a *special* function call, which uses %rax as the
> argument.
>    We avoid clobbering any registers.  Unlike ___chkstk, it just probes t=
he
>    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
>=20
> 1:      subq    $0x1000, %rcx           /* yes, move pointer down 4k */
>         orq     $0x0, (%rcx)            /* probe there */
>=20
> 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

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

--yTfYsguFsV8cp5cf
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAEBCAAGBQJWM8KCAAoJEPU2Bp2uRE+gotEP/jnHUDlwqpuTZymX3S64vLm9
yOwRiJuqEbuyGPzPw/TIpBbqdlDayzxvZVVmkHBk/sV101DymxT2XvV3lRVobKtx
eKW2Oq8IcPibvdmVI+5vqGY/0QEmd3J62Lt7P+dhFGeMR2PXJlgfaNWjUgXN4rxh
5E0O3/YKkv1UfW8SD89drmMxH688ww4HeDa0tQH+uJ5UDTW4yUCjBdZEzPnMiJYd
lXnFf3ErLPhvOA78jcS373QRZ9bgMyuTm239q5fL1SN1sHm6vKqMxNRj57FzSPcV
LEcf1UlK7GrXvz50QtZlm3mz3irIr1nz5wCUAVHOmye4qOhoRODBzwHoZV+fc0UT
y7tiXzj6Fm0xtvamej2q0UbgRqCvyRgueyg+0wwgMyiu6Iy1ZFXdoXUxFAb+5rt/
ugCs2mFy5B8dDu5392hg4zD6+9Slqag8yNyjLvYVuCv0pz/8Gc9U4VaPL2l0Xwl0
XomUFZX6NyCSVTsmyHrGRZiR0bd0qjmYaBvsCWjl/uE/zW0TbFkm2wb+M4WGI+lQ
o26uWb9CvbZTlHK2j8tsVX3fVKp/IP12PsbIRcgpHmSdntwvLuDdc4tfcpDqCF/n
qqi875N4/BX05NpEoTgsWe1az5LRmcLSHIMVDwdBh/nWLsmt+cBdZfKEFDJKYhv+
fLSwrCSzCc2HmKimD2a4
=VCqr
-----END PGP SIGNATURE-----

--yTfYsguFsV8cp5cf--
