chicken-hackers
[Top][All Lists]
Advanced

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

[Chicken-hackers] Re: mprotect on malloc'ed memory?


From: Ivan Shmakov
Subject: [Chicken-hackers] Re: mprotect on malloc'ed memory?
Date: Fri, 23 Nov 2007 21:10:34 +0600
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux)

>>>>> "fw" == felix winkelmann <address@hidden> writes:

 >> um, if im understading the openbsd pages right, it might work, but
 >> it wont necessarily protect only the page.  according to POSIX, its
 >> not undefined, its an error to use mprotect on anything but mmapped
 >> regions.  at a guess, even if it does happen to work, you'll be
 >> looking at a lifetime of unpredictable and undebuggable SIGSEGVs.
 >> may i ask the intended purpose of mprotecting regular memory?

 > As a rather handy debugging aid: my making the current tospace (the
 > unused half of the heap) non-accessable, usage of dead memory can be
 > found (which happens frequently in FFI code by keeping references to
 > already GC'd memory).  It's just an optional debugging feature for
 > the situations where you need every help you can get.

        You could use mmap () (where available) to allocate the heap and
        use mprotect () on it afterwards.  An option (either compile- or
        run-time) to control which way the heap is allocated is to be
        added then.





reply via email to

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