Mail Archives: cygwin/2009/11/09/06:59:24
On Nov 8 14:07, Charles Wilson wrote:
> Corinna Vinschen wrote:
> > On Nov 8 14:56, Corinna Vinschen wrote:
> >> Btw., the check for mmap in grep's configure file is broken. It tries
> >> to mmap to a fixed address formerly allocated via malloc(). This doesn't
> >> work on Windows. An autoconf run with a newer version of autoconf would
> >> be nice.
> >
> > I just found that the latest autoconf *still* has this broken test
> > for mmap, which basically calls
> >
> > data2 = malloc (size);
> > mmap(data2, ...);
> >
> > Why has this test never been fixed? Chuck?
>
> ...err, 'cause I didn't realize it was a problem. I see that cygport has
> hidden this for years:
>
> # AC_HAVE_MMAP fails despite a working mmap, so we force this to yes
> # (see http://www.cygwin.com/ml/cygwin/2004-09/msg00741.html
> # and following thread for details)
> export ac_cv_func_mmap_fixed_mapped=yes;
>
> NTTAWWT, but it never triggered my "gee I ought to fix that" reflex. I
> agree this should be fixed, but I'm leery of changing an autoconf test
> without knowing how that change will affect the other 9,236 platforms
The problem in this testcase is the fact that it calls malloc, then
computes the next page-aligned free address after the mallocated area
and then tries to mmap to this address with MAP_FIXED set. Sure, this
*might* work, and it works on most systems, but there's no reason at all
to *expect* that it works since it only works by chance. The memory
addresses can be taken by anything and to require that an arbitrary
fixed address is available to mmap is just plain wrong. From the
Linux man page:
MAP_FIXED
[...]
If the specified address cannot be used, mmap() will fail. Because
requiring a fixed address for a mapping is less portable, the use of
this option is discouraged.
Since autoconf is supposed to help applications to be more portable,
it's not really feasible, IMHO, that autoconf requires a non-portable
feature to work.
It's frustrating that mmap() and even mmap(MAP_FIXED)
works fine on Cygwin, just not in the non-portable way it's tested
in the autoconf test. Maybe we need two mmap tests in autconf, one
for mmap in general, the other for MAP_FIXED iisues.
> I think this is an issue for the autoconf list as a whole. Would you --
> or Eric -- care to raise it there? Especially as you seemed to have
> quite strong feelings about it back in 2004:
> http://www.cygwin.com/ml/cygwin/2004-09/msg00753.html
I had hoped that you, as the autoconf maintainer, would put this
upstream...
Corinna
--
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Project Co-Leader cygwin AT cygwin DOT com
Red Hat
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
- Raw text -