Path: nntp.gmd.de!xlink.net!howland.reston.ans.net!usc!nic-nac.CSU.net!
charnel.ecst.csuchico.edu!olivea!news.hal.COM!halsoft.com!news.halsoft.com!
connolly
From: conno...@ulua.hal.com (Dan Connolly)
Newsgroups: comp.os.linux.development,comp.lang.modula3
Subject: mprotect() support in Linux kernel?
Date: 09 Sep 1994 22:47:56 GMT
Organization: HaL Software Systems, Inc.
Lines: 74
Distribution: world
Message-ID: <CONNOLLY.94Sep9174756@ulua.hal.com>
References: <CONNOLLY.94Sep8153413@ulua.hal.com> <34q7ub$6k4@src-news.pa.dec.com>
NNTP-Posting-Host: ulua.halsoft.com
In-reply-to: kalsow@src.dec.com's message of 9 Sep 1994 18:01:47 GMT


I'm interested in enhancing the Linux port of Modula 3 to use
incremental/generational garbage collection. This requires support for
the mprotect() library routine, or its equivalent.

However, it appears that mprotect() is not supported under Linux:

In linux/mm/mmap.c, I see:
230  asmlinkage int sys_mprotect(unsigned long addr, size_t len, unsigned long prot)
231  {
232          return -EINVAL; /* Not implemented yet */
233  }

mprotect() is in /usr/include/sys/mman.h, but there's no linux man page
(that I can find) for mprotect.

In the Kernel Hackers guide at
http://sunsite.unc.edu/mdw/LDP/khg/section2.7.1.html
I see:

	Minor alterations are needed in some places (tests for process
	memory limits comes to mind) to provide support for programmer
	defined segments.


So I guess for now, I'm out of luck. I'm willing to hack the modula-3
runtime, but it would take me a while to ramp up on the Linux kernel
memory management.

Have I found the most recent info? Is there a more recent version of
the kernel that supports mprotect()? Is anyone working on support for
this? Is there a different library function that would serve my needs?

Thanks.

Dan


In article <34q7ub$...@src-news.pa.dec.com> kal...@src.dec.com (Bill Kalsow) 
writes:

   From: kal...@src.dec.com (Bill Kalsow)
   Newsgroups: comp.lang.modula3
   Date: 9 Sep 1994 18:01:47 GMT
   Organization: DEC Systems Research Center

   In article <CONNOLLY.94Sep8153...@ulua.hal.com>, conno...@ulua.hal.com 
(Dan Connolly) writes:
   > 	* the garbage collection isn't synchronized with the virtual
   > 	  memory system. Same two questions:
   > 		-- is this likely to impact performance noticeably?

   Yes.  The star-trek cursor appears during the stop-and-copy collections.
   With the VM synchronization you get incremental and generational
   collections.  The pauses would be invisible.

   > 		-- Would someone with experience guestimate the amount
   > 		   of work to make the appropriate enhancements?

   It's not much work:
     - It must be possible to protect and unprotect data pages,
       and the signal handler for memory access violations must be able
       to determine the offending address and resume from the
       signal.  See runtime/src/{DS3100,SPARC}/RTHeapDep.[im]3.

     - The system calls need wrappers that validate their arguments
       before making the call.  See runtime/src/{DS3100,SPARC}/RTHeapDepC.c.

The source code he refers to is available at:

	http://www.research.digital.com/SRC/m3sources/html/runtime/src/SPARC/RTHeapDep.m3

-- 
Daniel W. Connolly        "We believe in the interconnectedness of all things"
Software Engineer, Hal Software Systems, OLIAS project   (512) 834-9962 x5010
<conno...@hal.com>                   http://www.hal.com/%7Econnolly/index.html

Path: nntp.gmd.de!xlink.net!howland.reston.ans.net!cs.utexas.edu!uunet!
zib-berlin.de!zrz.TU-Berlin.DE!banach.math.tu-berlin.de!goldt
From: go...@math.tu-berlin.de (Sven Goldt)
Newsgroups: comp.os.linux.development,comp.lang.modula3
Subject: Re: mprotect() support in Linux kernel?
Followup-To: comp.os.linux.development,comp.lang.modula3
Date: 10 Sep 1994 02:00:15 GMT
Organization: FB3, TU-Berlin, Germany.
Lines: 14
Distribution: world
Message-ID: <34r3vf$3g9@brachio.zrz.TU-Berlin.DE>
References: <CONNOLLY.94Sep8153413@ulua.hal.com> <34q7ub$6k4@src-news.pa.dec.com> 
<CONNOLLY.94Sep9174756@ulua.hal.com>
NNTP-Posting-Host: banach.math.tu-berlin.de
X-Newsreader: TIN [version 1.2 PL2]

Dan Connolly (conno...@ulua.hal.com) wrote:

: I'm interested in enhancing the Linux port of Modula 3 to use
: incremental/generational garbage collection. This requires support for
: the mprotect() library routine, or its equivalent.

: However, it appears that mprotect() is not supported under Linux:

It is implemented in newer kernels. Look at the Linux Programmer's Guide.

--
*****************************************************************************
*    # THE MOST IMPORTANT FINANCIAL QUESTION IS:  Where is the money ? #    *
*****************************************************************************

Path: nntp.gmd.de!xlink.net!howland.reston.ans.net!EU.net!Germany.EU.net!
netmbx.de!zrz.TU-Berlin.DE!cs.tu-berlin.de!zib-berlin.de!news.belwue.de!
news.uni-ulm.de!rz.uni-karlsruhe.de!ma2s3!haible
From: hai...@ma2s2.mathematik.uni-karlsruhe.de (Bruno Haible)
Newsgroups: comp.os.linux.development,comp.lang.modula3
Subject: Re: mprotect() support in Linux kernel?
Date: 12 Sep 1994 13:21:20 GMT
Organization: University of Karlsruhe, Germany
Lines: 144
Message-ID: <351kkg$g5n@nz12.rz.uni-karlsruhe.de>
References: <CONNOLLY.94Sep8153413@ulua.hal.com> <34q7ub$6k4@src-news.pa.dec.com> 
<CONNOLLY.94Sep9174756@ulua.hal.com> <34r3vf$3g9@brachio.zrz.tu-berlin.de>
NNTP-Posting-Host: ma2s3.mathematik.uni-karlsruhe.de
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
Keywords: linux, gc, mprotect
X-Mn-Key: KERNEL
Originator: haible@ma2s3

Sven Goldt <go...@math.tu-berlin.de> wrote:
>
>: However, it appears that mprotect() is not supported under Linux:
>
> It is implemented in newer kernels.

mprotect() still needs the following three patches to work properly.

The first one ensures that the reference count of an mmap'ed file is
decremented when adjacent vm_areas are merged (because it is incremented
when a vm_area is splitted). The second and third one provide proper
management of the vm_area_struct list.


                    Bruno Haible
                    hai...@ma2s2.mathematik.uni-karlsruhe.de


Patches