First of all, let me state it once more that the sanitizers help a lot with finding bugs in large-scale projects. Thank you gentlemen for your effort!
Then, one of the ASAN wiki pages at: https://code.google.com/p/address-sanitizer/wiki/CompileTimeOptimizations discusses some ways to optimize instrumented code and thus addresses performance matters which is probably the most important issue with sanitizers. I thought that some optimization cases mentioned on this page could be handled by segregating the sanitizing code from the accesses themselves. In general, I think the task could be reworded from "Sanitize every memory **access**." to "Sanitize every **address** that is known to be dereferenced. (And do that as early as possible?)" Then, cases like this: int glob; int get_glob() { return glob; } can be handled trivially as it's known that sanitizing address of a variable referenced by name is a no-op--even for automatic locals, not just globals. Furthermore, there may be interesting consequences from switching to an approach of this kind. For example, if sanitizing code is segregated from accesses, then the optimizer has a chance to do some common and uncommon things about the first. An example for the common case would look like this: if (...) sanitize(a, ...); *a = ...; else sanitize(a, ...); *a = ...; optimized to: sanitize(a, ...); if (...) *a = ...; else *a = ...; Sanitize-specific optimizations would include things like this: struct { int a, b; } x; ... sanitize(&x.a, sizeof(x.a), ...); x.a = ...; sanitize(&x.b, sizeof(x.b), ...); x.b = ...; optimized to: struct _S { int a, b; } x; ... sanitize(&x.a, offsetof(_S, b) + sizeof(x.b), ...); x.a = ...; x.b = ...; etc... Will you have a chance, please let me know if you ever did consider this way. Thanks, -- You received this message because you are subscribed to the Google Groups "address-sanitizer" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
