-
Notifications
You must be signed in to change notification settings - Fork 102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ci: enable AddressSanitizer #3026
Conversation
Codecov Report
@@ Coverage Diff @@
## main #3026 +/- ##
==========================================
- Coverage 77.82% 77.71% -0.11%
==========================================
Files 1064 1056 -8
Lines 74408 73394 -1014
==========================================
- Hits 57906 57037 -869
+ Misses 16502 16357 -145 see 235 files with indirect coverage changes 📣 Codecov offers a browser extension for seamless coverage viewing on GitHub. Try it in Chrome or Firefox today! |
5370a6e
to
32c2f13
Compare
15d401c
to
5cd4c56
Compare
|
|
|
This, I imagine: https://github.com/google/sanitizers/wiki/AddressSanitizer#turning-off-instrumentation |
bbdd1a4
to
4a5defa
Compare
|
@AlanGriffiths Requesting you as a reviewer here since I modified some C++ stuff in a way that you might be interested in |
Ah it's breaking again 🤔 |
FullProbeStack.* and InputPlatformProbe.*These are failing (surprisingly only on clang) because |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly, I don't like the input hub rework.
Classes that own resources (wl_array*
in this case) should only manage that resource & data members should handle their own copy/assign semantics
#if defined(__SANITIZE_ADDRESS__) | ||
(void)udev_environment; | ||
(void)KilledByInvalidMemoryAccess; | ||
#else |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if silently passing the tests is the right pattern.
Having a list of tests excluded from running in sanitize builds seems better. (I think all "DeathTests" will be problematic - maybe just exclude them from the build?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I think so too. I wonder if I could disable them in a smarter way globally
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Have a
gtest_filter
list to exclude from the run - Move them to a separate file (or files) and don't build them
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For prior art see:
Lines 76 to 90 in 605712f
if(cmake_build_type_lower MATCHES "threadsanitizer") | |
if (NOT CMAKE_COMPILER_IS_GNUCXX) | |
find_program(LLVM_SYMBOLIZER llvm-symbolizer-3.6) | |
if (LLVM_SYMBOLIZER) | |
set(TSAN_EXTRA_OPTIONS "external_symbolizer_path=${LLVM_SYMBOLIZER}") | |
endif() | |
endif() | |
# Space after ${TSAN_EXTRA_OPTIONS} works around bug in TSAN env. variable parsing | |
list(APPEND test_env "TSAN_OPTIONS=\"suppressions=${CMAKE_SOURCE_DIR}/tools/tsan-suppressions second_deadlock_stack=1 halt_on_error=1 history_size=7 die_after_fork=0 ${TSAN_EXTRA_OPTIONS} \"") | |
# TSan does not support starting threads after fork | |
list(APPEND test_exclusion_filter "ThreadedDispatcherSignalTest.keeps_dispatching_after_signal_interruption") | |
# tsan "eats" SIGQUIT, so ignore two more tests that involve it | |
list(APPEND test_exclusion_filter "ServerSignal/AbortDeathTest.cleanup_handler_is_called_for/0") | |
list(APPEND test_exclusion_filter "ServerShutdown/OnSignalDeathTest.removes_endpoint/0") | |
endif() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just simplifying CopyableWlArray
Trying to figure out why the asan_clang build works locally but fails in Github actions right now |
Got the build error for clang asan:
|
We get many spurious failures in the asan build due to some threading issues, which isn't great... |
If we identify threading issues in our code we should be fixing them |
class CopyableWlArray | ||
{ | ||
public: | ||
explicit CopyableWlArray(wl_array* in_data) | ||
: data_{copy(in_data)} | ||
{ | ||
} | ||
|
||
CopyableWlArray(CopyableWlArray const& other) | ||
: CopyableWlArray{other.data_} | ||
{ | ||
} | ||
|
||
CopyableWlArray& operator=(CopyableWlArray other) | ||
{ | ||
std::swap(data_, other.data_); | ||
return *this; | ||
} | ||
|
||
~CopyableWlArray() | ||
{ | ||
wl_array_release(data_); | ||
} | ||
|
||
[[nodiscard]] wl_array* data() const | ||
{ | ||
return data_; | ||
} | ||
|
||
private: | ||
static wl_array* copy(wl_array* in_data) | ||
{ | ||
auto data = new wl_array(); | ||
wl_array_init(data); | ||
wl_array_copy(data, in_data); | ||
return data; | ||
} | ||
|
||
wl_array* data_; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fails to delete data_
, but the whole thing can be further simplfied...
class CopyableWlArray | |
{ | |
public: | |
explicit CopyableWlArray(wl_array* in_data) | |
: data_{copy(in_data)} | |
{ | |
} | |
CopyableWlArray(CopyableWlArray const& other) | |
: CopyableWlArray{other.data_} | |
{ | |
} | |
CopyableWlArray& operator=(CopyableWlArray other) | |
{ | |
std::swap(data_, other.data_); | |
return *this; | |
} | |
~CopyableWlArray() | |
{ | |
wl_array_release(data_); | |
} | |
[[nodiscard]] wl_array* data() const | |
{ | |
return data_; | |
} | |
private: | |
static wl_array* copy(wl_array* in_data) | |
{ | |
auto data = new wl_array(); | |
wl_array_init(data); | |
wl_array_copy(data, in_data); | |
return data; | |
} | |
wl_array* data_; | |
}; | |
class CopyableWlArray | |
{ | |
public: | |
explicit CopyableWlArray(wl_array const* in_data) | |
{ | |
wl_array_init(&data_); | |
wl_array_copy(&data_, const_cast<wl_array*>(in_data)); // wl_array_copy() doesn't mark source as const | |
} | |
CopyableWlArray(CopyableWlArray const& other) | |
: CopyableWlArray{&other.data_} | |
{ | |
} | |
CopyableWlArray& operator=(CopyableWlArray other) | |
{ | |
std::swap(data_, other.data_); | |
return *this; | |
} | |
~CopyableWlArray() | |
{ | |
wl_array_release(&data_); | |
} | |
[[nodiscard]] wl_array* data() const | |
{ | |
// Our generated `send_modifiers_map_event()` requires a non-const wl_array, so | |
// this workaround may be the wrong thing | |
return const_cast<wl_array*>(&data_); | |
} | |
private: | |
wl_array data_; | |
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not entirely sure about the StubInputPlatform rework.
The runner.cpp change is weird: the same incantation occurs in two other places and they are not changed.
But nothing I'll block on.
@mattkae I assume you are still investigating the ubuntu:asan_clang failure? |
Yup. Doesn't repro on my machine, testing some things out now |
Fixed & Cleaned up the commits. Just waiting on one last check 🤞 |
No description provided.