Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 16 Mar 1996 19:21:38 +1100 (EST)
From:      David Dawes <dawes@rf900.physics.usyd.edu.au>
To:        dyson@freebsd.org
Cc:        current@freebsd.org, mmead@Glock.COM
Subject:   Re: Try this vm_mmap.c -- please
Message-ID:  <199603160821.TAA09552@rf900.physics.usyd.edu.au>
In-Reply-To: <199603160046.AAA00402@dyson.iquest.net> from "John S. Dyson" at Mar 16, 96 00:46:42 am

next in thread | previous in thread | raw e-mail | index | archive | help
>This vm_mmap.c contains what I believe some fixes to the mmap code.  Note
>that there were some severe bogons in the code, and one that I cannot
>easily get rid of.  Firstly we allow mmaps that don't have either MAP_PRIVATE or
>MAP_SHARED set.  This is wrong because logically one is necessary.  The
>solution is that I default to MAP_PRIVATE for vnodes and MAP_SHARED for
>devices (video memory.)  Also, the old code did not allow for shared
>anonymous mappings,  this is very bogus.  Eventually, we should enforce
>a MAP_PRIVATE or MAP_SHARED bit being set, but there is code out there
>like XFree that doesn't specify either bit, and since it was originally
>not "wrong", it is a PROBLEM :-(.  PLEASE PLEASE give me some feedback on
>this, as my entire life for this weekend is dedicated to fixing this
>problem (not really, but you know what I mean.) :-).
>
>Here it is: vm_mmap.c -- remember to save your old one :-).

It works fine with XFree86 3.1.2D.  We can add MAP_SHARED to our code.
I don't like the idea of the mmap region being inherited by a child though.
I agree that MAP_PRIVATE doesn't make much sense for devices.

The 2.0.5 code treats mmaped devices the same as MAP_ANON and MAP_SHARED in
that there is no copy-on-write, but it doesn't set the MAP_SHARED flag
for them, which means that it doesn't automatically get shared with children.

That *seems* to be what the pre-fix version of -current does too.  I
presume it was the lack of the inheritance that was causing the original
problem we saw with XFree86?  The map seemed to become private/COW after
the fork/exec.

BTW, I can't see anywhere where MAP_INHERIT gets used.

David



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199603160821.TAA09552>