axiom-developer
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Axiom-developer] address@hidden: Re: Executable memory: some apps that


From: Tim Daly
Subject: [Axiom-developer] address@hidden: Re: Executable memory: some apps that work on RH9 don't on FC1]
Date: Mon, 17 Nov 2003 20:33:19 -0500

fyi...

------- Start of forwarded message -------
Subject: Re: Executable memory: some apps that work on RH9 don't on FC1
From: Gerard Milmeister <address@hidden>
To: address@hidden
In-Reply-To: <address@hidden>
Content-Type: text/plain; charset=iso-8859-1
Organization: Universität Zürich
X-MIME-Autoconverted: from quoted-printable to 8bit by int-mx1.corp.redhat.com 
id hAHKSjw12007
X-loop: address@hidden
Sender: address@hidden
X-BeenThere: address@hidden
X-Mailman-Version: 2.0.13
Precedence: junk
Reply-To: address@hidden
List-Help: <mailto:address@hidden>
List-Post: <mailto:address@hidden>
List-Subscribe: <http://www.redhat.com/mailman/listinfo/fedora-devel-list>,
        <mailto:address@hidden>
List-Id: For developers, developers, developers <fedora-devel-list.redhat.com>
List-Unsubscribe: <http://www.redhat.com/mailman/listinfo/fedora-devel-list>,
        <mailto:address@hidden>
List-Archive: <http://www.redhat.com/archives/fedora-devel-list/>
Date: Mon, 17 Nov 2003 21:28:42 +0100

On Mon, 2003-11-17 at 20:12, Roland McGrath wrote:
> > The official binary of mit-scheme 7.7.1 
> > (http://www.gnu.org/software/mit-scheme)
> > segfaults if called with 'scheme -compiler'. In this case the scheme main
> > program load a 'band' called compiler.com, which contains executable code.
> > Could somebody investigate this issue? I am not that familiar with problems
> > like this.
> 
> If this binary was created with old tools and has no PT_GNU_STACK marker,
> then it should get executable stack by default.  More likely the issue is
> that it calls malloc and expects the memory returned to be executable.
> The Scheme runtime needs to be changed to use mmap when executability matters.

I further investigated problem using scheme-7.7.90 and found the
following. When loading a band (the runtime image), the following is
called:

static void *
mmap_heap_malloc_1 (unsigned long requested_length, int fixedp)
{
  unsigned long ps = (UX_getpagesize ());
  void * addr
    = (mmap (((void *) MMAP_BASE_ADDRESS),
             (((requested_length + (ps - 1)) / ps) * ps),
             (PROT_EXEC | PROT_READ | PROT_WRITE),
             (MAP_PRIVATE | MAP_ANONYMOUS | (fixedp ? MAP_FIXED : 0)),
             /* Ignored by GNU/Linux, required by FreeBSD and Solaris.  */
             (-1),
             0));
  return ((addr == MAP_FAILED) ? 0 : addr);
}

Now for the default runtime (runtime.com), requested_length == 5726028,
and the function proceeds without fault. However when the "-compiler"
switch is used to load the compiler, the all.com runtime is loaded and
then requested_length == 18563072 (this image is much bigger) and the
mmap call results in a segfault. ps is 4096, fixedp is 1 and
MMAP_BASE_ADDRESS == 4096.
Why does mmap segfault at all? Shouldn't it at worst return an error?

Hope this helps...

- -- 
Gérard Milmeister
Tannenrauchstrasse 35
8038 Zürich
address@hidden


- --
fedora-devel-list mailing list
address@hidden
http://www.redhat.com/mailman/listinfo/fedora-devel-list
------- End of forwarded message -------




reply via email to

[Prev in Thread] Current Thread [Next in Thread]