Skip to content

Add the ability to run tests on the standalone Dart VM under Address Sanitizer, Memory Sanitizer or Thread Sanitizer.#2575

Open
rmacnak-google wants to merge 1 commit intodart-lang:masterfrom
rmacnak-google:sanitize
Open

Add the ability to run tests on the standalone Dart VM under Address Sanitizer, Memory Sanitizer or Thread Sanitizer.#2575
rmacnak-google wants to merge 1 commit intodart-lang:masterfrom
rmacnak-google:sanitize

Conversation

@rmacnak-google
Copy link
Contributor

@rmacnak-google rmacnak-google commented Dec 8, 2025

This is useful for finding issues when using foreign libraries through dart:ffi, such as use-after-free, use of initialized memory and data races.

This is also useful for pure Dart programs that might have data races through the use of shared fields.

Only available on 64-bit Linux.

https://clang.llvm.org/docs/AddressSanitizer.html
https://clang.llvm.org/docs/MemorySanitizer.html
https://clang.llvm.org/docs/ThreadSanitizer.html

@rmacnak-google rmacnak-google requested a review from a team as a code owner December 8, 2025 22:59
@github-actions
Copy link

github-actions bot commented Dec 8, 2025

PR Health

Changelog Entry ✔️
Package Changed Files

Changes to files need to be accounted for in their respective changelogs.

This check can be disabled by tagging the PR with skip-changelog-check.

@github-actions github-actions bot added the type-infra A repository infrastructure change or enhancement label Dec 8, 2025
@rmacnak-google rmacnak-google force-pushed the sanitize branch 2 times, most recently from 71c3dbd to 123dfdb Compare December 8, 2025 23:25
Copy link
Member

@natebosch natebosch left a comment

Choose a reason for hiding this comment

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

Can you edit the first comment on the PR to add some details about this change and the motivation? We can use the first comment to decide the content of the final commit message when this lands.

process.exitCode.then((exitCode) async {
if (exitCode != 0) {
// At least don't hang.
exit(exitCode);
Copy link
Member

Choose a reason for hiding this comment

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

We have had difficulty in the past using a direct exit call from the test runner, I don't think we should land another.

What are the scenarios where this would hang?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When the sanitizers exit the child, the parent was hanging. This is hacky, and probably the real issue is the consumer of the socket created between parent and child is failing to react to a disconnect, but I haven't found that code yet.

Copy link
Member

Choose a reason for hiding this comment

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

Is the repro for this the one in #2577 ?

I started digging on that before the holidays but I hadn't made much progress. I'll spend some more time on it and see if I can make any headway. I'd prefer if we can land this without a potential call to exit but if we need something in the short term we can maybe leave it as a TODO.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah. Anything that crashes or directly exits with -c exe should reproduce the issue. This is exit code forwarding is at least limited to -c exe and so won't affect the default way of running.

@github-actions github-actions bot removed the type-infra A repository infrastructure change or enhancement label Dec 9, 2025
@rmacnak-google rmacnak-google force-pushed the sanitize branch 9 times, most recently from ebf452d to 879394d Compare December 9, 2025 23:49
@rmacnak-google rmacnak-google changed the title wip: sanitizers Add the ability to run tests on the standalone Dart VM under Address Sanitizer, Memory Sanitizer or Thread Sanitizer. Dec 16, 2025
@rmacnak-google rmacnak-google force-pushed the sanitize branch 3 times, most recently from db84acc to 2fc1eb8 Compare December 16, 2025 21:26
@github-actions github-actions bot added the type-infra A repository infrastructure change or enhancement label Dec 16, 2025
…Sanitizer, Memory Sanitizer or Thread Sanitizer.
@github-actions github-actions bot removed the type-infra A repository infrastructure change or enhancement label Dec 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants