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]

[PATCH] Updated buffer overflow protection patch


Hi!

For details see
http://gcc.gnu.org/ml/gcc-patches/2004-09/msg02055.html
Preconditions of this patch are
http://gcc.gnu.org/ml/gcc-patches/2004-09/msg02060.html
http://gcc.gnu.org/ml/gcc-patches/2004-09/msg02388.html

What changed is the __builtin_object_size () computation,
while in the previous patch it was done as part of alias analysis,
this turned out to be inappropriate, as we need different kind
of propagation of the object sizes.
Problematic were some loops in which object sizes have been
computed incorrectly (all added to the testsuite).
Now is __builtin_object_size () computed for non-variables
at any fold time and for variables in a separate pass which is
run before SSA-CCP (the results need to be constant propagated
and are usually used by fold_all_builtin pass later on for the
__*_chk builtins).
Also, the patch now checks string ops which already start
outside of the original object.
Say
#define _FORTIFY_SOURCE 1
#include <string.h>
char buf[10];
memcpy (buf + 10, baz, 1);
will now issue a warning and runtime failure when that code is
run.

	Jakub

Attachment: gcc4-chk.patch
Description: Text document


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