Closed
Bug 1477073
Opened 8 years ago
Closed 8 years ago
AddressSanitizer: attempting to call malloc_usable_size() for pointer which is not owned: 0x60d00002a988 [@ malloc_usable_size]
Categories
(Core :: JavaScript: WebAssembly, defect)
Tracking
()
RESOLVED
FIXED
mozilla63
| Tracking | Status | |
|---|---|---|
| firefox-esr52 | --- | unaffected |
| firefox-esr60 | --- | wontfix |
| firefox61 | --- | wontfix |
| firefox62 | --- | wontfix |
| firefox63 | --- | fixed |
People
(Reporter: decoder, Assigned: bbouvier)
References
(Blocks 1 open bug)
Details
(4 keywords)
Attachments
(2 files, 1 obsolete file)
|
21.31 KB,
text/plain
|
Details | |
|
4.43 KB,
patch
|
luke
:
review+
|
Details | Diff | Splinter Review |
The attached crash information was submitted via the ASan Nightly Reporter on mozilla-central-asan-nightly revision 63.0a1-20180719100142-https://hg.mozilla.org/mozilla-central/rev/183ee39bf309cd8463d8db5b5c8eb232cd0dac53.
For detailed crash information, see attachment.
| Reporter | ||
Comment 1•8 years ago
|
||
| Assignee | ||
Updated•8 years ago
|
Flags: needinfo?(bbouvier)
| Reporter | ||
Comment 2•8 years ago
|
||
Brian, thanks for your report! Do you remember any specific steps that caused this crash? It looks related to wasm and collecting memory reports (maybe automatic or from about:memory).
Comment 3•8 years ago
|
||
The browser never crashed, but I've been flipping knobs and twisting dials every since I read the blog post about this exciting project! I was indeed playing with about:memory earlier, but other then a brief hang while saving verbose gc & cc logs, I didn't notice any unusual behavior.
Comment 4•8 years ago
|
||
I can't tell if it is the same thing, but if I'm running the WebAssembly demo at https://webassembly.org/demo/ and I get a memory report in about:memory it seems to always crash.
Comment 5•8 years ago
|
||
Decoder told me how to find the ASan reports in my local profile directory (under an ASan subdirectory) and I can confirm that this looks the same as the original report.
Updated•8 years ago
|
Keywords: reproducible
Comment 6•8 years ago
|
||
Seems like a good candidate to run under rr.
Comment 7•8 years ago
|
||
Can confirm the https://webassembly.org/demo tab crashes when I go into about:memory and hit the measure button.
Comment 8•8 years ago
|
||
The 3 additional ASan logs that showed up in my profile directory as a result of testing that match the one attached to this report.
| Assignee | ||
Comment 9•8 years ago
|
||
Wow, nice catch. Pretty sure it's benign: we're just double counting the memory of an attribute, which pointer is within the bounds of an another object malloc'd before for which we've counted mallocSizeOf(this). I think that's what ASAN is complaining about here.
Not a security issue, I think: this API is only used for about:memory reporting, as far as I can tell (I got through the call stack as reported by Searchfox up to JS::CollectRuntimeStats [1]).
Will make a patch.
[1] https://searchfox.org/mozilla-central/source/js/src/vm/MemoryMetrics.cpp#882
Flags: needinfo?(bbouvier)
| Assignee | ||
Comment 10•8 years ago
|
||
(Assigning review once I've confirmed this is the right fix)
Assignee: nobody → bbouvier
Status: NEW → ASSIGNED
| Assignee | ||
Comment 11•8 years ago
|
||
Hi Luke, welcome back!
(See previous comment for explanation of the issue)
Another count issue (revealed by a local browser ASAN build) happens when a CompileTask's sizeof(this) is added in HelperThread sizeOfExcludingThis. We can just make them use sizeOfExcludingThis.
This makes me think that our memory reporting might be incorrect in other places related to wasm, and it would not be caught by ASAN:
- either when we call sizeOfExcludingThis on an object several times during the same report collection,
- or when we forget to call it (for instance that might happen for some structures belonging to the ModuleGenerator).
Attachment #8993710 -
Attachment is obsolete: true
Attachment #8993743 -
Flags: review?(luke)
Comment 12•8 years ago
|
||
(In reply to Benjamin Bouvier [:bbouvier] from comment #11)
> This makes me think that our memory reporting might be incorrect in other
> places related to wasm, and it would not be caught by ASAN:
> - either when we call sizeOfExcludingThis on an object several times during
> the same report collection,
> - or when we forget to call it (for instance that might happen for some
> structures belonging to the ModuleGenerator).
You can check for both of these things using a DMD build.
Comment 13•8 years ago
|
||
(In reply to Andrew McCreight [:mccr8] from comment #12)
> (In reply to Benjamin Bouvier [:bbouvier] from comment #11)
> > This makes me think that our memory reporting might be incorrect in other
> > places related to wasm, and it would not be caught by ASAN:
> > - either when we call sizeOfExcludingThis on an object several times during
> > the same report collection,
> > - or when we forget to call it (for instance that might happen for some
> > structures belonging to the ModuleGenerator).
>
> You can check for both of these things using a DMD build.
More specifically add:
1) 'ac_add_options --enable-dmd' to your .mozconfig
2) |./mach run --dmd https://webassembly.org/demo/|
3) load about:memory, click 'Save' under 'Save DMD output'
Benjamin, in addition to your patch can you also add a test? We run tests under ASAN which should be enough to catch this type of issue in the future. The WebAudio reporter [1] might be a good example.
[1] https://searchfox.org/mozilla-central/rev/8384a6519437f5eefbe522196f9ddf5c8b1d3fb4/dom/media/webaudio/test/test_WebAudioMemoryReporting.html
Flags: needinfo?(bbouvier)
| Reporter | ||
Comment 14•8 years ago
|
||
Opening this up based on Benjamin's comments.
Group: javascript-core-security
Comment 15•8 years ago
|
||
Comment on attachment 8993743 [details] [diff] [review]
fix.patch
Review of attachment 8993743 [details] [diff] [review]:
-----------------------------------------------------------------
Thanks!
Attachment #8993743 -
Flags: review?(luke) → review+
| Assignee | ||
Comment 16•8 years ago
|
||
(In reply to Eric Rahm [:erahm] from comment #13)
> Benjamin, in addition to your patch can you also add a test?
Opened bug 1477969 for this, to not block landing of this patch.
Flags: needinfo?(bbouvier)
Comment 17•8 years ago
|
||
Pushed by bbouvier@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/1be8ad5a7f3f
Don't double-count wasm structures when creating a memory report; r=luke
Comment 18•8 years ago
|
||
| bugherder | ||
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla63
| Reporter | ||
Updated•8 years ago
|
No longer blocks: asan-nightly-project
Comment 19•8 years ago
|
||
Sounds like this can ride the trains to me, but feel free to nominate for Beta approval if you feel strongly otherwise.
status-firefox61:
--- → wontfix
status-firefox62:
--- → wontfix
status-firefox-esr52:
--- → unaffected
status-firefox-esr60:
--- → wontfix
| Comment hidden (Intermittent Failures Robot) |
Updated•6 years ago
|
Blocks: asan-maintenance
You need to log in
before you can comment on or make changes to this bug.
Description
•