| 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:message-id:date:from:mime-version:to:subject | |
| :references:in-reply-to:content-type; q=dns; s=default; b=HSUx+D | |
| 2mJv1NVR3E0vcjHKpA6i2NO0maLCqoTBXWResn9daIq7UZoA2gtDNqKuD97XLCuL | |
| xsYKzYO4PMGD4KH4KA+nDSsJx7n4wAHgRWZJiSopW7GG4S3F0eEb2WDGX8AE4PnP | |
| LeTNMuP/YCXa9xNot5A52Dne12QWL4zhGGuGg= | |
| 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:message-id:date:from:mime-version:to:subject | |
| :references:in-reply-to:content-type; s=default; bh=fzoPQNrTaava | |
| u3j0GEcd7x6RxFI=; b=KJ1AhqK8ScK4vMysnk/NS+ZvLNoW8YnY7Mu4ZeSs6bx1 | |
| CgAZka65cithB+FtyODgY+2kEDNQrzNTknv5Oo1rnsMJGEyBlW0SXVobdh6/xAoZ | |
| RsgM7rqnRfDQC4SUAd2GGas9+BVH66rtaP18IesrpkU3srJlNepnXi5omLe5lSI= | |
| 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.0 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 |
| X-HELO: | mx1.redhat.com |
| Message-ID: | <54AAA9CB.5080604@redhat.com> |
| Date: | Mon, 05 Jan 2015 08:12:11 -0700 |
| From: | Eric Blake <eblake AT redhat DOT com> |
| User-Agent: | Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 |
| MIME-Version: | 1.0 |
| To: | cygwin AT cygwin DOT com |
| Subject: | Re: Cygwin 1.7 pthread hides segmentation fault |
| References: | <CAHSE2Wcm6WvmA-rtdgQ=5NuQnWwhes9iGn8fZj15YSzYF8GmLw AT mail DOT gmail DOT com> |
| In-Reply-To: | <CAHSE2Wcm6WvmA-rtdgQ=5NuQnWwhes9iGn8fZj15YSzYF8GmLw@mail.gmail.com> |
| OpenPGP: | url=http://people.redhat.com/eblake/eblake.gpg |
| X-IsSubscribed: | yes |
--N8WVHc7PbAIeBCE46sgsKsk2VoDd3X7id
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
On 01/04/2015 07:14 PM, Howard Guo wrote:
> It seems that segfaults go unreported using pthread and Cygwin 1.7.33-2.
>=20
> Here is a minimal code piece to reproduce:
>=20
> #include <pthread.h>
>=20
> void* thread_run(void* _) {
> int *p =3D 0;
> *p =3D 1;
> return NULL;
> }
>=20
> int main(int argc, char** argv) {
> pthread_t t1;
> pthread_create(&t1, NULL, thread_run, NULL);
> pthread_join(t1, NULL);
> return 0;
> }
>=20
> Simply compiled with gcc -pthread, and the result executable returns 0
> without reporting segmentation fault.
>=20
> Could this be a bug?
Your program induces undefined behavior, and therefore, it could be
argued that the bug is in your program, not in cygwin. But you are
correct that for optimal quality of implementation, we should be
delivering a SIGSEGV at the point where you assign through the bogus
pointer. (I'm the libsigsegv maintainer, and the only way to PORTABLY
prove whether pthread is eating segfaults is to use mmap()/mprotect()
and cause a fault through a valid pointer; as faulting through the NULL
pointer is not portable.)
--=20
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
--N8WVHc7PbAIeBCE46sgsKsk2VoDd3X7id
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: Public key at http://people.redhat.com/eblake/eblake.gpg
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
iQEcBAEBCAAGBQJUqqnLAAoJEKeha0olJ0NqxVgIAI5jR5ZbWCZAj2Hi05F0N7U6
TgO8O/lvAvfziMS1VSiV5hmrh7AL+0ApXILCIw/4MbEuve6OgyajNv+Kb8Ln8fFq
jGdKWpwdSGYcqNq0gGev2vKX7lzoUmPqL8fMFLEjOZjz8UjcZeFjvGGMkCqnwf/A
v3LgMs1aV0/9jeAOxivim5Sm52dhgvYa2xiN0MhFKnmDd5BHzAFBK2ebXANWwsQ/
pt65H9Rgf3pKKdUi6WH+3+ANDJZJFThETAokUHSwj7/tPic6N+SCsZ/wPpq4cGsA
8Tb/YP350LyAxiYG+G5FlrRtcBCk0cMEpC5rUBDtnATBO5qDnW7w8RXP/mBTGss=
=JDWq
-----END PGP SIGNATURE-----
--N8WVHc7PbAIeBCE46sgsKsk2VoDd3X7id--
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |