delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2016/07/04/05:52:37

X-Recipient: archive-cygwin AT delorie DOT 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=Mivi5jAxc9mYYll4x06SCyp/NoRaHbxtchVsRSCy870pAcObgdAGh
YOFPWB3bHieux45it07+w6vYvYUlohs+FrykOIZg+4bC6hz/BH9TjxAz+JURbFrZ
hETqP1sI9eOlt0IhCbWi9/1ngTIcvfrnvtGrprVMAvViNnye5zrVTM=
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=3c4xAwhtSWqsTb+4W/Lpxkdvhpw=; b=GZqOkTDnB6Q5CtL0XgFsM7/29J6w
csW5+bL8y4q5GY0a8ZDDDPsedT6hs0wm04OVcbxndog9CIYaXDjikVRaDuoGhgP5
qTeWSrW9Y25kryBpRv56VRJH3hGbMKZjJdqjPFyy00BPyhrKVfSAOJZFGg1f6Ozf
HqI5cSjLLm+Mr8o=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-93.9 required=5.0 tests=AWL,BAYES_00,GOOD_FROM_CORINNA_CYGWIN,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_BRBL_LASTEXT,RCVD_IN_PBL,RCVD_IN_SORBS_DUL,RDNS_DYNAMIC autolearn=ham version=3.3.2 spammy=surrounding, screw, yeah, H*i:CALd
X-HELO: calimero.vinschen.de
Date: Mon, 4 Jul 2016 11:52:04 +0200
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: 64 bit Cywgin 2.5.2 on Wine: python fails with sem_init: Invalid argument
Message-ID: <20160704095204.GC13445@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <CALd+sZSpKSmsQCKt1DFQfAhRJ5OAY2CeafrsqKtN6Mf2zzywTg AT mail DOT gmail DOT com>
MIME-Version: 1.0
In-Reply-To: <CALd+sZSpKSmsQCKt1DFQfAhRJ5OAY2CeafrsqKtN6Mf2zzywTg@mail.gmail.com>
User-Agent: Mutt/1.6.1 (2016-04-27)

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

Hi Qian,

On Jul  4 10:45, Qian Hong wrote:
> Hi folks,
>=20
> When compiling 64 bit Cygwin on Wine, I found a python{2,3} failure
> when building documentation [1]:
>=20
> xmlto --skip-validation --with-dblatex pdf -o cygwin-ug-net/ -m
> /drone/src/github.com/cygwin/cygwin/winsup/doc/fo.xsl
> /drone/src/github.com/cygwin/cygwin/winsup/doc/cygwin-ug-net.xml
> sem_init: Invalid argument

What is python calling sem_init for here?!?  That means you need to
start cygserver just to build the Cygwin docs natively.  Oh well.

> [...]
> According to my previous experience this happens with previous version
> of Cygwin 64 bit on Wine, but works fine on Windows, and works fine on
> 32 bit Cygwin on Wine. I can't test latest git HEAD Cygwin version due
> to another known failure.

Yeah, Vista++ compatiblity...

> I tried to track down the problem, and I found during the call of
> sem_init(sem, pshared=3D0, value=3D1), in some case pshared and value were
> unexpectedly changed to large integers after
> verifyable_object_isvalid().
>=20
> I tried to reproduce with a simplified test case, and got the below
> code which behaviors wrong but not exactly in the same way:
>=20
> #include <unistd.h>
> #include <stdlib.h>
> #include <string.h>
> #include <semaphore.h>
> #include <pthread.h>
>=20
>=20
> int
> main(int argc, char *argv[])
> {
>     sem_t *p_sem =3D malloc(sizeof(sem_t));
>=20
>     memset(p_sem, 0xcc, sizeof(sem_t)); /* trigger exception handling
> code in Cygwin sem_init()-->verifyable_object_isvalid() */

This is perfectly valid.  The verifyable_object_isvalid code performs
an access check which results in an exception for invalid objects,
but which is catched by the surrounding __try/__except code.

>     sem_init(p_sem, 0, 1);
>=20
>     return 0;
> }
>=20
> Compiled using Cygwin gcc -pthread, The above code works fine on
> Cygwin on Windows and 32 bit Cygwin on Wine, but causes a stack
> overflow on 64 bit Cygwin on Wine. Unfortunately it does not fail
> exatly in the same way to Cygiwn python, but at least it brings some
> interesting question.

Stack overflow sounds weird.  The execption handling in Cygwin isn't
perfect, but an exception in verifyable_object_isvalid should not screw
up the stack.

> I think it is a Wine bug which does not handle exception correctly,
> and I'm trying to track down deeper. At the time could anyone provide
> some hint which piece of Cygwin code could I learn to write a pure
> Win32 test case emulating the above example?

Have a look at verifyable_object_isvalid in general, plus how the
exception handling in Cygwin on 64 bit works.  I'd suggest to take
a look into the implementation of the __try/__except macros in cygtls.h
and the exception::myfault handler in exceptions.cc.

> I also attached +seh log comparing 64 bit Cygwin and 32 bit Cygwin on
> Wine, which show the stackoverflow on 64 bit but handles fine on 32
> bit, hopefully that helps. I created a Wine bug on [2].

Puh, I admit that it doesn't help me much.  As a rough guess I'd say
that the unwinder failed to unwind correctly for some reason, but I also
freely admit that my knowledge on 64 bit unwinding is not exactly
complete.  I wouldn't exclude the possibility of a bug in Cygwin here.

May I point out http://www.nynaeve.net/?p=3D113, which is the last part
of a series on 64 bit exception handling and which has pointers to all
previous parts of the series.  It helped me much to get 64bit exception
handling in Cygwin going.


HTH,
Corinna

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

--u3/rZRmxL6MmkK24
Content-Type: application/pgp-signature; name="signature.asc"

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

iQIcBAEBCAAGBQJXejHDAAoJEPU2Bp2uRE+g4FkQAI+3Mtzaa+x1pfS/0Bu9zY/j
GNzxJAlAHHfATP51jY4nsBRspj3YhpY+j1ReYcjikLqEeqqS/i/XQUaJkcjHU13f
lJmWmzepAYjlKpKzGKSMazanWduN1SRpOyyw2FI/SaKogdyRGoyPXIm0QDTzIbjv
F0bQAFmNHY6UB8tRNCNKnvdTwr7Iva0b222zmTmQcU8sbEXkIlgubg0Cfrd/F0nL
Ys79+4go/+MMNzS5WjwWWPSuwbJE8dnTnit/Lo8cmffLvlfq9XQaPwlenHD4KWti
XN4R358zXCd3QHnIPkx0RTk3boHN0couTMukUHajwl3wwtuSworMAWpjYw+ecH5A
TT16EyoVhq/olSUjiltvRZB+K309ctEQGDYenZJ9c46bQjyuRZZ+K8emZ0ASYy5Q
jCCJLkiXFp1s5/ckRxZDNfDTza5miuHnZwGyaKyE4m0DXmk2TGiUegr0S9TPNTnD
B47g7+EK4arhqSPadAOkeTNAHnLxW7bMjmXlhlb59lFODWq871YIpa8o1nEG+UTw
1kQLgTS/CdYUehF+IuFqcww6lNEjn8C7177y3FYB7Qg+w6P3/a5pGIyL/qcYAWeg
3EWwvgsBIbkAmp8MQ7Pudikk3i/N9UknHYTnOPeniCnJGwCIVlkQG3oNavyrDeQN
MzKXuYnai5eiItoNyGk3
=XM3g
-----END PGP SIGNATURE-----

--u3/rZRmxL6MmkK24--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019