ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
July 17th, 2024 | 10:00am-11:55am SGT (UTC+8) | Online

Ethereal-dev: Re: [Ethereal-dev] Canary checking added to emem.c

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Jaap Keuter <jaap.keuter@xxxxxxxxx>
Date: Tue, 10 Jan 2006 00:39:54 +0100 (CET)
On Tue, 10 Jan 2006, Ulf Lamping wrote:

> Gerald Combs wrote:
>
> >I just checked in a change to emem.c that adds canary values after each
> >memory allocation.  It should let us identify overflows of any ep_ and
> >se_ allocated memory.  Hopefully it won't add too much processing
> >overhead.  If this works, the next step is to place mprotect()ed guard
> >pages before and after each chunk.
> >
>
> Hmmm, maybe the goddess of canary checking might add some explanation ...
>
> I don't have a clue what this is all about :-(

It's a trick to put a specific value (the canary) at the top of the stack
frame or end of allocated buffer. When the stack frame of buffer is
released, the canary should still be there. If not the code has reached
too far up the stack or into the buffer, indicating an error.

Check this paper on stackguard:
http://gcc.fyxm.net/summit/2003/Stackguard.pdf

Thanx,
Jaap