delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2016/05/20/15:59:21

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=nIOUWaG3e6m6tcWv+0pBLFIsTVXaa1g87dowicurTw+iFjDJg6wI/
v11GFoljqAAyrTuNd8RpOoM+nG8PYVb3tqL2doGTicFZoWROqrKZUieNOyMwDMqx
HLqXHv5YBx+4HeRa9YB9Ms9xxtL+3dPmt5hfyfR86ayzXJSGbMaGWQ=
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=FkyYybnSOA7pQ5LET+m4AMbV/Tc=; b=VwIJ+ECAiQpRONVXNwyxqsz+ZJ/c
/rXOeyNqRoq8utsT3juF6Iy+6469AmYOD/wqwSFKWA9sZr90O+YiK9s78jMqSqpn
wLL6x1cD+CxrXEz30aMsuwg6lcnrIVojTSYsk5sin3YhqJ7zzo51pkb6JKCGzpBD
kSAdo7hLBI3schM=
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=-96.5 required=5.0 tests=AWL,BAYES_00,GOOD_FROM_CORINNA_CYGWIN,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_PBL,RDNS_DYNAMIC autolearn=ham version=3.3.2 spammy=commitdiff, bray, Bray, sk:newlib-
X-HELO: calimero.vinschen.de
Date: Fri, 20 May 2016 21:58:39 +0200
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: Segfault in MAP_NORESERVE mmap above ~4GB
Message-ID: <20160520195839.GF22065@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <CAOTD34Z8sbu3BFDbSjzRhy_ZX5swnvNErVk1EzMfQZj0MEE=DA AT mail DOT gmail DOT com>
MIME-Version: 1.0
In-Reply-To: <CAOTD34Z8sbu3BFDbSjzRhy_ZX5swnvNErVk1EzMfQZj0MEE=DA@mail.gmail.com>
User-Agent: Mutt/1.6.1 (2016-04-27)

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

Hi Erik,

On May 12 15:30, Erik Bray wrote:
> Hi all,
>=20
> This issue pertains to Cygwin 64-bit.  The following example program
> demonstrates the issue:
>=20
> $ cat mmap_test.c
> #include <sys/mman.h>
> #include <stdio.h>
> #include <windows.h>
>=20
>=20
> #define VSIZE 0x100001000
> #define SIZE 0x1000
>=20
>=20
> void foo() {
>     void *top, *bot, *c;
>=20
>     c =3D mmap(NULL, VSIZE, PROT_READ|PROT_WRITE,
>              MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0);
>=20
>     top =3D c + VSIZE;
>     bot =3D top - SIZE;
>=20
>     printf("     c =3D 0x%016lx\n", c);
>     printf("   top =3D 0x%016lx\n", top);
>     printf("   bot =3D 0x%016lx\n", bot);
>=20
>     printf("  c[0] =3D %ul\n", *((unsigned long *)c));
>     printf("bot[0] =3D %ul\n", *((unsigned long *)bot));
> }
>=20
>=20
> int main(void) {
>     foo();
>     return 0;
> }
>=20
> $ gcc mmap_test.c -o mmap_test
>=20
> $ ./mmap_test.exe
>      c =3D 0x000006feffff0000
>    top =3D 0x000006ffffff1000
>    bot =3D 0x000006ffffff0000
>   c[0] =3D 0l
> Segmentation fault (core dumped)
>=20
> --------------------------------------------------

Thanks especially for the testcase.  I just applied a fix for this
which, hopefully, catches all problems with too small length/size
variables and parameters.

I've uploaded a new developer snapshot to https://cygwin.com/snapshots/

Would you mind to inspect the patch(*) critically?


Thanks a lot,
Corinna


(*) https://sourceware.org/git/gitweb.cgi?p=3Dnewlib-cygwin.git;a=3Dcommitd=
iff;h=3D0aa738220bb9dea2ad479e484560767b36701947

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

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

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

iQIcBAEBCAAGBQJXP2xvAAoJEPU2Bp2uRE+gVhAP/2WprNBxHoYf8DhD1oTx5Q9S
XOmCFy8qYDkIN1YTiThYO8u82ArhRgQCQNW3uBWO2oGFqNx32T58IUTSyWWotLJr
v+ceG0NXpwthtK8k1+STiRWONmwjrkbEN9c+2RsGxUCR1khrsvqbH14AQ++rfstH
GK/wq8bMidjKpUxgNljUFJNVFIjv3CFfIMQr2DnW4UNGy6CBX0nSkOWszXXUvzbx
wlnUJimu0d1wnL4TI9heMOoqbL8oKKxRPL91+YZryFy9nb4/pnSq0pV7/Ud8AVUc
asHZSsq4KTFcRlaCxflBV7QRamUmY9dia87z0PSFpNwJLpKETmyNZebSIrDKlHaD
AVCkiWDKFDnFkiqrt556lgu7BIH6HPX3yx2zxRtHxFLiSOmKvzESEZdLXh8Qv6kO
RKXX5fnddWCqlSjUKt+Z9WrFZ4bByC7+aLLr1ZAwldIYqlk4zFSMreWcd96STHb3
CyqK3H4E7sZObaGvaCeU9O0xhKMDB5ogRw90FYx6Lz8+5OOkZxTgxo7enpugv/D2
tQdxjREEETYghE23nGVke1OfWZDy0FRM3Jy6rEdsl9hG37mnuZsoO7ia97Ex2ycw
VAgX5l77O6QBTpwr01VTwEujVZxSigtGTeD66qSyVyCh43obGekwOQjYkcMV5p/g
enEM7Ree6oKTAKbfH5NS
=tR21
-----END PGP SIGNATURE-----

--aZoGpuMECXJckB41--

- Raw text -


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