Re: Copyovering on SIG{SEGV,BUS,..}

From: George (greerga@CIRCLEMUD.ORG)
Date: 04/30/98

On Thu, 30 Apr 1998, James Turner wrote:

>Another option would be to make a special allocator function that
>returns a block of memory with the top and bottom 4k (ie page size on
>x86's) protected with mprotect.  That would ensure against buffer
>overruns/underruns (at least decent-sized ones).  Only problem would
>be free() would have to take these into account.  I think glibc2 has a
>number of functions in the malloc family that can help get info on a
>block (including the pointer to the beginning of a malloc'd block).

If you look inside the glibc2 malloc library, there are functions called
'malloc_check,' 'free_check,' etc which would help in the case of
corrupting the malloc structures.  Unfortunately, they don't exist in
glibc2 by default.  You have to recompile the malloc library and link it
with your program.  You may be able to use the malloc 'hooks' feature but I
haven't tried that.

George Greer  -   | Genius may have its limitations, but stupidity | is not thus handicapped. -- Elbert Hubbard

     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | |

This archive was generated by hypermail 2b30 : 12/15/00 PST