This is the mail archive of the gcc-patches@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]

gcc stack-smashing protector (for gcc-3.2.1)


 This patch introduces -fstack-protector option, which is a stack-smashing 
protection mechanism to the latest release (3.2.1).
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

Gcc with protect only option also is bootstraped and tested. 

Please see the web page for further information.
(http://www.trl.ibm.com/projects/security/ssp/)

Hiroaki Etoh,  Tokyo Research Laboratory, IBM Japan

2002-08-27  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
	* flags.h: add flag_propolice_protection and warn_stack_protector
	* 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 (move_by_pieces, clear_by_pieces):  Change the start address
	not to use the address out of range of a structure.
	as an argument of expand_expr in the case of stack smashing protection
	  expr.c (expand_expr): Keep the access pattern of a local variable
	at the both-summands processing
	* 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
	  function.c (instantiate_virtual_regs_1): Keep the pattern
	(plus (FP const)), not to generate (set R FP) (.... (plus R const))
	* gcse.c (cprop_insn): Don't eliminate the register that duplicates
	a pointer in a function argument to prevent the corruption
	of buffer overflow
	* optabs.c (expand_binop): Keep the access pattern of a local variable
	(plus VFP const).
	* simplify-rtx.c (simplify_plus_minus): Keep the pattern
	(plus VFP const).
	* combine.c (combine_simplify_rtx): Keep the pattern
	(plus (plus FP const) B), not to generate (plus (plus (FP B) const))
	from (plus (plus (FP const) B))
	* explow.c (memory_address): Keep the pattern (plus (VFP const))
	* 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

Attachment: protector.h
Description: Text document

Attachment: protector.c
Description: Text document

Attachment: protector.dif
Description: Text document

Attachment: protectonly.dif
Description: Text document


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