Closed Bug 1667790 Opened 4 years ago Closed 4 years ago

Accessing ContentProcessMessageManager::SharedData early during process startup crashes

Categories

(Core :: DOM: Content Processes, defect)

defect

Tracking

()

RESOLVED FIXED
83 Branch
Tracking Status
firefox83 --- fixed

People

(Reporter: ochameau, Assigned: ochameau)

References

Details

Attachments

(1 file)

While working on bug 1620248, I'm triggering a crash around Services.cpmm.sharedData.
When accessing it very early during process startup, firefox crashes on this line:
https://searchfox.org/mozilla-central/rev/670e13b51d272125c76a1bf84b9f3707583cde12/dom/base/ContentProcessMessageManager.cpp#45

    return do_AddRef(child->SharedData());

because child->SharedData() returns null.
That's because mSharedData from ContentChild is still null:
https://searchfox.org/mozilla-central/rev/670e13b51d272125c76a1bf84b9f3707583cde12/dom/ipc/ContentChild.h#151
Very likely, this function isn't called yet:
https://searchfox.org/mozilla-central/rev/670e13b51d272125c76a1bf84b9f3707583cde12/dom/ipc/ContentChild.cpp#2359

    mSharedData =
        new SharedMap(ContentProcessMessageManager::Get()->GetParentObject(),
                      aMapFile, aMapSize, std::move(blobImpls));

Also likely because this ContentParent code:
https://searchfox.org/mozilla-central/rev/670e13b51d272125c76a1bf84b9f3707583cde12/dom/ipc/ContentParent.cpp#2717-2720
is called a bit late after the content process already started.

There is two underlying issues here:

Here I'm going to at least allow this attribute to be null without crashing.

Component: DOM: Core & HTML → DOM: Content Processes
Pushed by apoirot@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/c26359e984ba Allow `sharedData` to be null very early during process startup. r=nika
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 83 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: