delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2016/04/20/10:20:54

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:from:to:subject:date:message-id:references
:in-reply-to:content-type:content-transfer-encoding
:mime-version; q=dns; s=default; b=StmabnQcF4TgRmStAB39ieOw71nFK
HJkQDKE2QXA3rjFPoKS5j7psFlYemFqte75Lg+o2HYgcS9utUDNyhC/VXLn5lpOP
XUPvNenuRn0p7TOVuJDbSSLM+TcNBtYUX/Ag0vF/qVHvr+HJ61ZdD2wgpl8Bx7q5
yHGIR1G+GGDC3g=
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:from:to:subject:date:message-id:references
:in-reply-to:content-type:content-transfer-encoding
:mime-version; s=default; bh=INQ+IofSIjxIBmz//MGm5q+h6+c=; b=oyN
KnMJgdMaT1vlGGCijmBeNg+2PIoORbou0z2Pt5obJdFG0ZzoFTLZgXvrE+2DwqIs
7X3pKUuWenX90oGgFJq9wwMio233Xg71CQYMVRNVnoyqMkHG5JLoz9mT7eVa/oEM
SHh8z7eFBiJbuYN/RqRp54GW0A7X+oRlUJ/y4nxU=
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=-2.9 required=5.0 tests=BAYES_00,MIME_BASE64_BLANKS,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 spammy=D*jpl.nasa.gov, timothy DOT k DOT canham AT jpl DOT nasa DOT gov, U*timothy.k.canham, sk:timothy
X-HELO: mail.jpl.nasa.gov
From: "Canham, Timothy K (348C)" <timothy DOT k DOT canham AT jpl DOT nasa DOT gov>
To: "cygwin AT cygwin DOT com" <cygwin AT cygwin DOT com>
Subject: RE: pthread_attr_init() returning errors
Date: Wed, 20 Apr 2016 14:20:25 +0000
Message-ID: <E8EB3633A6A4594CA063A3FCBC82C18C3621FDE3@ap-embx-sp40.RES.AD.JPL>
References: <E8EB3633A6A4594CA063A3FCBC82C18C3621F0F6 AT ap-embx-sp40 DOT RES DOT AD DOT JPL> <20160420105016 DOT GB26118 AT calimero DOT vinschen DOT de>
In-Reply-To: <20160420105016.GB26118@calimero.vinschen.de>
MIME-Version: 1.0
X-Source-Sender: timothy DOT k DOT canham AT jpl DOT nasa DOT gov
X-AUTH: Authorized
X-MIME-Autoconverted: from base64 to 8bit by delorie.com id u3KEKpCs018189

So what you are saying is that when pthread_attr_init() checked for the magic number in supposedly uninitialized memory it found the exact value of the magic number? That seems highly suspect. Seems like it may be pointing to a valid previous entry.

Tim Canham
JPL Flight Software


-----Original Message-----
From: Corinna Vinschen [mailto:corinna-cygwin AT cygwin DOT com] 
Sent: Wednesday, April 20, 2016 3:50 AM
To: cygwin AT cygwin DOT com
Cc: Canham, Timothy K (348C) <timothy DOT k DOT canham AT jpl DOT nasa DOT gov>
Subject: Re: pthread_attr_init() returning errors

On Apr 19 19:49, Canham, Timothy K (348C) wrote:
> I have some code to start a task that suddenly started failing. This 
> is pretty mature code. Here is the code fragment with my added 
> printf()
> 
>         pthread_attr_t att;
>         int stat = pthread_attr_init(&att);
>         if (stat != 0) {
>             printf("pthread_attr_init: (%d)(%d): %s\n",stat,errno,strerror(stat));
>             // return
>         }
> 
> Here is the output:
> 
> pthread_attr_init: (16)(0): Device or resource busy

This is most unusual.  What happens is this:

A pthread_attr_t is a pointer to a pointer to a struct with a magic number.  And at the start of pthread_attr_init this magic number is tested if it's already the magic number expected for an object of type pthread_attr_t.  And only if so, the pthread_attr_init function fails with EBUSY.

That means, the arbitrary value in the uninitialized att prior to the call to pthread_attr_init is a pointer value which points to valid memory which has the magic value 0xdf0df048.  Wow.

This means we can't keep up with the tests in the pthread_FOO_init functions since they could point to an *supposedly* initialized object, while in fact the value they point to is only accidentally so that it looks like an initialized object.

I provided new developer snapshots on https://cygwin.com/snapshots/ and I've just uploaded a 2.5.1-0.1 test release which you can install via setup as soon as your mirror has catched up.

Pleaser give any of them a try.


Thanks,
Corinna

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

- Raw text -


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