Closed Bug 1507572 Opened 5 years ago Closed 5 years ago

Assertion failure: byteSize == 8, at /js/src/jit/arm/MacroAssembler-arm.cpp:6578

Categories

(Core :: JavaScript: WebAssembly, defect, P3)

ARM
All
defect

Tracking

()

RESOLVED FIXED
mozilla65
Tracking Status
firefox63 - wontfix
firefox64 - fixed
firefox65 - fixed

People

(Reporter: bbouvier, Assigned: lth)

References

Details

Attachments

(2 files)

The following test case (reduced from awsm) crashes an ARM shell when run with --no-wasm-ion:

let i = new WebAssembly.Instance(new WebAssembly.Module(wasmTextToBinary(`
(module
    (memory 1 1)
    (func $f (local i32)
        get_local 0
        i64.const 0
        i64.store16 align=1
    )
)
`))).exports;

Indeed, a misaligned store can be of less than 8 bytes, and we never implemented that. This is "only" a correctness bug, as far as I can tell.

Lars, are you interested in fixing this?
Sure, I'll take it.  Good bug for a Friday.
Assignee: nobody → lhansen
Status: NEW → ASSIGNED
OS: Unspecified → All
Priority: -- → P3
Hardware: Unspecified → ARM
The most distressing part of this bug by far is that we had no test cases to catch this.
Attachment #9025577 - Flags: review?(bbouvier)
I should add: I put that up for review so that we can get it into the pipeline and maybe uplift to beta.  As a follow-up (today) I will look into the test case situation for the sub-word operations and make sure it's adequate.
Some additional test work.
Attachment #9025583 - Flags: review?(bbouvier)
Comment on attachment 9025577 [details] [diff] [review]
bug1507572-store-unaligned-from-i64.patch

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

Thanks!

::: js/src/jit/arm/MacroAssembler-arm.cpp
@@ +6582,5 @@
> +            break;
> +          case 4:
> +          case 2:
> +            emitUnalignedStore(&access, byteSize, ptr, val64.low);
> +            break;

Maybe add a default case with MOZ_CRASH to catch issues here? Otherwise, a plain `if/else` would do.
Attachment #9025577 - Flags: review?(bbouvier) → review+
Attachment #9025583 - Flags: review?(bbouvier) → review+
Pushed by lhansen@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/f970d9b9b00c
Generalize alignments for memory ops testing. r=bbouvier
https://hg.mozilla.org/integration/mozilla-inbound/rev/fc0bc3b27660
correctly implement unaligned stores of i64 sub-fields.  r=bbouvier
https://hg.mozilla.org/mozilla-central/rev/f970d9b9b00c
https://hg.mozilla.org/mozilla-central/rev/fc0bc3b27660
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla65
Please nominate this for Beta approval when you get a chance. Also, a clarification on the tracking request would be appreciated :)
Flags: needinfo?(lhansen)
Flags: in-testsuite+
I'm sure I'm just abusing the tracking flags.  I just wanted to be sure that we would get this into beta, so I figured the tracking request would add visibility.
Flags: needinfo?(lhansen)
Comment on attachment 9025577 [details] [diff] [review]
bug1507572-store-unaligned-from-i64.patch

[Beta/Release Uplift Approval Request]

Feature/Bug causing the regression: None

User impact if declined: Obscure bugs on ARM for some WebAssembly content

Is this code covered by automated tests?: Yes

Has the fix been verified in Nightly?: Yes

Needs manual test from QE?: No

If yes, steps to reproduce: 

List of other uplifts needed: None

Risk to taking this patch: Low

Why is the change risky/not risky? (and alternatives if risky): This adds logic where we had none, but should not affect any case where we already had correct code.

String changes made/needed:
Attachment #9025577 - Flags: approval-mozilla-beta?
Comment on attachment 9025577 [details] [diff] [review]
bug1507572-store-unaligned-from-i64.patch

wasm fix for arm, approved for 64.0b11
Attachment #9025577 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
You need to log in before you can comment on or make changes to this bug.