Skip to content

Fix tsan/asan/hwasan/etc failures on Android - #2229

Merged
LebedevRI merged 1 commit into
google:mainfrom
charlesmunger:unblock-g3-asan
Aug 27, 2026
Merged

Fix tsan/asan/hwasan/etc failures on Android#2229
LebedevRI merged 1 commit into
google:mainfrom
charlesmunger:unblock-g3-asan

Conversation

@charlesmunger

Copy link
Copy Markdown
Contributor

Some people run their benchmarks with sanitizers, and they should not spuriously fail.

This unblocks some test failures in google3

@LebedevRI

Copy link
Copy Markdown
Collaborator

Could you please adjust the commit message to contain the previous output of each of those lines?

@LebedevRI

Copy link
Copy Markdown
Collaborator

@charlesmunger poke

@LebedevRI

Copy link
Copy Markdown
Collaborator

@charlesmunger poke

@charlesmunger

Copy link
Copy Markdown
Contributor Author

I'm not sure what you mean? The asan allocator returns 0 for all mallopt calls regardless of the params. The output is just that the BM_CHECK triggers.

@LebedevRI

Copy link
Copy Markdown
Collaborator

I'm not sure what you mean? The asan allocator returns 0 for all mallopt calls regardless of the params. The output is just that the BM_CHECK triggers.

That's what the commit message should say. I'm just asking you to put the reasoning in the commit message.

@dmah42

dmah42 commented Aug 12, 2026

Copy link
Copy Markdown
Member

i don't suppose there's any way to check if we're under sanitizer at runtime? it would be great to keep this check when not running under sanitizer.

@LebedevRI

LebedevRI commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator

i don't suppose there's any way to check if we're under sanitizer at runtime? it would be great to keep this check when not running under sanitizer.

Sanitizers are compile-time opt-in, they can be detected the usual C way.
I'm not really sure what is the correct list of sanitizers that override mallopt, but i'd guess something like

#if __has_feature(address_sanitizer) || __has_feature(memory_sanitizer) || __has_feature(thread_sanitizer) || __has_feature(hwaddress_sanitizer)
// no BM_CHECK
#else
// can check return value
#end

@charlesmunger

Copy link
Copy Markdown
Contributor Author

I did try that at first, but new sanitizers are being added all the time, like dfsan and typesanitizer.

Some people run their benchmarks with sanitizers, and they should not spuriously fail. Asan and other sanitizer allocators return 0 for all mallopt calls, so the previous code was causing teh BM_CHECK to trigger.
@LebedevRI
LebedevRI merged commit 86d693b into google:main Aug 27, 2026
92 checks passed
@LebedevRI

Copy link
Copy Markdown
Collaborator

@charlesmunger thank you!

@charlesmunger
charlesmunger deleted the unblock-g3-asan branch August 28, 2026 01:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants