diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2002-12-02 09:00:27 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2002-12-02 09:00:27 +0000 |
commit | 22703df0df76accb65607f28070a9771b5bb42de (patch) | |
tree | 2f2aa0ebf948ee4580b10bb0a41b7f258b40d0e8 /gnu/egcs/gcc/toplev.c | |
parent | 560fab27442ac85618b1720e90581c295ae1ea83 (diff) |
Import propolice (http://www.trl.ibm.com/projects/security/ssp), a stack
attack protection scheme, into gcc.
This protection is enabled by default. It can be turned off by using the
-fno-stack-protector flag.
Code by Hiroaki Etoh (etoh at jp dot ibm dot com); work on openbsd-specific
integration by fgsch@, deraadt@ and myself; tests by fgsch@, naddy@ and
myself; beer drinking by myself.
Please note that system upgrades with this new code will require a new
libc and ld.so to be build and installed before the propolice-enabled
compiler can be installed.
Diffstat (limited to 'gnu/egcs/gcc/toplev.c')
-rw-r--r-- | gnu/egcs/gcc/toplev.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/gnu/egcs/gcc/toplev.c b/gnu/egcs/gcc/toplev.c index 7b7f6a87fcb..56e9ab0a44f 100644 --- a/gnu/egcs/gcc/toplev.c +++ b/gnu/egcs/gcc/toplev.c @@ -772,6 +772,13 @@ int flag_instrument_function_entry_exit = 0; int flag_no_ident = 0; +#ifdef STACK_PROTECTOR +/* Nonzero means use propolice as a stack protection method */ +int flag_propolice_protection = 1; +#else +int flag_propolice_protection = 0; +#endif + /* Table of supported debugging formats. */ static struct { @@ -979,7 +986,11 @@ lang_independent_options f_options[] = {"leading-underscore", &flag_leading_underscore, 1, "External symbols have a leading underscore" }, {"ident", &flag_no_ident, 0, - "Process #ident directives"} + "Process #ident directives"}, + {"stack-protector", &flag_propolice_protection, 1, + "Enables stack protection" }, + {"no-stack-protector", &flag_propolice_protection, 0, + "Disables stack protection" }, }; #define NUM_ELEM(a) (sizeof (a) / sizeof ((a)[0])) @@ -1258,7 +1269,9 @@ lang_independent_options W_options[] = {"uninitialized", &warn_uninitialized, 1, "Warn about unitialized automatic variables"}, {"inline", &warn_inline, 1, - "Warn when an inlined function cannot be inlined"} + "Warn when an inlined function cannot be inlined"}, + {"stack-protector", &warn_stack_protector, 1, + "Warn when disabling stack protector for some reason"} }; /* Output files for assembler code (real compiler output) @@ -3646,6 +3659,8 @@ rest_of_compilation (decl) insns = get_insns (); + if (flag_propolice_protection) prepare_stack_protection (); + /* Dump the rtl code if we are dumping rtl. */ if (rtl_dump) |