mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2026-02-23 01:40:43 -05:00
test-runner: Disable address sanitization on .test_section
Clang inserts red-zones around allocations in user defined section, which break
the common assumption that objects are densely packed. The test runner uses this
trick to construct an array of test objects, which causes asan violations when
iterating over the array.
This can be disabled by adding __attribute__((no_sanitize("address"))) to each
object in the section.
See https://github.com/google/sanitizers/issues/1028 for more discussion of this issue.
Signed-off-by: Fergus Dall <sidereal@google.com>
This commit is contained in:
parent
b7153f2273
commit
d42a6ac39a
1 changed files with 10 additions and 2 deletions
|
|
@ -37,11 +37,18 @@ struct test {
|
|||
int must_fail;
|
||||
} __attribute__ ((aligned (16)));
|
||||
|
||||
#if defined(__clang__)
|
||||
#define SUPPRESS_ASAN __attribute__ ((no_sanitize("address")))
|
||||
#else
|
||||
#define SUPPRESS_ASAN
|
||||
#endif
|
||||
|
||||
#define TEST(name) \
|
||||
static void name(void); \
|
||||
\
|
||||
const struct test test##name \
|
||||
__attribute__ ((used, section ("test_section"))) = { \
|
||||
SUPPRESS_ASAN \
|
||||
__attribute__ ((used, section ("test_section"))) = { \
|
||||
#name, name, 0 \
|
||||
}; \
|
||||
\
|
||||
|
|
@ -51,7 +58,8 @@ struct test {
|
|||
static void name(void); \
|
||||
\
|
||||
const struct test test##name \
|
||||
__attribute__ ((used, section ("test_section"))) = { \
|
||||
SUPPRESS_ASAN \
|
||||
__attribute__ ((used, section ("test_section"))) = { \
|
||||
#name, name, 1 \
|
||||
}; \
|
||||
\
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue