linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Benjamin C.R. LaHaise" <blah@kvack.org>
To: "Eric W. Biederman" <ebiederm+eric@npwt.net>
Cc: linux-mm@kvack.org
Subject: Re: Fixing private mappings
Date: Thu, 23 Apr 1998 11:12:12 -0400 (EDT)	[thread overview]
Message-ID: <Pine.LNX.3.95.980423105842.15346A-100000@as200.spellcast.com> (raw)
In-Reply-To: <m1ra2pnn3c.fsf@flinx.npwt.net>

On 23 Apr 1998, Eric W. Biederman wrote:

> Please excuse me for thinking out loud but private mappings seems to be
> a hard problem that has not been correctly implemented in the linux
> kernel.
> 
> Definition of Private Mappings:
>  A private mapping is a copy-on-write mapping of a file.  
> 
>  That is if the file is written to after the mapping is established,
>  the contents of the mapping will always remain what the contents of
>  the file was at the time of the private mapping.

No, this is not the case.  Examine the behaviour of other unicies out
there that implement mmap.  The following is quoted from the man page for
mmap on Solaris:

     MAP_SHARED and MAP_PRIVATE describe the disposition of write
     references  to  the  memory object.  If MAP_SHARED is speci-
     fied, write references will change the  memory  object.   If
     MAP_PRIVATE  is  specified, the initial write reference will
     create a private copy of the memory object page and redirect
     the  mapping  to  the copy. Either MAP_SHARED or MAP_PRIVATE
     must be specified,  but  not  both.   The  mapping  type  is
     retained across a fork(2).

Note: 'the initial write reference will create a private copy' -- not
the act of reading or mapping.

>  Further if another private mapping is established after one
>  private mapping has been established it should have the file contents
>  of the file at the time the mapping is established.  Not at the time
>  any previous private mapping was established.

Linux does behave this way currently.

...
> A slightly more generic solution would be to introduce a new ``inode''
> that new it was a copy of the old inode but at a different offset.  If
> these new ``inodes'' would then have a linked list of their own, that
> could be followed for update purposes.  
...

This would be the appropriate thing to do if you'd like see such exotic
behaviour ;-)

		-ben

  parent reply	other threads:[~1998-04-23 15:12 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-04-23  5:06 Eric W. Biederman
1998-04-23  8:28 ` Rik van Riel
1998-04-23 15:12 ` Benjamin C.R. LaHaise [this message]
1998-04-23 22:03   ` Eric W. Biederman
1998-04-24 20:37     ` Stephen C. Tweedie
1998-04-25  5:30       ` Eric W. Biederman

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=Pine.LNX.3.95.980423105842.15346A-100000@as200.spellcast.com \
    --to=blah@kvack.org \
    --cc=ebiederm+eric@npwt.net \
    --cc=linux-mm@kvack.org \
    /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