delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2003/07/04/05:08:16

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Date: Fri, 4 Jul 2003 11:07:18 +0200
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: mmap() and gcc precompiled headers
Message-ID: <20030704090718.GZ1165@cygbert.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <3F04D70E DOT 6000604 AT agilent DOT com>
Mime-Version: 1.0
In-Reply-To: <3F04D70E.6000604@agilent.com>
User-Agent: Mutt/1.4.1i

On Thu, Jul 03, 2003 at 06:23:26PM -0700, Earl Chew wrote:
> o The if (addr) test is redundant (it will always succeed -- I think
>   you meant to write *addr, but I think it's better to simply do
>   away with the test since it doesn't buy anything).

I've just fixed the conditional for now.  I think I know what you have
in mind but, well, the job of the conditional is clear, especially with
the comment above.  Sure it could also be expressed in another way. 
See below.

> o I think there is a problem with the address arithmetic in the match()
>   method used by munmap(). Compare the code in list::match (__off64_t
>   off, DWORD len) with list::match (caddr_t addr, DWORD len,
>   __off32_t start).
> 
>   I believe the address relationships are:
> 
>         get_offset()                get_size()
>       <-------------> <----------------------------------->
>      +----------------------------------------------------+
>      |               :                                    |
>      +----------------------------------------------------+
>      ^                 ^ <----------------------------->
>      |                 |              len
>   get_address()        |
>                      addr

Uhm, no.

get_size() is the value matching gran_len in mmap64, get_address() matches
base, returned by fh->mmap().  So get_address() + get_size() returns the
full amount of memory returned by MapViewOfFileEx().  addr and len are
represented by the map_map (the bit field, flagging used and free areas in
the map).  That means that addr+len must actually be contained in
get_address()+get_size().

I'm sorry but I can't use your patch unless you've signed a copyright
assignment.  I saw that it's too long to go in w/o this, unfortunately,
so I didn't have a close look not to get tainted.  Please see
http://cygwin.com/contrib.html.  A ChangeLog entry would be required
as well.  

Thanks,
Corinna

--
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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019