[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-hackers] mprotect on malloc'ed memory?
From: |
felix winkelmann |
Subject: |
Re: [Chicken-hackers] mprotect on malloc'ed memory? |
Date: |
Tue, 20 Nov 2007 08:01:18 +0100 |
On Nov 20, 2007 4:16 AM, Elf <address@hidden> wrote:
>
> 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.
cheers,
felix