Re: A way to prevent buffer overflow exploits?

David L Moore <dlmoore@pgroup.com>
2 Aug 1998 23:54:29 -0400

          From comp.compilers

Related articles
Re: A way to prevent buffer overflow exploits? jhardin@wolfenet.com (1998-07-30)
Re: A way to prevent buffer overflow exploits? albaugh@agames.com (1998-07-31)
Re: A way to prevent buffer overflow exploits? anton@mips.complang.tuwien.ac.at (1998-07-31)
Re: A way to prevent buffer overflow exploits? toon@moene.indiv.nluug.nl (Toon Moene) (1998-08-02)
Re: A way to prevent buffer overflow exploits? dlmoore@pgroup.com (David L Moore) (1998-08-02)
Re: A way to prevent buffer overflow exploits? pizka@informatik.tu-muenchen.de (1998-08-03)
Re: A way to prevent buffer overflow exploits? fjh@cs.mu.OZ.AU (1998-08-04)
Re: A way to prevent buffer overflow exploits? bear@sonic.net (Ray Dillinger) (1998-08-10)
Re: A way to prevent buffer overflow exploits? eodell@pobox.com (1998-08-13)
Re: A way to prevent buffer overflow exploits? khays@sequent.com (1998-08-16)
Re: A way to prevent buffer overflow exploits? shriram@cs.rice.edu (Shriram Krishnamurthi) (1998-08-16)
[7 later articles]
| List of all articles for this month |

From: David L Moore <dlmoore@pgroup.com>
Newsgroups: comp.compilers
Date: 2 Aug 1998 23:54:29 -0400
Organization: Compilers Central
References: 98-07-242
Keywords: C, design

> I wonder how feasible it would be to modify GCC to generate code with
> two stacks (or something equivalent): one for local variables, the
> other for parameters and return addresses. Might moving the local
> variables away from the return addresses this way be a relatively cheap
> way to prevent buffer overflow exploits without having to recode all of
> the applications or using expensive bounds-checking?


It is not necessarily cheap. An extra page is required for the stack in
the cache. For machines with small numbers of pages in the primary
cache, this can get expensive.


A similar scheme can be useful with languages which allow variable size
objects on the stack. Stack based languages with first class
polymorphism, for example and languages with runtime parameterized
types. All objects of variable size get put on the second stack. This is
especially useful for variable sized function results as it saves a copy
upon function return.




Incidentally, the only member of this class of stack based languages
languages with first class polymorphism I know of is Ada 95. By first
class polymorphism I mean that it is possible to declare variables to
have polymorphic types in exactly the same situations that you can
declare objects of exact types. If there are other languages in the
class, please draw my attention to them. The two popular languages of
the moment are not; all Java objects are on the heap and C++ does not
have first class polymorphism.
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.