delorie.com/archives/browse.cgi | search |
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:mime-version:reply-to:in-reply-to:references | |
:from:date:message-id:subject:to:content-type; q=dns; s=default; b= | |
Ro09vKXpxHtCKjR2FGZgVplbJwgpKjp0PE879BerBBUVWsrqNK28+2d3hcb++W9p | |
LwjiSxOVvCiZFz8YHVlUOrNwggaR9c7ac1biCe1KxzF2MoL8pc/hsRyMHEQx4f8T | |
CZTM/8V4izjukLEZc6K2EuLx87AGieQsENpr5tYx2/E= | |
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:mime-version:reply-to:in-reply-to:references | |
:from:date:message-id:subject:to:content-type; s=default; bh=fpb | |
pk7ceFKNDrsXTeVm2iN7vJWU=; b=CeEpUD5+gyx0p4+LJKunhG8Mpy9ZGQh/64m | |
cTnynWtZ+9v9D5E2GfT1horfg2BoipjWCzaaV8gwW14Kbttb7getP5ABu15b9SLv | |
TeWYfYxj9eFxATDDERJRiP/wzraMsTPW7sdciBYKEmdOyKf/4pFaVaOGIssRFblp | |
1NNAYixs= | |
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=-0.2 required=5.0 tests=AWL,BAYES_20,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 |
X-HELO: | mail-wi0-f181.google.com |
X-Received: | by 10.180.75.243 with SMTP id f19mr41584499wiw.52.1441691682689; Mon, 07 Sep 2015 22:54:42 -0700 (PDT) |
MIME-Version: | 1.0 |
Reply-To: | fracting AT gmail DOT com |
In-Reply-To: | <55EE66E1.3000908@dwalin.fsnet.co.uk> |
References: | <CALd+sZRo_Nyv=adF5DeeHiShJsxGD+KUPqkDMKb3q47a2Nm=8Q AT mail DOT gmail DOT com> <CALd+sZSUAt6_fdHkgdKqefz1Wv-ijShSo82qJKUcCkZH9v5KzA AT mail DOT gmail DOT com> <CALd+sZQUy=Yn6UJ74N4Bvxd_wi++v+kOU5MehAkW7oaLO+NVbw AT mail DOT gmail DOT com> <55EE66E1 DOT 3000908 AT dwalin DOT fsnet DOT co DOT uk> |
From: | Qian Hong <fracting AT gmail DOT com> |
Date: | Tue, 8 Sep 2015 13:54:02 +0800 |
Message-ID: | <CALd+sZSspE2pn-tvX+fCkK93h1GVy+Yaf_8DAU4KAmYnKZmMYw@mail.gmail.com> |
Subject: | Re: Question about flock - potential memory corruption? |
To: | cygwin <cygwin AT cygwin DOT com> |
X-IsSubscribed: | yes |
--f46d0438951b9fa24c051f360045 Content-Type: text/plain; charset=UTF-8 Hi Sam, Thank you very much for your reply! On Tue, Sep 8, 2015 at 12:41 PM, Sam Edge <sam DOT edge AT dwalin DOT fsnet DOT co DOT uk> wrote: > Erm ... slight technical hitch? Your example flock.c doesn't call > fork(), nor does it use your two macros MAX_ITER & CHILDREN. Good question. This problem was originally found when running autom4te on Wine. In autom4te-2.69, we have: 68 my $flock_implemented = 'yes'; 982 $icache_file = new Autom4te::XFile $icache, O_RDWR|O_CREAT; 983 $icache_file->lock (LOCK_EX) 984 if ($flock_implemented eq "yes"); This cause problem on Wine on some machine, while it works fine on some other machine. After tracking down, I successfully reproduce the problem with Cygwin using the attached test case stc-flock-fork-2.c, which is changed based on another test case from an old cygwin mailing list archive [1]. Later then, I found that even without fork(), we can still reproduce the same problem, Valgrind + Wine shows same warning either with or without fork, so I simply the test case a bit further, that's why you didn't see fork in my test case. Thank for your comment, it's good to make things clearer to everybody. Any further comment is welcome! [1] https://www.cygwin.com/ml/cygwin/2011-08/txt00012.txt -- Regards, Qian Hong - http://www.winehq.org --f46d0438951b9fa24c051f360045 Content-Type: text/x-csrc; charset=US-ASCII; name="stc-flock-fork-2.c" Content-Disposition: attachment; filename="stc-flock-fork-2.c" Content-Transfer-Encoding: base64 X-Attachment-Id: f_ieaxqzf10 LyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioq KioqKioqKioqKioqKioqKioqKioqKioqKioqCiAqIFRoaXMgaXMgYSBTVEMg dGhhdCBjYXVzZXMgdGhlIGZvbGxvd2luZyBlcnJvciBvbiBteSB0ZXN0IG1h Y2hpbmU6CiAqICAgTnRDcmVhdGVFdmVudChsb2NrKTogMHhDMDAwMDAzNQog KgogKiBJdCB0cmllcyB0byB1c2UgZmxvY2soKSBmb3IgZmlsZSBsb2NraW5n LiBJdCBjcmVhdGVzIGEgdGVtcG9yYXJ5CiAqIGZpbGUsIHRoZSB1c2VzIGZv cmsgdG8gc3Bhd24gYSBudW1iZXIgb2YgY2hpbGRyZW4uIEVhY2ggY2hpbGQg b3BlbnMKICogdGhlIGZpbGUsIHRoZW4gcmVwZWF0ZWRseSB1c2VzIGZsb2Nr IHRvIGxvY2sgYW5kIHVubG9jayBpdC4KICoKICogVGhpcyB0ZXN0IHdhcyBl eHRyYWN0ZWQgZnJvbSB0aGUgQVBSIHRlc3Qgc3VpdGUuCiAqCiAqIENvbXBp bGU6IGdjYyAtV2FsbCAtbyBzdGMtZmxvY2stZm9yayBzdGMtZmxvY2stZm9y ay5jCiAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioq KioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KCiNpbmN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lOVFIpOwogICAgICAgICAgICBpZiAocmMgPCAwKSB7CiAgICAgICAg ICAgICAgICBwZXJyb3IoImxvY2siKTsKICAgICAgICAgICAgICAgIGV4aXQo MSk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZG8gewogICAgICAgICAg ICAgICAgcmMgPSBmbG9jayhmZDIsIExPQ0tfVU4pOwogICAgICAgICAgICB9 IHdoaWxlIChyYyA8IDAgJiYgZXJybm8gPT0gRUlOVFIpOwogICAgICAgICAg ICBpZiAocmMgPCAwKSB7CiAgICAgICAgICAgICAgICBwZXJyb3IoInVubG9j ayIpOwogICAgICAgICAgICAgICAgZXhpdCgxKTsKICAgICAgICAgICAgfQog ICAgICAgIH0KICAgICAgICBleGl0KDApOwogICAgfQp9CgovKiBXYWl0IGZv ciB0aGUgY2hpbGQgdG8gZmluaXNoLiAqLwp2b2lkIGF3YWl0X2NoaWxkKHBp ZF90IHBpZCkKewogICAgcGlkX3QgcHN0YXR1czsKICAgIGludCBleGl0X2lu dDsKCiAgICBkbyB7CiAgICAgICAgcHN0YXR1cyA9IHdhaXRwaWQocGlkLCAm ZXhpdF9pbnQsIFdVTlRSQUNFRCk7CiAgICB9IHdoaWxlIChwc3RhdHVzIDwg MCAmJiBlcnJubyA9PSBFSU5UUik7Cn0KCmludCBtYWluKGludCBhcmdjLCBj b25zdCBjaGFyICogY29uc3QgKiBhcmd2LCBjb25zdCBjaGFyICogY29uc3Qg KmVudikKewogICAgcGlkX3QgY2hpbGRbQ0hJTERSRU5dOwogICAgaW50IG47 CiAgICBpbnQgZmQ7CiAKICAgIC8qIENyZWF0ZSB0aGUgdGVtcG9yYXJ5IGZp bGUuICovCiAgICBmZCA9IG1rc3RlbXAodG1wZmlsZW5hbWUpOwogICAgaWYg KGZkIDwgMCkgewogICAgICAgIHBlcnJvcigib3BlbiBmYWlsZWQiKTsKICAg ICAgICBleGl0KDEpOwogICAgfQogICAgY2xvc2UoZmQpOwoKICAgIC8qIENy ZWF0ZSB0aGUgY2hpbGRyZW4uICovCiAgICBmb3IgKG4gPSAwOyBuIDwgQ0hJ TERSRU47IG4rKykKICAgICAgICBtYWtlX2NoaWxkKDAsICZjaGlsZFtuXSk7 CgogICAgLyogV2FpdCBmb3IgdGhlbSB0byBmaW5pc2guICovCiAgICBmb3Ig KG4gPSAwOyBuIDwgQ0hJTERSRU47IG4rKykKICAgICAgICBhd2FpdF9jaGls ZChjaGlsZFtuXSk7CgogICAgLyogQ2xlYW4gdXAuICovCiAgICB1bmxpbmso dG1wZmlsZW5hbWUpOwogICAgcmV0dXJuIDA7Cn0K --f46d0438951b9fa24c051f360045 Content-Type: text/plain; charset=us-ascii -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple --f46d0438951b9fa24c051f360045--
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |