On Fri, Jun 20, 2014 at 02:49:12PM +0400, Maxim Ostapenko wrote: > This patch fixes invalid sanitization of trailing byte in __builtin_strlen ( > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61547). > > Tested on x86_64-unknown-linux-gnu, no regressions. > + > +#include <sanitizer/asan_interface.h> > + > +char a[2] = "0"; > + > +#ifdef __cplusplus > +extern "C" > +#endif > +__SIZE_TYPE__ strlen (const char *p) { > + /* Simulate error */ > + if (p == a) > + return 1;
Why this? Can't you instead just use __attribute__((no_sanitize_address, noinline)) on it instead? Otherwise looks good to me Jakub