*BSD News Article 15773


Return to BSD News archive

Newsgroups: comp.os.386bsd.bugs
Path: sserve!newshost.anu.edu.au!munnari.oz.au!news.Hawaii.Edu!ames!haven.umd.edu!uunet!mcsun!sun4nl!relay.philips.nl!cnplss5!rooij
From: rooij@mozart.cft.philips.nl (Guido van Rooij)
Subject: Re: Bug in mmap()? (and fix)
Message-ID: <1993May7.095702.25209@cnplss5.cnps.philips.nl>
Sender: news@cnplss5.cnps.philips.nl (USENET News System)
Nntp-Posting-Host: mozart
Organization: Philips Communications & Processing Services, Eindhoven
References: <PC123.93May7010930@bootes.cus.cam.ac.uk>
Date: Fri, 7 May 1993 09:57:02 GMT
Lines: 33


pc123@cus.cam.ac.uk (Pete Chown) writes:

>I have found what I think must be a bug in the mmap() code.  The idea
>of mmap(), in case you don't know, is that you can map files into
>virtual memory; you have a choice of three styles of operation:

>1.  Map the file in, and write any changes made back to disc.

>2.  Map the file in, but discard any changes made.

>3.  Copy the whole file before doing anything.

>For the first of these, you need write access to the file, but for 2
>and 3 you only need read access.  Unfortunately you are currently
>refused permission for all of them unless you have write access.  The
>following diff corrects this behaviour, and should be applied to
>/sys/vm/vm_mmap.c.

>This may sound obscure, but unfortunately this call is sure to be used
>by whoever ends up doing the shared libraries.  I'm afraid I don't
>know who is handling the patchkit now, but perhaps they would like to
>have to a look at this diff and add it to the kit if it looks alright.
>That way, the fix should have worked into everyone's systems before
>anyone is trying to distribute a shared library package.

This patch of yours is based on a patch i mailed to the patchkit
a long time ago. It also is applied in NetBSD. But I cannot
explain how the first version of this patch of mine ever got to you.
Soon after I made the patch I found out my error (beause the Xserver didnt
want to start anymore). 

-Guido