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

Date view Thread view Subject view Author view

From: Godmar Back (gback@cs.utah.edu)
Date: Mon Feb 08 1999 - 15:39:27 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.
>

I asked some of the people who were involved in the original development of
BSD. BSD has always set the execution bit in the data segment. In fact,
when BSD was ported to the PA (several years ago), they tried turning it off
and quickly noticed just how many applications relied on it (common lisp,
for instance.)

I don't understand your statement about
"But once you've executed something in it you cannot write to it again."
Of course you can write into it and execute it again.

        - Godmar


Date view Thread view Subject view Author view

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