| 1 |
--- ElectricFence-2.2.2/page.c.jj 1999-04-11 17:45:26.000000000 -0400
|
| 2 |
+++ ElectricFence-2.2.2/page.c 2004-10-16 12:30:10.000000000 -0400
|
| 3 |
@@ -160,8 +160,9 @@ Page_DenyAccess(void * address, size_t s
|
| 4 |
void
|
| 5 |
Page_Delete(void * address, size_t size)
|
| 6 |
{
|
| 7 |
- if ( munmap((caddr_t)address, size) < 0 )
|
| 8 |
- Page_DenyAccess(address, size);
|
| 9 |
+ Page_DenyAccess(address, size);
|
| 10 |
+ /* Tell the kernel we will never need it again. */
|
| 11 |
+ madvise(address, size, MADV_DONTNEED);
|
| 12 |
}
|
| 13 |
|
| 14 |
#if defined(_SC_PAGESIZE)
|
| 15 |
--- ElectricFence-2.2.2/efence.c.jj 1999-04-12 21:00:49.000000000 -0400
|
| 16 |
+++ ElectricFence-2.2.2/efence.c 2004-10-16 13:11:30.000000000 -0400
|
| 17 |
@@ -626,10 +626,7 @@ memalign(size_t alignment, size_t userSi
|
| 18 |
address += internalSize - bytesPerPage;
|
| 19 |
|
| 20 |
/* Set up the "dead" page. */
|
| 21 |
- if ( EF_PROTECT_FREE )
|
| 22 |
- Page_Delete(address, bytesPerPage);
|
| 23 |
- else
|
| 24 |
- Page_DenyAccess(address, bytesPerPage);
|
| 25 |
+ Page_Delete(address, bytesPerPage);
|
| 26 |
|
| 27 |
/* Figure out what address to give the user. */
|
| 28 |
address -= userSize;
|
| 29 |
@@ -643,11 +640,8 @@ memalign(size_t alignment, size_t userSi
|
| 30 |
address = (char *)fullSlot->internalAddress;
|
| 31 |
|
| 32 |
/* Set up the "dead" page. */
|
| 33 |
- if ( EF_PROTECT_FREE )
|
| 34 |
- Page_Delete(address, bytesPerPage);
|
| 35 |
- else
|
| 36 |
- Page_DenyAccess(address, bytesPerPage);
|
| 37 |
-
|
| 38 |
+ Page_Delete(address, bytesPerPage);
|
| 39 |
+
|
| 40 |
address += bytesPerPage;
|
| 41 |
|
| 42 |
/* Set up the "live" page. */
|
| 43 |
@@ -777,10 +771,7 @@ free(void * address)
|
| 44 |
* in the hope that the swap space attached to those pages will be
|
| 45 |
* released as well.
|
| 46 |
*/
|
| 47 |
- if ( EF_PROTECT_FREE )
|
| 48 |
- Page_Delete(slot->internalAddress, slot->internalSize);
|
| 49 |
- else
|
| 50 |
- Page_DenyAccess(slot->internalAddress, slot->internalSize);
|
| 51 |
+ Page_Delete(slot->internalAddress, slot->internalSize);
|
| 52 |
|
| 53 |
previousSlot = slotForInternalAddressPreviousTo(slot->internalAddress);
|
| 54 |
nextSlot = slotForInternalAddress(
|