public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: Stanislav Kascak <stanislav.kascak@gmail.com>
Cc: cygwin@cygwin.com
Subject: Re: possible problem with memory allocation using calloc/mmap/munmap
Date: Fri, 07 Jun 2019 07:27:00 -0000	[thread overview]
Message-ID: <20190607072734.GF3437@calimero.vinschen.de> (raw)
In-Reply-To: <CALLhcm6oXXEdvLgjoWkzDosqces7aaBd9gtBx=zq+VRnPTFA3w@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1491 bytes --]

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 <filesize - 4k) - no error, no file change
> > > 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 return
> > > > > 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.
> 
> 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

-- 
Corinna Vinschen
Cygwin Maintainer

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

      reply	other threads:[~2019-06-07  7:27 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-03 11:33 Stanislav Kascak
2019-05-20 22:26 ` Ken Brown
2019-06-03 11:55 ` Corinna Vinschen
2019-06-04  9:38   ` Stanislav Kascak
2019-06-04 13:18     ` Corinna Vinschen
2019-06-04 13:49       ` Stanislav Kascak
2019-06-04 14:49         ` Corinna Vinschen
2019-06-04 16:02           ` Stanislav Kascak
2019-06-05 18:23             ` Corinna Vinschen
2019-06-06 13:14               ` Stanislav Kascak
2019-06-07  7:27                 ` Corinna Vinschen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190607072734.GF3437@calimero.vinschen.de \
    --to=corinna-cygwin@cygwin.com \
    --cc=cygwin@cygwin.com \
    --cc=stanislav.kascak@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).