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:cc:subject:message-id:reply-to :references:mime-version:content-type:in-reply-to; q=dns; s= default; b=l1xzcnz47S8WVlngLlSV5Wk1kKXUW4PqqmU3u4Iwxk7cAxh7+s+b8 f8OoAIikLoJH68DtSI52BluESMGr0exDNuTaqrd9jZFCCjkb1y7MDjpoXnRiSA5/ ZOHvquKPcAmUcjNIoSm4fp0P0RvCZkhAeA1PvqOxqrc7YCneiW7UYo= 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:cc:subject:message-id:reply-to :references:mime-version:content-type:in-reply-to; s=default; bh=AyYGkVJ13BI4ZTazsKE/FZCDNnA=; b=VfVU8nRTI7fx9eumio8dYCqEYACv ribUrQ91ydae76p5PD3aerW3ziyHGdOJC+WfndV6dO6BelUJa8e8wSfkiU2b0H4+ W1TrVmHwRqEEfyt7RzZDS5tU8yMKUeFYzFQCU1HyetydDyUr+/qzR1WzStqo+0m4 5Tz+zLmi3JlcHr0= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , 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-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 Date: Fri, 7 Jun 2019 09:27:34 +0200 From: Corinna Vinschen To: Stanislav Kascak Cc: cygwin AT cygwin DOT com Subject: Re: possible problem with memory allocation using calloc/mmap/munmap Message-ID: <20190607072734.GF3437@calimero.vinschen.de> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: Stanislav Kascak , cygwin AT cygwin DOT com References: <20190603115456 DOT GG3437 AT calimero DOT vinschen DOT de> <20190604131836 DOT GS3437 AT calimero DOT vinschen DOT de> <20190604144948 DOT GT3437 AT calimero DOT vinschen DOT de> <20190605182315 DOT GZ3437 AT calimero DOT vinschen DOT 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) --CpBQqYjq/d0HQTAP Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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" -----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--