Subject: Re: bug#19393: 25.0.50; Emacs cannot determine coding system of ISO-8859 encoded files

From: Wolfgang Jenkner <[email-masked]>
Date: Thu, 15 Jan 2015 14:38:10 +0100

On Wed, Jan 14 2015, Wolfgang Jenkner wrote:

> There remains the problem, though, that emacs on FreeBSD also uses
> gmalloc and hence, IIUC, sbrk() for memory allocation, and at this point
> I'm too ignorant about almost everything involved here to be confident
> that mmap()ed pages can't overlap with the process (BSS) data segment
> when MAP_EXCL | MAP_FIXED is among the flags.
>
> Without the MAP_EXCL mmap flag they definitely can overlap, as the
> following test program shows when it is _statically_ linked.
>
> Here's the output when I run it:
>
> r0 = 0x800663000
> Cannot allocate memory
> r2 = 0x800662000

However, I somehow forgot that, quite contrary to my test program,
src/buffer.c would use MAP_FIXED only when trying to add some other
pages on top of an existing region, the beginning of which was mmap'd
without MAP_FIXED.  Hence the new region could only reach into the data
segment if the old one was already there.  That is, the patch doesn't
change the current situation in this regard.

So I think that the patch would be OK, after all.