Closed
Bug 1011283
Opened 7 years ago
Closed 7 years ago
Assertion failure: *to != *moves_[i].to(), at jit/LIR.cpp
Categories
(Core :: JavaScript Engine: JIT, defect)
Tracking
()
VERIFIED
FIXED
mozilla33
Tracking | Status | |
---|---|---|
firefox30 | --- | unaffected |
firefox31 | --- | verified |
firefox32 | + | verified |
firefox33 | + | verified |
firefox-esr24 | --- | unaffected |
b2g-v1.3 | --- | unaffected |
b2g-v1.3T | --- | unaffected |
b2g-v1.4 | --- | unaffected |
b2g-v2.0 | --- | fixed |
b2g-v2.1 | --- | fixed |
People
(Reporter: gkw, Assigned: sunfish)
References
Details
(5 keywords, Whiteboard: [jsbugmon:])
Attachments
(4 files)
5.59 KB,
text/plain
|
Details | |
6.62 KB,
patch
|
Details | Diff | Splinter Review | |
2.65 KB,
patch
|
nbp
:
review+
abillings
:
sec-approval+
|
Details | Diff | Splinter Review |
2.66 KB,
patch
|
Sylvestre
:
approval-mozilla-aurora+
Sylvestre
:
approval-mozilla-beta+
|
Details | Diff | Splinter Review |
valueOf = function(a, b, c) { var d = (2 ^ 9) / 9 var e = g b = d / 9 a + c | d return b } function f(x) { x | 0 } f(this) asserts js debug shell on m-c changeset 6d32bbffc7e4 with --ion-eager --ion-parallel-compile=off at Assertion failure: *to != *moves_[i].to(), at jit/LIR.cpp My configure flags are: LD=ld CROSS_COMPILE=1 CC="clang -Qunused-arguments -msse2 -mfpmath=sse -arch i386" RANLIB=ranlib CXX="clang++ -Qunused-arguments -msse2 -mfpmath=sse -arch i386" AS=$CC AR=ar STRIP="strip -x -S" HOST_CC="clang -Qunused-arguments -msse2 -mfpmath=sse" HOST_CXX="clang++ -Qunused-arguments -msse2 -mfpmath=sse" sh /Users/skywalker/trees/mozilla-central/js/src/configure --target=i386-apple-darwin9.2.0 --enable-macos-target=10.5 --enable-optimize --enable-debug --enable-profiling --enable-gczeal --enable-debug-symbols --disable-tests --enable-more-deterministic --with-ccache --enable-threadsafe <other NSPR options> autoBisect shows this is probably related to the following changeset: The first bad revision is: changeset: http://hg.mozilla.org/mozilla-central/rev/c7925215ca32 user: Mauricio Collares Neto date: Sat Apr 19 10:37:51 2014 -0700 summary: Bug 976110 - Part 1: Optimize signed integer division by constants; r=sunfish :sunfish, is bug 976110 a likely regressor? (after the recent adventures of LIR/MIR bugs not being marked s-s by default (which turned out wrong), I'm turning this s-s and sec-critical as a start just in case, feel free to change this as necessary)
Flags: needinfo?(sunfish)
Updated•7 years ago
|
Whiteboard: [jsbugmon:update] → [jsbugmon:]
Comment 1•7 years ago
|
||
JSBugMon: Cannot process bug: Unable to automatically reproduce, please track manually.
![]() |
Reporter | |
Comment 2•7 years ago
|
||
(In reply to Christian Holler (:decoder) from comment #1) > JSBugMon: Cannot process bug: Unable to automatically reproduce, please > track manually. This seems 32-bit only.
Comment 3•7 years ago
|
||
JSBugMon will use 32 bit builds, it's likely something else, build options maybe.
![]() |
Reporter | |
Comment 4•7 years ago
|
||
(In reply to Christian Holler (:decoder) from comment #3) > JSBugMon will use 32 bit builds, it's likely something else, build options > maybe. Or maybe even Mac-only, I haven't tried Linux 32-bit builds though.
Assignee | ||
Comment 6•7 years ago
|
||
At a first look, it looks like a register allocator bug. The problem goes away with --ion-regalloc=backtracking, and is not reproducible on x64. The crash is in the register allocator; it is trying to add two moves with the same output to a MoveGroup. I'll investigate further.
Updated•7 years ago
|
Group: javascript-core-security
Updated•7 years ago
|
![]() |
Reporter | |
Updated•7 years ago
|
status-firefox30:
--- → unaffected
status-firefox31:
--- → affected
status-firefox32:
--- → affected
Updated•7 years ago
|
tracking-firefox32:
--- → +
Assignee | ||
Comment 7•7 years ago
|
||
I'm still investigating this. LSRA is putting two independent reloads of %eax in the same move group. Due to the use of LNops to model fixed-register dependencies, it's quite tricky to determine what's actually supposed to happen here.
Assignee | ||
Comment 8•7 years ago
|
||
A patch containing some related debugging code is in bug 1020468.
Updated•7 years ago
|
Comment 9•7 years ago
|
||
Any updates here? Did the debugging code help?
Assignee | ||
Comment 10•7 years ago
|
||
I'm still working on this. I've tried a few approaches to fixing it, but so far they all cause breakage elsewhere. If a fix is needed urgently, I could probably construct a workaround patch. If we make the Div/Mod nodes take arbitrary registers as inputs and outputs, and have them manually copy into the registers they need, it would probably avoid this problem, at the expense of being mildly suboptimal.
Comment 11•7 years ago
|
||
Firefox 30, which just shipped, isn't affected by this. Firefox 31 is. We'd like to not ship this security issue in five weeks.
Assignee | ||
Comment 12•7 years ago
|
||
The attached patch works around the LSRA problem by having LDivOrModConstantI copy its output. It's unfortunate, but the performance impact ought to be pretty minimal.
Attachment #8442519 -
Flags: review?(nicolas.b.pierron)
Comment 13•7 years ago
|
||
Comment on attachment 8442519 [details] [diff] [review] divmod-move-output.patch Review of attachment 8442519 [details] [diff] [review]: ----------------------------------------------------------------- ::: js/src/jit/shared/Lowering-x86-shared.cpp @@ -161,3 @@ > if (div->fallible() && !assignSnapshot(lir, Bailout_DoubleOutput)) > return false; > - return defineFixed(lir, div, LAllocation(AnyRegister(edx))); As long as we do not have an explanation, and we decide to go that way without a clear understanding of why, then we should remove defineFixed from the set of instructions compilable from Ion. This includes LUdivOrMod and some VMFunction LIR instructions.
Attachment #8442519 -
Flags: review?(nicolas.b.pierron)
Assignee | ||
Comment 14•7 years ago
|
||
defineFixed is used by lots of things, and I don't think we can reasonably remove it from Ion. The best alternative I can provide quickly is to completely revert the divide-by-constant feature which exposed this bug. Whatever LSRA bug may exist will remain, but we'll at least be back to where we were before we knew about this bug. I'll start preparing a patch to do this. For completeness, another quick way to fix this would be to disable LSRA and switch to backtracking by default. This something we're hoping to do eventually anyway, though currently it does regress performance in some cases. It is an alternative that we could consider if we needed to.
Comment 15•7 years ago
|
||
(In reply to Dan Gohman [:sunfish] from comment #14) > The best alternative I can provide quickly is to completely revert the > divide-by-constant feature which exposed this bug. Whatever LSRA bug may > exist will remain, but we'll at least be back to where we were before we > knew about this bug. I'll start preparing a patch to do this. My point is if we are fixing a bug we should better fix it without leaving hints behind us in the patch. Having a work-around which disables the feature sounds nicer as it does not leave hints about the register allocation. (In reply to Dan Gohman [:sunfish] from comment #14) > For completeness, another quick way to fix this would be to disable LSRA and > switch to backtracking by default. I don't think this is a good idea to enable the backtracking allocator without making it ride the train. This sounds like a huge risk from my point of view, and this is unlikely to be acceptable for landing on beta.
Assignee | ||
Comment 16•7 years ago
|
||
This patch disables the div/mod by constant optimization which triggers the bug. I chose to make a small change which just disables the feature instead of fully reverting the patches because the original patches don't reverse-apply cleanly anymore, and a small change is easier to understand.
Attachment #8442956 -
Flags: review?(nicolas.b.pierron)
Updated•7 years ago
|
Attachment #8442956 -
Flags: review?(nicolas.b.pierron) → review+
Assignee | ||
Comment 17•7 years ago
|
||
Comment on attachment 8442956 [details] [diff] [review] disable-div-or-mod-constanti.patch [Security approval request comment] How easily could an exploit be constructed based on the patch? Not easily. The patch disables a feature which triggers a bug elsewhere, so an exploit would need to combine several constructs to work. Do comments in the patch, the check-in comment, or tests included in the patch paint a bulls-eye on the security problem? No, they disable a feature which triggers a bug somewhere else, so it's fairly indirect. Which older supported branches are affected by this flaw? mozilla-beta and mozilla-aurora are both also affected. If not all supported branches, which bug introduced the flaw? Bug 976110. Do you have backports for the affected branches? If not, how different, hard to create, and risky will they be? Backports for all affected branches would be very easy to create, and low-risk. The patch is small and straight-forward. How likely is this patch to cause regressions; how much testing does it need? Not especially likely. The patch is just disabling an optimization.
Attachment #8442956 -
Flags: sec-approval?
Comment 18•7 years ago
|
||
Comment on attachment 8442956 [details] [diff] [review] disable-div-or-mod-constanti.patch sec-approval+ for trunk. Once trunk is green, I'd like to see Aurora and Beta patches nominated so we can fix this everywhere.
Attachment #8442956 -
Flags: sec-approval? → sec-approval+
Assignee | ||
Comment 19•7 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/bf47f42c33c8
Assignee | ||
Comment 20•7 years ago
|
||
Here is a port of disable-div-or-mod-constanti.patch which applies cleanly to mozilla-aurora and mozilla-beta.
Comment 21•7 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/bf47f42c33c8
Status: NEW → RESOLVED
Closed: 7 years ago
status-b2g-v1.3:
--- → unaffected
status-b2g-v1.3T:
--- → unaffected
status-b2g-v1.4:
--- → unaffected
status-b2g-v2.0:
--- → affected
status-b2g-v2.1:
--- → fixed
Flags: in-testsuite?
Resolution: --- → FIXED
Target Milestone: --- → mozilla33
Assignee | ||
Comment 22•7 years ago
|
||
Comment on attachment 8443841 [details] [diff] [review] aurora-beta.patch [Approval Request Comment] Bug caused by (feature/regressing bug #): Bug 976110 User impact if declined: Security bug Testing completed (on m-c, etc.): On m-c. Risk to taking this patch (and alternatives if risky): Low. The patch just disables an optimization. String or IDL/UUID changes made by this patch: None.
Attachment #8443841 -
Flags: approval-mozilla-beta?
Attachment #8443841 -
Flags: approval-mozilla-aurora?
Updated•7 years ago
|
Attachment #8443841 -
Flags: approval-mozilla-beta?
Attachment #8443841 -
Flags: approval-mozilla-beta+
Attachment #8443841 -
Flags: approval-mozilla-aurora?
Attachment #8443841 -
Flags: approval-mozilla-aurora+
Comment 23•7 years ago
|
||
https://hg.mozilla.org/releases/mozilla-aurora/rev/913b7be0707c https://hg.mozilla.org/releases/mozilla-beta/rev/37a6172af9cb
Comment 24•7 years ago
|
||
Reproduced the original issue on m-c using changeset 6d32bbffc7e4 with the flags from comment #0, received the following assert: Assertion failure: *to != *moves_[i].to(), at /home/kjozwiak/mozilla/mozilla-central/js/src/jit/LIR.cpp:453 Segmentation fault (core dumped) Went through verification using the following builds: * m-c using changeset 613bc15ccf05 * aurora using changeset 07f644c5ca48 * beta using changeset 635e32a71297
Status: RESOLVED → VERIFIED
Updated•7 years ago
|
Group: javascript-core-security
Updated•7 years ago
|
QA Whiteboard: [qa!]
Updated•6 years ago
|
Group: core-security → core-security-release
Updated•5 years ago
|
Group: core-security-release
You need to log in
before you can comment on or make changes to this bug.
Description
•