-
Notifications
You must be signed in to change notification settings - Fork 3.4k
mimalloc + address sanitizer + std::map(w/length > 1) = error #23288
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
Comments
I tried |
When I do
I get a type 1 result on latest git:
I then enabled all assertions: diff --git a/tools/system_libs.py b/tools/system_libs.py
index ef896f6ec..a672580e9 100644
--- a/tools/system_libs.py
+++ b/tools/system_libs.py
@@ -1806,9 +1806,9 @@ class libmimalloc(MTLibrary):
# build mimalloc with an override of malloc/free
'-DMI_MALLOC_OVERRIDE',
# TODO: add build modes that include debug checks 1,2,3
- '-DMI_DEBUG=0',
+ '-DMI_DEBUG=3',
# disable `assert()` in the underlying emmalloc allocator
- '-DNDEBUG',
+ #'-DNDEBUG',
# avoid use of `__builtin_thread_pointer()`
'-DMI_LIBC_MUSL',
] Then this happens:
So this looks like an internal error in mimalloc. In theory it could be memory corruption that is not mimalloc's fault, but we are using asan here, and it finds nothing, so I lean towards that. It is worth trying to reduce this to a testcase that reproduces without Emscripten (using a native build of mimalloc), that we can file an issue for. |
This comment claims This issue may be closed, since the issue may not related directly to emscripten. |
We should probably add an error in that case then when those flags are used it combination. |
Uh oh!
There was an error while loading. Please reload this page.
Issue for
-sMALLOC=mimalloc
+-fsanitize=address
file
main.cc
, or hereVersion of emscripten/emsdk:
docker image emscripten/emsdk:3.1.59, emscripten/emsdk:3.1.74
Failing command line in full:
I tried various test cases for this bug, as in here
3.1.59
,3.1.74
unordered_map
,map
std::map
(or unordered): 1, 2, 5, 10emmalloc
,dlmalloc
,mimalloc
(null)
,undefined
,address
Total 2 * 2 * 4 * 3 * 3 = 144 cases in here.
What kind of error?
type 1.
RuntimeError: remainder by zero
(5)type 2.
==42==ERROR: LeakSanitizer: detected memory leaks
(5)type 3.
==42==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x04d00000 at pc 0x00057169 bp 0x0288c790 sp 0x0288c794
(1)Discussion
In summary, only just in case,
any emsdk ver
+any maptype
+sanitizer=address
+mallocType=mimalloc
+size>1
(not 1. it works properly), generates error, with exceptional case, 3.1.59+map+size2, (it seems flakyEDIT: I have run 2 times more, it seems to be the unique option that runs properly)The text was updated successfully, but these errors were encountered: