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

[RFC] Don't inline builtin memory functions when ASan is enabled.


Hi,

At this moment, most of GCC builtin memory functions (for example strcpy, stpcpy, wcpcpy, strdup, etc) are not instrumented by GCC, however some of them are rather dangerous. If GCC inlines these builtin functions, we will miss important checks for arguments, and possible overflow won't be detected. I know, that Clang ASan team simply disable inlining of builtin functions in Clang if -fsanitize=address is enabled and rely on libsanitizer's hooks.

The main benefit of this approach is that we won't miss overflow in builtins, that can significantly increase target programs safety. Also, some redundant checks will be removed for builtin functions, that are instrumented and are not inlined for some reasons.

The potential disadvantage of this approach is performance decreasing for sanitized programs.

Does disabling of builtin functions inlining look sane in this case? If yes, I can provide performance investigation and prepare the patch.

What do you think?

-Maxim


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