This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Deliberate padding between static and stack variables?


 > What would be great is some co-operation from the compiler, which is
 > usually GCC.  Imagine if there was an option --pad-static-vars=N.
 > Then Memcheck/Addrcheck could mark all the static variables as
 > accessible -- using either symbol information or debugging information
 > -- and all the other parts of static memory could be marked as
 > inaccessible.  (The 'N' could let you choose the redzone size, in
 > bytes.)  You could have a similar option --pad-stack-vars=N for the
 > stack, and Memcheck/Addrcheck would handle those variables similarly.
 > 
 > And voila!  Memcheck/Addrcheck could detect static and stack overruns.
 > This would be very cool; we just ran a survey of Valgrind users, and
 > several people stated that they wanted static and/or stack checking.
 > 
 > N

Take a look at StackGuard, presented at the GCC Summit a few months
ago.  It sounds similar to what you want to do.  It's designed as a
security measure for buffer overruns rather than programmer error, but
the concept is similar.  (They call it a "canary" rather than a
"redzone".)

http://www.linux.org.uk/~ajh/gcc/gccsummit-2003-proceedings.pdf
http://www.immunix.com/~wagle/stackguard.html

		Hope this helps,
		--Kaveh
--
Kaveh R. Ghazi			ghazi@caip.rutgers.edu


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]