Skip to content
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

Add address, undefined behaviour, and thread sanitizer CI configurations #972

Merged
merged 6 commits into from
Jan 23, 2024

Conversation

msimberg
Copy link
Contributor

@msimberg msimberg commented Jan 16, 2024

Adds two new CI pipelines with sanitizers:

  • One with address (and leak, implicitly) and undefined behaviour sanitizers
  • One with thread sanitizer

The existing sanitizer CI configurations are unchanged.

The address sanitizer setup seems to pass for all tests, with some suppressions. detect_stack_use_after_return seems problematic so it's currently disabled (#992). Additionally, the task_overhead_report seems to trigger very high memory usage with address sanitizer. detect_stack_use_after_return may be triggering similar problems in other tests. A potential use-after-scope has been suppressed for now in bind (#993).

For thread sanitizer I've suppressed data races coming from various lockfree queues (#990), the MPSC queue (#989). I've also disabled stealing of pending threads on the local_* schedulers as thread sanitizer seems to dislike stacks migrating across OS threads (see 6a5b074 for more details).

In the interest of getting what works into main I'm going to go ahead with the current state of this PR without making the two new CI configurations required checks. The two already existing sanitizer CI configurations remain required checks. I'm going to continue working on the remaining failures in follow-up PRs.

@msimberg msimberg added this to the 0.22.0 milestone Jan 16, 2024
@msimberg msimberg self-assigned this Jan 16, 2024
@msimberg msimberg removed this from the 0.22.0 milestone Jan 19, 2024
@msimberg msimberg changed the title Add more sanitizer CI configurations Add address, undefined behaviour, and thread sanitizer CI configurations Jan 19, 2024
@msimberg
Copy link
Contributor Author

I'm going to ignore memory sanitizer in this PR, because it requires recompiling everything with -fsanitize=memory, or else it may report false positives (https://github.com/google/sanitizers/wiki/MemorySanitizer#using-instrumented-libraries). I've also commented on #63 regarding this.

@msimberg
Copy link
Contributor Author

cscs-ci run

@msimberg msimberg marked this pull request as ready for review January 22, 2024 17:40
@msimberg
Copy link
Contributor Author

cscs-ci run

@msimberg msimberg force-pushed the all-sanitizers branch 3 times, most recently from c5d5661 to 80822bb Compare January 22, 2024 19:05
@msimberg
Copy link
Contributor Author

cscs-ci run

Copy link
Contributor

@aurianer aurianer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM thanks a lot!

.github/workflows/linux_asan_ubsan_lsan.yml Show resolved Hide resolved
It appears that thread sanitizer is not safe to use with stacks that migrate between os threads. See
https://groups.google.com/g/boost-developers-archive/c/xNNhBnfhANA and
https://stackoverflow.com/questions/73358829/segfault-in-tsan-in-boost-ci-need-the-help-of-an-expert
for a case reported in Boost asio/beast. Stacktraces in pika tend to look like the following when
stealing is enabled:

```
)(pika::latch&), pika::util::detail::pack_c<unsigned long, 0ul>, std::reference_wrapper<pika::latch> > >::then_sender_type, std::allocator<int> >::ensure_started_sender_type::shared_state::set_predecessor_done (this=0x7b280000a640) at /home/mjs/src/pika/libs/pika/execution
/include/pika/execution/algorithms/ensure_started.hpp:26
```

Note, stealing of staged threads (thread descriptions) is not disabled, as they haven't allocated or
used a stack yet.
@msimberg
Copy link
Contributor Author

cscs-ci run

@msimberg msimberg added this pull request to the merge queue Jan 23, 2024
Merged via the queue into pika-org:main with commit eccbd1e Jan 23, 2024
52 of 55 checks passed
@msimberg msimberg added this to the 0.22.0 milestone Jan 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

2 participants