Closed Bug 1520418 Opened 7 months ago Closed 7 months ago

Firefox coredumps on startup due to "attempt to create unaligned slice" (patch attached)

Categories

(Core :: XPCOM, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla66
Tracking Status
firefox66 --- fixed

People

(Reporter: xftroxgpx, Assigned: xftroxgpx)

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3622.0 Safari/537.36

Steps to reproduce:

Compile Firefox with a rustc that was compiled with debug-assertions=true (in config.toml)

Actual results:

at startup, Firefox coredumps as seen here https://github.com/servo/servo/issues/22613
new stacktrace also here: https://github.com/servo/servo/issues/22613#issuecomment-454446259

Expected results:

no coredump!

The fix is adding an alignas(8) like:
alignas(8) nsTArrayHeader sEmptyTArrayHeader = {0, 0, 0};

see this comment: https://github.com/servo/servo/issues/22613#issuecomment-454451641

patch still applicable to current tip:
changeset: 454058:e56cc5e7b57a
tag: tip

Many thanks to the people in that thread https://github.com/servo/servo/issues/22613
without which this solution couldn't've been found!

Component: Untriaged → XPCOM
Product: Firefox → Core
Status: UNCONFIRMED → NEW
Ever confirmed: true
Assignee: nobody → xftroxgpx
Attachment #9036861 - Flags: review?(nfroyd)
Comment on attachment 9036861 [details] [diff] [review]
unaligned_slice_fix.patch

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

This looks good.  Emilio, can you take care of landing this, with a small explanatory comment for why we're using alignas here?
Attachment #9036861 - Flags: review?(nfroyd) → review+
Pushed by emilio@crisal.io:
https://hg.mozilla.org/integration/mozilla-inbound/rev/319fa2b1377f
Ensure the empty array header has enough alignment to avoid creating unaligned pointers. r=froydnj
Status: NEW → RESOLVED
Closed: 7 months ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla66
You need to log in before you can comment on or make changes to this bug.