diff options
author | David Lamparter <equinox@diac24.net> | 2021-04-15 06:26:45 +0200 |
---|---|---|
committer | David Lamparter <equinox@diac24.net> | 2021-04-15 06:27:34 +0200 |
commit | 1b958b2ef862cd6ccc000270abd7d5cec314cd04 (patch) | |
tree | e37633da6b2a225e6a3b4c613440893436f05ca4 | |
parent | Merge pull request #8003 from donaldsharp/timings (diff) | |
download | frr-1b958b2ef862cd6ccc000270abd7d5cec314cd04.tar.xz frr-1b958b2ef862cd6ccc000270abd7d5cec314cd04.zip |
lib: disable ASAN redzone around xref_p/xref_array
The "xref_p" variables are placed in the "xref_array" section
specifically so they're next to each other and we get an array at the
end. The ASAN redzone that is inserted around global variables is
breaks that since it'd be inserted before and after each of the array
items. So disable the ASAN redzone for these variables (and only these
variables, nothing else should be affected.)
Signed-off-by: David Lamparter <equinox@diac24.net>
-rw-r--r-- | lib/xref.h | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/lib/xref.h b/lib/xref.h index b1cb172b4..63166b069 100644 --- a/lib/xref.h +++ b/lib/xref.h @@ -137,6 +137,19 @@ extern void xref_gcc_workaround(const struct xref *xref); extern const struct xref * const __start_xref_array[1] DSO_LOCAL; extern const struct xref * const __stop_xref_array[1] DSO_LOCAL; +#if defined(__has_feature) +#if __has_feature(address_sanitizer) +/* no redzone around each of the xref_p please, we're building an array out + * of variables here. kinda breaks things if there's redzones between each + * array item. + */ +#define xref_array_attr used, section("xref_array"), no_sanitize("address") +#endif +#endif +#ifndef xref_array_attr +#define xref_array_attr used, section("xref_array") +#endif + /* this macro is invoked once for each standalone DSO through * FRR_MODULE_SETUP \ * }-> FRR_COREMOD_SETUP -> XREF_SETUP @@ -151,8 +164,7 @@ extern const struct xref * const __stop_xref_array[1] DSO_LOCAL; /* .func = */ "dummy", \ }; \ static const struct xref * const _dummy_xref_p \ - __attribute__((used, section("xref_array"))) \ - = &_dummy_xref; \ + __attribute__((xref_array_attr)) = &_dummy_xref; \ static void __attribute__((used, _CONSTRUCTOR(1100))) \ _xref_init(void) { \ static struct xref_block _xref_block = { \ @@ -225,7 +237,7 @@ extern const struct xref * const __stop_xref_array[1] DSO_LOCAL; #if defined(__clang__) || !defined(__cplusplus) #define XREF_LINK(dst) \ static const struct xref * const NAMECTR(xref_p_) \ - __attribute__((used, section("xref_array"))) \ + __attribute__((xref_array_attr)) \ = &(dst) \ /* end */ |