Subject: Re: Wine & NetBSD?
To: Chuck Cranor <chuck@xxx.research.att.com>
From: Bang Jun-Young <bjy@mogua.org>
List: tech-kern
Date: 11/20/2001 15:07:39
On Mon, Nov 19, 2001 at 03:24:44PM -0500, Chuck Cranor wrote:
> hi-

Hi,

> 
> 
> In article <20011118025909.A26999@krishna>,
> Bang Jun-Young <bjy@mogua.org> wrote:
> >Background: Unlike NetBSD/FreeBSD/Linux ELF binaries, most of Win32 PE
> >binaries are non-relocatable, and they are/should be loaded at fixed
> >address, 0x400000 in most cases. This is where the problem occurs:
> >Wine would fail if it was unable to mmap the executable image to the
> >specified address.
> >
> >Back to NetBSD side, in normal operation NetBSD mmap(2) doesn't allow
> >the image to be mapped to address under the heap which starts roughly
> >at 0x48xxxxxx. So you have to give it MAP_FIXED to enforce mapping at
> >specified address. MAP_FIXED mapping, however, has a problem: it zaps
> >the previous mapping already established at the specified address.
> >It's clear that we shouldn't use MAP_FIXED in this case. That's why
> >my previous patch was rejected by Wine maintainers.
> 
> 
> can you explain why it is "clear" that we shouldn't use MAP_FIXED?
> it is not clear to me :(

Because MAP_FIXED may cause Wine to crash. If there were loaded two 
or more EXE/DLL's that have the same ImageBase (base address) for one
process and at least two of them were stripped, Wine wouldn't be able
to handle them properly. I think this is a (very) rare case, but
that's Wine maintainers are afraid of.

Also, I believe my patch has proved its safety on FreeBSD.

Jun-Young

-- 
Bang Jun-Young <bjy@mogua.org>