svn commit: r354854 - head/sys/sys
David Bright
dab at FreeBSD.org
Tue Nov 19 14:46:29 UTC 2019
Author: dab
Date: Tue Nov 19 14:46:28 2019
New Revision: 354854
URL: https://svnweb.freebsd.org/changeset/base/354854
Log:
Don't sanitize linker_set
The assumptions of linker_set don't play nicely with
AddressSanitizer. AddressSanitizer adds a 'redzone' of zeros around
globals (including those in named sections), whereas linker_set
assumes they are all packed consecutively like a pointer array. So:
let's annotate linker_set so that AddressSanitizer ignores it.
Submitted by: Matthew Bryan <matthew.bryan at isilon.com>
Reviewed by: kib, rang_acm.org
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D22239
Modified:
head/sys/sys/cdefs.h
head/sys/sys/linker_set.h
Modified: head/sys/sys/cdefs.h
==============================================================================
--- head/sys/sys/cdefs.h Tue Nov 19 13:28:59 2019 (r354853)
+++ head/sys/sys/cdefs.h Tue Nov 19 14:46:28 2019 (r354854)
@@ -872,6 +872,13 @@
/* Function should not be analyzed. */
#define __no_lock_analysis __lock_annotate(no_thread_safety_analysis)
+/* Function or variable should not be sanitized, ie. by AddressSanitizer */
+#if __has_attribute(no_sanitize)
+#define __nosanitizeaddress __attribute__((no_sanitize("address")))
+#else
+#define __nosanitizeaddress
+#endif
+
/* Guard variables and structure members by lock. */
#define __guarded_by(x) __lock_annotate(guarded_by(x))
#define __pt_guarded_by(x) __lock_annotate(pt_guarded_by(x))
Modified: head/sys/sys/linker_set.h
==============================================================================
--- head/sys/sys/linker_set.h Tue Nov 19 13:28:59 2019 (r354853)
+++ head/sys/sys/linker_set.h Tue Nov 19 14:46:28 2019 (r354854)
@@ -61,6 +61,7 @@
__GLOBL(__CONCAT(__stop_set_,set)); \
static void const * qv \
__set_##set##_sym_##sym __section("set_" #set) \
+ __nosanitizeaddress \
__used = &(sym)
#define __MAKE_SET(set, sym) __MAKE_SET_QV(set, sym, __MAKE_SET_CONST)
#else /* !__GNUCLIKE___SECTION */
More information about the svn-src-head
mailing list