|
|
94c734 |
--- ElectricFence-2.2.2/page.c.jj 1999-04-11 17:45:26.000000000 -0400
|
|
|
94c734 |
+++ ElectricFence-2.2.2/page.c 2004-10-16 12:30:10.000000000 -0400
|
|
|
94c734 |
@@ -160,8 +160,9 @@ Page_DenyAccess(void * address, size_t s
|
|
|
94c734 |
void
|
|
|
94c734 |
Page_Delete(void * address, size_t size)
|
|
|
94c734 |
{
|
|
|
94c734 |
- if ( munmap((caddr_t)address, size) < 0 )
|
|
|
94c734 |
- Page_DenyAccess(address, size);
|
|
|
94c734 |
+ Page_DenyAccess(address, size);
|
|
|
94c734 |
+ /* Tell the kernel we will never need it again. */
|
|
|
94c734 |
+ madvise(address, size, MADV_DONTNEED);
|
|
|
94c734 |
}
|
|
|
94c734 |
|
|
|
94c734 |
#if defined(_SC_PAGESIZE)
|
|
|
94c734 |
--- ElectricFence-2.2.2/efence.c.jj 1999-04-12 21:00:49.000000000 -0400
|
|
|
94c734 |
+++ ElectricFence-2.2.2/efence.c 2004-10-16 13:11:30.000000000 -0400
|
|
|
94c734 |
@@ -626,10 +626,7 @@ memalign(size_t alignment, size_t userSi
|
|
|
94c734 |
address += internalSize - bytesPerPage;
|
|
|
94c734 |
|
|
|
94c734 |
/* Set up the "dead" page. */
|
|
|
94c734 |
- if ( EF_PROTECT_FREE )
|
|
|
94c734 |
- Page_Delete(address, bytesPerPage);
|
|
|
94c734 |
- else
|
|
|
94c734 |
- Page_DenyAccess(address, bytesPerPage);
|
|
|
94c734 |
+ Page_Delete(address, bytesPerPage);
|
|
|
94c734 |
|
|
|
94c734 |
/* Figure out what address to give the user. */
|
|
|
94c734 |
address -= userSize;
|
|
|
94c734 |
@@ -643,11 +640,8 @@ memalign(size_t alignment, size_t userSi
|
|
|
94c734 |
address = (char *)fullSlot->internalAddress;
|
|
|
94c734 |
|
|
|
94c734 |
/* Set up the "dead" page. */
|
|
|
94c734 |
- if ( EF_PROTECT_FREE )
|
|
|
94c734 |
- Page_Delete(address, bytesPerPage);
|
|
|
94c734 |
- else
|
|
|
94c734 |
- Page_DenyAccess(address, bytesPerPage);
|
|
|
94c734 |
-
|
|
|
94c734 |
+ Page_Delete(address, bytesPerPage);
|
|
|
94c734 |
+
|
|
|
94c734 |
address += bytesPerPage;
|
|
|
94c734 |
|
|
|
94c734 |
/* Set up the "live" page. */
|
|
|
94c734 |
@@ -777,10 +771,7 @@ free(void * address)
|
|
|
94c734 |
* in the hope that the swap space attached to those pages will be
|
|
|
94c734 |
* released as well.
|
|
|
94c734 |
*/
|
|
|
94c734 |
- if ( EF_PROTECT_FREE )
|
|
|
94c734 |
- Page_Delete(slot->internalAddress, slot->internalSize);
|
|
|
94c734 |
- else
|
|
|
94c734 |
- Page_DenyAccess(slot->internalAddress, slot->internalSize);
|
|
|
94c734 |
+ Page_Delete(slot->internalAddress, slot->internalSize);
|
|
|
94c734 |
|
|
|
94c734 |
previousSlot = slotForInternalAddressPreviousTo(slot->internalAddress);
|
|
|
94c734 |
nextSlot = slotForInternalAddress(
|