Re: cvs commit: src/sys/vm vm_unix.c (fwd)

Date view Thread view Subject view Author view

From: Matthew Dillon (dillon@apollo.backplane.com)
Date: Mon Feb 08 1999 - 14:32:12 EST


:
:Matthew Dillon writes:
:> I think I've come to the conclusion that we should leave PROT_EXECUTE
:> on for sbrk()'d stuff, even though it wastes a map entry.
:
:OK.. did you find any definitive information on this? I.e., what
:the "right" thing to do it?
:
:-Archie
:
:___________________________________________________________________________
:Archie Cobbs * Whistle Communications, Inc. * http://www.whistle.com

    The defacto standard is that you can allocate new never-before-touched
    memory ( from the point of view of your VM address space ), write to it,
    and then execute it. But once you've executed something in it you cannot
    write to it again.

    So, sbrk()ing will work. Personally, though, I think using an anonymous
    mmap() ( for the systems that support it ) is a better way, because you
    can specify PROT_EXEC in the prot argument to the mmap() whereas you
    can only assume that execute permission is allowed on the BSS segment
    you get from sbrk().

    It is definitely illegal to use the clib malloc() function - you don't
    know *where* that memory has been.

                                        -Matt
                                        Matthew Dillon
                                        <dillon@backplane.com>


Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Sat Sep 23 2000 - 19:58:02 EDT