-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Ignore ASAN_SHADOW_SIZE #12249
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
Ignore ASAN_SHADOW_SIZE #12249
Changes from all commits
2eb8583
9ea2198
ec2379a
e5ee322
76e4fae
6c67971
d5efc43
d10ab74
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,5 @@ | ||
| Module = {ASAN_OPTIONS: 'detect_leaks=0'}; | ||
| if (Module != undefined) { | ||
| Module.ASAN_OPTIONS = 'detect_leaks=0'; | ||
| } else { | ||
| Module = {ASAN_OPTIONS: 'detect_leaks=0'}; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5774,7 +5774,10 @@ def test_fakestat(self): | |
| self.do_run_in_out_file_test('tests', 'core', 'test_fakestat.c') | ||
|
|
||
| def test_mmap(self): | ||
| self.set_setting('INITIAL_MEMORY', 128 * 1024 * 1024) | ||
| # ASan needs more memory, but that is set up separately | ||
| if '-fsanitize=address' not in self.emcc_args: | ||
| self.set_setting('INITIAL_MEMORY', 128 * 1024 * 1024) | ||
|
|
||
| # needs to flush stdio streams | ||
| self.set_setting('EXIT_RUNTIME', 1) | ||
| self.do_run_in_out_file_test('tests', 'core', 'test_mmap.c') | ||
|
|
@@ -6278,12 +6281,6 @@ def run_all(x): | |
| @no_asan('autodebug logging interferes with asan') | ||
| @with_env_modify({'EMCC_AUTODEBUG': '1'}) | ||
| def test_autodebug_wasm(self): | ||
| # Autodebug does not work with too much shadow memory. | ||
| # Memory consumed by autodebug depends on the size of the WASM linear memory. | ||
| # With a large shadow memory, the JS engine runs out of memory. | ||
| if '-fsanitize=address' in self.emcc_args: | ||
| self.set_setting('ASAN_SHADOW_SIZE', 16 * 1024 * 1024) | ||
|
|
||
| # test that the program both works and also emits some of the logging | ||
| # (but without the specific output, as it is logging the actual locals | ||
| # used and so forth, which will change between opt modes and updates of | ||
|
|
@@ -8015,7 +8012,9 @@ def test_template_class_deduction(self): | |
| 'cpp': ['test_asan_no_error.cpp'], | ||
| }) | ||
| def test_asan_no_error(self, name): | ||
| self.emcc_args += ['-fsanitize=address', '-s', 'ALLOW_MEMORY_GROWTH=1'] | ||
| self.emcc_args.append('-fsanitize=address') | ||
| self.emcc_args.append('-sALLOW_MEMORY_GROWTH=1') | ||
| self.emcc_args.append('-sINITIAL_MEMORY=314572800') | ||
| self.do_runf(path_from_root('tests', 'core', name), '', assert_returncode=NON_ZERO) | ||
|
|
||
| # note: these tests have things like -fno-builtin-memset in order to avoid | ||
|
|
@@ -8082,7 +8081,9 @@ def test_asan(self, name, expected_output, cflags=None): | |
| if not self.get_setting('WASM'): | ||
| self.skipTest('wasm2js has no ASan support') | ||
|
|
||
| self.emcc_args += ['-fsanitize=address', '-s', 'ALLOW_MEMORY_GROWTH=1'] | ||
| self.emcc_args.append('-fsanitize=address') | ||
| self.emcc_args.append('-sALLOW_MEMORY_GROWTH=1') | ||
| self.emcc_args.append('-sINITIAL_MEMORY=314572800') | ||
| if cflags: | ||
| self.emcc_args += cflags | ||
| self.do_runf(path_from_root('tests', 'core', name), | ||
|
|
@@ -8091,14 +8092,16 @@ def test_asan(self, name, expected_output, cflags=None): | |
|
|
||
| @no_wasm2js('TODO: ASAN in wasm2js') | ||
| def test_asan_js_stack_op(self): | ||
| self.emcc_args += ['-fsanitize=address', '-s', 'ALLOW_MEMORY_GROWTH=1'] | ||
| self.emcc_args.append('-fsanitize=address') | ||
| self.emcc_args.append('-sALLOW_MEMORY_GROWTH=1') | ||
| self.emcc_args.append('-sINITIAL_MEMORY=314572800') | ||
| self.do_runf(path_from_root('tests', 'core', 'test_asan_js_stack_op.c'), | ||
| expected_output='Hello, World!') | ||
|
|
||
| @no_wasm2js('TODO: ASAN in wasm2js') | ||
| def test_asan_api(self): | ||
| self.emcc_args.append('-fsanitize=address') | ||
| self.set_setting('ALLOW_MEMORY_GROWTH') | ||
| self.set_setting('INITIAL_MEMORY', 314572800) | ||
| self.do_run_in_out_file_test('tests', 'core', 'test_asan_api.c') | ||
|
|
||
| @no_wasm2js('TODO: ASAN in wasm2js') | ||
|
|
@@ -8108,6 +8111,7 @@ def test_asan_modularized_with_closure(self): | |
| self.emcc_args.append('-sUSE_CLOSURE_COMPILER=1') | ||
| self.emcc_args.append('-fsanitize=address') | ||
| self.emcc_args.append('-sALLOW_MEMORY_GROWTH=1') | ||
| self.emcc_args.append('-sINITIAL_MEMORY=314572800') | ||
|
|
||
| def post(filename): | ||
| with open(filename, 'a') as f: | ||
|
|
@@ -8358,10 +8362,10 @@ def setUp(self): | |
| # Add DEFAULT_TO_CXX=0 | ||
| strict = make_run('strict', emcc_args=[], settings={'STRICT': 1}) | ||
|
|
||
| lsan = make_run('lsan', emcc_args=['-fsanitize=leak'], settings={'ALLOW_MEMORY_GROWTH': 1}) | ||
| asan = make_run('asan', emcc_args=['-fsanitize=address'], settings={'ALLOW_MEMORY_GROWTH': 1, 'ASAN_SHADOW_SIZE': 128 * 1024 * 1024}) | ||
| asani = make_run('asani', emcc_args=['-fsanitize=address', '--pre-js', os.path.join(os.path.dirname(__file__), 'asan-no-leak.js')], | ||
| settings={'ALLOW_MEMORY_GROWTH': 1}) | ||
| lsan = make_run('lsan', emcc_args=['-fsanitize=leak', '-O2'], settings={'ALLOW_MEMORY_GROWTH': 1}) | ||
| asan = make_run('asan', emcc_args=['-fsanitize=address', '-O2'], settings={'ALLOW_MEMORY_GROWTH': 1, 'INITIAL_MEMORY': 314572800}) | ||
| asani = make_run('asani', emcc_args=['-fsanitize=address', '-O2', '--pre-js', os.path.join(os.path.dirname(__file__), 'asan-no-leak.js')], | ||
| settings={'ALLOW_MEMORY_GROWTH': 1, 'INITIAL_MEMORY': 314572800}) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. does this mean that without setting MAXIMUM_MEMORY we use the default 2GB, which means shadow memory is 256MB? if so that may not be best for CI, as each test will use that much memory immediately. maybe worth keeping the maximum?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, this goes back to using the default MAXIMUM_MEMORY, but we were already doing that before this PR. The MAXIMUM_MEMORY that we used to have in this PR was just 7/8 of the default, so not a whole lot better. I could believe that this might cause CI issues, but it hasn't so far, so I think that would be better addressed in a separate PR.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, I was reading the diff wrong. sgtm. Last question: why add
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The SIMD tests were failing because
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see, sounds fine. |
||
|
|
||
| # Experimental modes (not tested by CI) | ||
| lld = make_run('lld', emcc_args=[], settings={'LLD_REPORT_UNDEFINED': 1}) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if the user sets GLOBAL_BASE? Perhaps we should not allow that in general?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, that makes sense.