From: Vsevolod Stakhov Date: Wed, 25 Sep 2019 14:57:17 +0000 (+0100) Subject: [Minor] Disable asan for specific bad parts of the code X-Git-Tag: 2.0~127 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=53ee76478db9ef0ce457773b8b158fb30c381a39;p=thirdparty%2Frspamd.git [Minor] Disable asan for specific bad parts of the code --- diff --git a/config.h.in b/config.h.in index 57b887b857..f36a3a474f 100644 --- a/config.h.in +++ b/config.h.in @@ -370,6 +370,28 @@ typedef off_t goffset; #endif #endif +/* Address sanitizer */ +#ifdef __clang__ +# if __has_feature(address_sanitizer) +/* emulate gcc's __SANITIZE_ADDRESS__ flag */ +# define __SANITIZE_ADDRESS__ +# define RSPAMD_NO_SANITIZE \ + __attribute__((no_sanitize("address", "hwaddress"))) +# else +# define RSPAMD_NO_SANITIZE +# endif +#elif defined(__GNUC__) +/* GCC based */ +# if __has_attribute(__no_sanitize_address__) +# define RSPAMD_NO_SANITIZE __attribute__((no_sanitize_address)) +# else +# define RSPAMD_NO_SANITIZE +# endif +#else +# define RSPAMD_NO_SANITIZE +#endif + + #ifndef BITSPERBYTE # define BITSPERBYTE (NBBY * sizeof (char)) #endif diff --git a/contrib/lc-btrie/btrie.c b/contrib/lc-btrie/btrie.c index 8b598b09bb..6e529db901 100644 --- a/contrib/lc-btrie/btrie.c +++ b/contrib/lc-btrie/btrie.c @@ -632,7 +632,7 @@ static inline unsigned count_bits_from(tbm_bitmap_t bm, int b) /* extracts a few bits from bitstring, returning them as an integer */ static inline btrie_oct_t extract_bits(const btrie_oct_t *prefix, unsigned pos, - unsigned nbits) + unsigned nbits) RSPAMD_NO_SANITIZE { if (nbits == 0) return 0; diff --git a/contrib/t1ha/t1ha_bits.h b/contrib/t1ha/t1ha_bits.h index 799737d5fe..5710d2dbf3 100644 --- a/contrib/t1ha/t1ha_bits.h +++ b/contrib/t1ha/t1ha_bits.h @@ -120,10 +120,6 @@ #define __has_extension(x) (0) #endif -#if __has_feature(address_sanitizer) -#define __SANITIZE_ADDRESS__ 1 -#endif - #if __GNUC_PREREQ(4, 4) || defined(__clang__) #if defined(__ia32__) || defined(__e2k__)