Closed Bug 1450790 Opened 6 years ago Closed 6 years ago

ASAN use-after-poison violation in WeakCollection_finalize()

Categories

(Core :: JavaScript: GC, defect)

58 Branch
defect
Not set
major

Tracking

()

RESOLVED FIXED
mozilla61
Tracking Status
firefox-esr52 --- wontfix
firefox59 --- wontfix
firefox60 --- wontfix
firefox61 --- fixed

People

(Reporter: jesup, Assigned: jandem)

References

Details

(Keywords: regression)

Attachments

(1 file)

When starting FF in a debug ASAN build, I hit use-after-poison in WeakCollection_finalize() (it likely doesn't matter, but I'm recovering from a crash and it puts up the sessionrestore query, then crashes).

Per jan, this is because we attempt to poison the memory there after calling Poison(this, JS_FREED_HEAP_PTR_PATTERN, sizeof(*this), MemCheckKind::MakeNoAccess); in ~GCPtr()

Fallout from bug 1448589.  We don't test Debug ASAN builds on Treeherder.... :-(
I do want to understand why we don't see this on shell tests or in fuzzing.
Flags: needinfo?(jdemooij)
FWIW we don't see this on ASan builds on Try even if I enable ~GCPtr in all builds.
(In reply to Jan de Mooij [:jandem] from comment #2)
> FWIW we don't see this on ASan builds on Try even if I enable ~GCPtr in all
> builds.

Actually for this to work I also have to make the #ifdef DEBUG code in WeakCollection_finalize work in opt builds. Will try that too...
Attached patch PatchSplinter Review
WeakCollection_finalize implements its own poisoning in DEBUG builds, but that seems unnecessary: the fop->free_ after that will call into jemalloc which does its own poisoning.
Assignee: nobody → jdemooij
Status: NEW → ASSIGNED
Flags: needinfo?(jdemooij)
Attachment #8964553 - Flags: review?(sphink)
Comment on attachment 8964553 [details] [diff] [review]
Patch

Review of attachment 8964553 [details] [diff] [review]:
-----------------------------------------------------------------

The poisoning dates from bug 641025, incremental GC. jemalloc has always poisoned, I thought?
Attachment #8964553 - Flags: review?(sphink) → review+
> The poisoning dates from bug 641025, incremental GC. jemalloc has always
> poisoned, I thought?

We don't/didn't always use jemalloc
(In reply to Steve Fink [:sfink] [:s:] from comment #5)
> The poisoning dates from bug 641025, incremental GC. jemalloc has always
> poisoned, I thought?

IGC was in 2012. We didn't enable jemalloc poisoning until bug 860254, which landed in 2014.
Pushed by jandemooij@gmail.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/e4329ee32328
Remove redundant poisoning in DEBUG builds in WeakCollection_finalize. r=sfink
https://hg.mozilla.org/mozilla-central/rev/e4329ee32328
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla61
Doesn't sound like this needs backporting, but feel free to nominate it if that's wrong.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: