Skip to content

[mimalloc] Error on mimalloc + ASan #23314

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

Merged
merged 5 commits into from
Jan 7, 2025

Conversation

kripken
Copy link
Member

@kripken kripken commented Jan 6, 2025

mimalloc is not meant to be used with ASan in general, see

#23288 (comment)

Fixes #23288

@kripken kripken requested a review from sbc100 January 6, 2025 20:05
@@ -2369,6 +2369,9 @@ def add_sanitizer_libs():
add_library('libc')
if settings.MALLOC == 'mimalloc':
add_library('libmimalloc')
if settings.USE_ASAN:
# See https://github.com/emscripten-core/emscripten/issues/23288#issuecomment-2571648258
shared.exit_with_error('mimalloc should not be used with asan')
Copy link
Collaborator

Choose a reason for hiding this comment

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

mimalloc is not compatible with with asan?

Or "not currently" maybe?

Copy link
Member Author

Choose a reason for hiding this comment

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

It sounded from the mimalloc people's responses there that this was by design (ASan uses its own allocator), IIUC.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Sure, then 'mimalloc is not compatible with with asan' maybe?

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

Copy link
Collaborator

@sbc100 sbc100 left a comment

Choose a reason for hiding this comment

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

lgtm either way

@@ -15209,6 +15209,11 @@ def test_wasm64_no_asan(self):
err = self.expect_fail([EMCC, test_file('hello_world.c'), '-sMEMORY64', '-fsanitize=address'])
self.assertContained('error: MEMORY64 does not yet work with ASAN', err)

def test_mimalloc_no_asan(self):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Are there other mimalloc tests that this can be grouped with?

Copy link
Member Author

Choose a reason for hiding this comment

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

I grouped this with the other asan test right above, which it is parallel to?

def test_mimalloc_no_asan(self):
# See https://github.com/emscripten-core/emscripten/issues/23288#issuecomment-2571648258
err = self.expect_fail([EMCC, test_file('hello_world.c'), '-sMALLOC=mimalloc', '-fsanitize=address'])
self.assertContained('error: mimalloc is not compatible with with -fsanitize=address', err)
Copy link
Contributor

Choose a reason for hiding this comment

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

How about this?

Suggested change
self.assertContained('error: mimalloc is not compatible with with -fsanitize=address', err)
self.assertContained('error: mimalloc is not compatible with -fsanitize=address', err)

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks @mighty1231 !

@kripken kripken merged commit 169c517 into emscripten-core:main Jan 7, 2025
29 checks passed
@kripken kripken deleted the mimalloc.no-asan branch January 7, 2025 19:18
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.

mimalloc + address sanitizer + std::map(w/length > 1) = error
3 participants