This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: possible problem with memory allocation using calloc/mmap/munmap


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: signature.asc
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]