Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 08 Aug 1997 16:55:58 +0200
From:      Poul-Henning Kamp <phk@dk.tfs.com>
To:        Bill Paul <wpaul@skynet.ctr.columbia.edu>
Cc:        andreas@klemm.gtn.com (Andreas Klemm), current@freebsd.org
Subject:   Re: httpd in free(): warning: modified (page-) pointer. 
Message-ID:  <26184.871052158@critter.dk.tfs.com>
In-Reply-To: Your message of "Fri, 01 Aug 1997 02:24:07 EDT." <199708010624.CAA12780@skynet.ctr.columbia.edu> 

next in thread | previous in thread | raw e-mail | index | archive | help
In message <199708010624.CAA12780@skynet.ctr.columbia.edu>, Bill Paul writes:
>
>	o Electric Fence works by using mmap() to allocate memory instead
>	  of brk()/sbrk(). To trap out of bounds references, it allocates
>	  an extra page of memory immediately after the memory requested
>	  with malloc()/calloc()/etc and uses mprotect() to disallow
>	  read and write access to it.

This is why a similar feature hasn't been implemented into phkmalloc
yet, it would only give page size granularity, ie, you have to overrun
by a LOT before you can figure it out, I tried it, and it didn't find
one single problem in the two months I ran with it so I ditched it.

(Electric Fence does much more than this though)

I have a proof-of-concept patch that makes the kernel and the
VM system do the "Purify" memory-coloring thing.  I basically 
keep a shadow process which has in its address space the color
of it's "mate" memory, byte for byte.

It's very hairy and ugly, but it seems to work pretty good, 
although it is horribly slow, in that 92% of the memory accesses 
outside the text segment triggers a page fault.  You can do the
same thing with ptrace all in user-land, but that is even slower
since you have the additional overhead of two context switches
per instruction...

There is probably 2 manmonths work in it, before it is any good  :-(

--
Poul-Henning Kamp           | phk@FreeBSD.ORG       FreeBSD Core-team.
http://www.freebsd.org/~phk | phk@login.dknet.dk    Private mailbox.
whois: [PHK]                | phk@tfs.com           TRW Financial Systems, Inc.
Power and ignorance is a disgusting cocktail.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?26184.871052158>