gcc stack-smashing protector (for gcc-3.0)
Hiroaki Etoh
etoh@trl.ibm.co.jp
Thu Jun 28 05:02:00 GMT 2001
This patch introduces -fstack-protector option, which is a stack-smashing
protection mechanism to the latest release (3.0).
This patch and new files (protector.h and protector.c) are bootstraped
and tested on
i386-pc-linux-gnu,
powerpc-ibm-aix4.3.3.0
sparc-sun-solaris2.6.
It means that gcc with stack-protection=on also is bootstraped and tested.
Please see the web page
( http://www.trl.ibm.com/projects/security/ssp/ ) for details and
what is a stack-smashing protection.
Hiroaki Etoh, Tokyo Research Laboratory, IBM Japan
2001-05-18 Hiroaki Etoh <etoh@jp.ibm.com>
* Add -fstack-protector option, which enables generating the stack
protection code to detect buffer overflow and the stop its
execution
* protector.c: New file
* protector.h: New file
* Makefile.in: Add new file protector.c and new library member
_stack_smash_handler in libgcc2.c
* cse.c (cse_insn): Don't record equivalence of the register that
duplicates a pointer in a function argument to prevent the corruption
of buffer overflow
* expr.c (expand_expr): Specify EXPAND_NORMAL in stead of EXPAND_SUM
as an argument of expand_expr in the case of stack smashing protection
* function.c (assign_stack_temp_for_type, combine_temp_slots): Add the
special handling of character buffer for the reuse of
allocated stack space
function.c (put_reg_into_stack): Change the location of allocated
stack area for the spilled-out pseuso register in the case of stack
smashing protection
* gcse.c (cprop_insn): Don't eliminate the register that duplicates
a pointer in a function argument to prevent the corruption
of buffer overflow
* libgcc2.c (__guard_setup, __stack_smash_handler): New function.
* reload1.c (alter_reg): Change the location of allocated stack area
for the spilled-out pseuso register in the case of
stack smashing protection
* toplev.c (rest_of_compilation, f_options): Add the function of
stack smashing protection
More information about the Gcc-patches
mailing list