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: mmapped memory lost after fork


On Jul 14 12:47, Tenedor Roquefort wrote:
> I'm using Cygwin 1.5.10-3 and have found what seems to
> be a fork/mmap bug. I have two examples where a forked
> child cannot access memory that was mmapped by the
> parent. The problem seems to arise when the parent
> munmaps some pages (different from the ones the child
> will try to access) before forking.
> 
> In the example below, the parent mmaps 2 pages,
> munmaps the first page, writes to the second page and
> forks. Then both parent and child try to access the
> second page, the parent succeeds but the child dies
> trying. The examples work on Linux without the child
> dying. Has this problem been documented before and is
> there a known fix?
> 
> Thanks.

Thanks for the test case!  It was very helpful.  It turned out to be
an off-by-one error in the child routine which generates the same
memory protection layout as in the parent process.

I've applied a fix and created a new developer snapshot.  Please give
it a try, see http://cygwin.com/snapshots/


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Co-Project Leader          mailto:cygwin@cygwin.com
Red Hat, Inc.

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


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