From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12668 invoked by alias); 7 Jun 2019 07:27:39 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 12660 invoked by uid 89); 7 Jun 2019 07:27:39 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-102.7 required=5.0 tests=AWL,BAYES_00,GOOD_FROM_CORINNA_CYGWIN,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 spammy=H*F:D*cygwin.com X-HELO: mout.kundenserver.de Received: from mout.kundenserver.de (HELO mout.kundenserver.de) (217.72.192.73) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 07 Jun 2019 07:27:38 +0000 Received: from calimero.vinschen.de ([24.134.7.25]) by mrelayeu.kundenserver.de (mreue107 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MfZDK-1gtToc45uK-00g14P; Fri, 07 Jun 2019 09:27:35 +0200 Received: by calimero.vinschen.de (Postfix, from userid 500) id 6CDCAA80691; Fri, 7 Jun 2019 09:27:34 +0200 (CEST) Date: Fri, 07 Jun 2019 07:27:00 -0000 From: Corinna Vinschen To: Stanislav Kascak Cc: cygwin@cygwin.com Subject: Re: possible problem with memory allocation using calloc/mmap/munmap Message-ID: <20190607072734.GF3437@calimero.vinschen.de> Reply-To: cygwin@cygwin.com Mail-Followup-To: Stanislav Kascak , cygwin@cygwin.com References: <20190603115456.GG3437@calimero.vinschen.de> <20190604131836.GS3437@calimero.vinschen.de> <20190604144948.GT3437@calimero.vinschen.de> <20190605182315.GZ3437@calimero.vinschen.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="CpBQqYjq/d0HQTAP" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.11.3 (2019-02-01) X-SW-Source: 2019-06/txt/msg00089.txt.bz2 --CpBQqYjq/d0HQTAP Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-length: 1458 On Jun 6 15:13, Stanislav Kascak wrote: > > > [...] > > > I played around a bit and I can confirm it would be consistent with > > > current behavior: > > > memwrite <0 - filesize) - no error, written to file > > > memwrite > > memwrite <4k, 64k) - SIGSEGV > > > memwrite <64k, mmap alloc size) - SIGSEGV or another mem alloc > > > overwrite (depending on whether there is another allocation) > > > With workaround last line would be fixed to SIGBUS (along with proper > > > allocation length). I believe this is completely OK. > > > > > > > > > > > > - is it possible that some subsequent mem alloc request would ret= urn > > > > > region from |-- THE VOID 60K --| which could again cause segfault > > > > > after munmap? > > > > > > > > No, as stated above. Allocations are restricted to Windows' 64K > > > > allocation granularity. > > > > > > I apologize. I missed that sentence. So, your workaround seems fine. > > > > Please try the latest snapshot from https://cygwin.com/snapshots/ > > Just replacing the Cygwin DLL is sufficient. >=20 > My test programs work fine and also openldap crash that led me to this > issue is gone (openldap tests still fail, but on a different place > after the one above and now with a SIGBUS which already gives a good > hint as to where to look). > I think your patch works quite well. Thanks a lot. Thanks for testing! Corinna --=20 Corinna Vinschen Cygwin Maintainer --CpBQqYjq/d0HQTAP Content-Type: application/pgp-signature; name="signature.asc" Content-length: 833 -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEoVYPmneWZnwT6kwF9TYGna5ET6AFAlz6EeYACgkQ9TYGna5E T6DThA/+MweuLoPgWwSWpMX52o4HYHwK8ZICJ9toi16M3aYiyofGyjgKd0hPvycy 7upjUCHJ0O+AMdPIzd/Fv+2aa3LE/WccY2tgYzEZgDGmauwppy8fLuYfH9LBkD6I fUuZXUCbFDZcFF7dauKhT0xnzdS7BxGpWmB8gy31tNzHd5hLuVWrtjHRnFQ/RRb2 k1gupXkwX5OpH72ZmOL1WbtFMPPHE4uIe4oCzGZ7FmY1JOVHSNkGQcZDSCPK2tCs 1GPQC4yV59NkhFAKJO3i9/vamrmeXb1e4kGzu9WXctAjPCVlec4DGQyd+rKp/etk OoS2daeCCQYWFpX9RP7LDPWmmH025eU6lDLCEbayhqU7W8wjGHtlXFsjPjp5YUQt bOjHhqfB6KWh9NkXYFsMHOdfoKmFvpjsULFFHHwnnZNLj3zk8Fv4TCcxzy8ma9FF oo3ZzpHNnfS5nPG63zhCMR2cOfOFrpbE368REjaCNCjH2cj870jH6T3q+YfZmclY Rgh4ruR3cGPZLrrja6om4zaHnRy6i/nxpL6IUDTaCfSPX+cCBatgABzwfhOFE3al JmWUjvkNs5Bw91uMIkdR2U+PP/jiGdbdZi5VLUCQ672FuvmhfPhbykwycQeLyp0N pnUXvmSQsO613xgYWU9PxfFMWdihCPvhFWU7eHokf1Lsp/MrRZQ= =uMKe -----END PGP SIGNATURE----- --CpBQqYjq/d0HQTAP--