Closed
Bug 1271037
Opened 9 years ago
Closed 9 years ago
Wrong numOperands in RRegExpMatcher, RRegExpSearcher, and RRegExpTester.
Categories
(Core :: JavaScript Engine: JIT, defect)
Core
JavaScript Engine: JIT
Tracking
()
RESOLVED
FIXED
mozilla49
People
(Reporter: arai, Assigned: arai)
References
Details
(Keywords: regression, sec-high, Whiteboard: [post-critsmash-triage][adv-main47+])
Attachments
(3 files)
1.34 KB,
patch
|
h4writer
:
review+
abillings
:
sec-approval+
|
Details | Diff | Splinter Review |
16.49 KB,
patch
|
h4writer
:
review+
|
Details | Diff | Splinter Review |
1.06 KB,
patch
|
arai
:
review+
ritu
:
approval-mozilla-aurora+
ritu
:
approval-mozilla-beta+
|
Details | Diff | Splinter Review |
https://dxr.mozilla.org/mozilla-central/rev/e5a10bc7dac4ee2453d8319165c1f6578203eac7/js/src/jit/Recover.h#568
> class RRegExpMatcher final : public RInstruction
> {
> public:
> RINSTRUCTION_HEADER_(RegExpMatcher)
>
> virtual uint32_t numOperands() const {
> return 5;
> }
>
> bool recover(JSContext* cx, SnapshotIterator& iter) const;
> };
It should be 3 (or 4 before bug 1263340).
setting s-s just in case.
(I don't see any case this is used tho)
Assignee | ||
Comment 1•9 years ago
|
||
Attachment #8749969 -
Flags: review?(hv1989)
Assignee | ||
Comment 2•9 years ago
|
||
Added static_assert to catch that case.
Any recover instruction that `numOperands` is a constant is changed to use RINSTRUCTION_HEADER_NUM_OP_ macro instead of RINSTRUCTION_HEADER_.
RINSTRUCTION_HEADER_NUM_OP_ macro also receives `numOperands` value, and assert that it's same as MIR's arity.
Attachment #8749970 -
Flags: review?(hv1989)
Assignee | ||
Comment 3•9 years ago
|
||
this is a regression from bug 1207922 (RegExpMatcher, RegExpTester) from firefox46, and bug 887016 (RegExpSearcher) from firefox49.
status-firefox46:
--- → affected
status-firefox47:
--- → affected
status-firefox48:
--- → affected
status-firefox-esr45:
--- → unaffected
Assignee | ||
Comment 4•9 years ago
|
||
(In reply to Tooru Fujisawa [:arai] from comment #2)
> Any recover instruction that `numOperands` is a constant is changed to use
> RINSTRUCTION_HEADER_NUM_OP_ macro instead of RINSTRUCTION_HEADER_.
> RINSTRUCTION_HEADER_NUM_OP_ macro also receives `numOperands` value, and
> assert that it's same as MIR's arity.
RINSTRUCTION_HEADER_NUM_OP_ also declares `numOperands` method.
Comment 5•9 years ago
|
||
Comment on attachment 8749969 [details] [diff] [review]
Part 1: Fix numOperands of RRegExpMatcher, RRegExpSearcher, and RRegExpTester.
Review of attachment 8749969 [details] [diff] [review]:
-----------------------------------------------------------------
Good catch!
Attachment #8749969 -
Flags: review?(hv1989) → review+
Comment 6•9 years ago
|
||
Comment on attachment 8749970 [details] [diff] [review]
Part 2: Statically check that numOperands of the recover instruction and the MIR are consistent.
Review of attachment 8749970 [details] [diff] [review]:
-----------------------------------------------------------------
Good idea!
Attachment #8749970 -
Flags: review?(hv1989) → review+
Assignee | ||
Comment 7•9 years ago
|
||
I'm now wondering about asking sec-approval.
what could happen if the value of numOperands is wrong?
Flags: needinfo?(hv1989)
Comment 8•9 years ago
|
||
Looking in the source we don't use numOperands of recover instructions? Am I missing something nbp?
Flags: needinfo?(hv1989) → needinfo?(nicolas.b.pierron)
Comment 9•9 years ago
|
||
(In reply to Hannes Verschore [:h4writer] from comment #8)
> Looking in the source we don't use numOperands of recover instructions? Am I
> missing something nbp?
These RInstruction::numOperands are used by the SnapshotIterator to know how many operands are needed to skip a recover instruction, and also to seek in the snapshot while walking inline frames.
https://dxr.mozilla.org/mozilla-central/search?q=%2Bfunction-ref%3A%22js%3A%3Ajit%3A%3ARInstruction%3A%3AnumOperands%28%29+const%22
Flags: needinfo?(nicolas.b.pierron)
Assignee | ||
Comment 10•9 years ago
|
||
thanks, so, it will result in using wrong operand in next instruction, right?
Assignee | ||
Comment 11•9 years ago
|
||
Comment on attachment 8749969 [details] [diff] [review]
Part 1: Fix numOperands of RRegExpMatcher, RRegExpSearcher, and RRegExpTester.
[Security approval request comment]
> How easily could an exploit be constructed based on the patch?
I'm not sure how to exploit this, as we don't yet hit the case.
> Do comments in the patch, the check-in comment, or tests included in the patch paint a bulls-eye on the security problem?
Commit message says the number is wrong, but there is no testcase describes how to hit it.
> Which older supported branches are affected by this flaw?
firefox46
> If not all supported branches, which bug introduced the flaw?
bug 1207922 (RegExpMatcher, RegExpTester) from firefox46
bug 887016 (RegExpSearcher) from firefox49
> Do you have backports for the affected branches? If not, how different, hard to create, and risky will they be?
Not yet, but it can be created easily.
(I think only Part 1 should be uplifted)
> How likely is this patch to cause regressions; how much testing does it need?
Less likely.
Part 1 just changes 3 numbers that were wrong.
Attachment #8749969 -
Flags: sec-approval?
Updated•9 years ago
|
Keywords: regression,
sec-high
Comment 12•9 years ago
|
||
Comment on attachment 8749969 [details] [diff] [review]
Part 1: Fix numOperands of RRegExpMatcher, RRegExpSearcher, and RRegExpTester.
sec-approval+ for trunk checkin.
Please nominate Aurora and Beta patches as well to be checked in following trunk. We'll want those very soon after it lands in trunk.
Updated•9 years ago
|
Attachment #8749969 -
Flags: sec-approval? → sec-approval+
Assignee | ||
Comment 13•9 years ago
|
||
Here's the patch for mozilla-aurora and mozilla-beta.
Attachment #8750885 -
Flags: review+
Updated•9 years ago
|
Group: core-security → javascript-core-security
Comment 14•9 years ago
|
||
Tracking for beta and up so we don't miss this sec-high issue.
Assignee | ||
Comment 15•9 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/87b38a0c8543d369ad1dc92d1f55965cb0ad7157
Bug 1271037 - Part 1: Fix numOperands of RRegExpMatcher, RRegExpSearcher, and RRegExpTester. r=h4writer, a=abillings
https://hg.mozilla.org/integration/mozilla-inbound/rev/49f41e6097076c35c92082cb268ea63b9ea5ab03
Bug 1271037 - Part 2: Statically check that numOperands of the recover instruction and the MIR are consistent. r=h4writer, a=abillings
Comment 16•9 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/87b38a0c8543
https://hg.mozilla.org/mozilla-central/rev/49f41e609707
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla49
Assignee | ||
Comment 17•9 years ago
|
||
Comment on attachment 8750885 [details] [diff] [review]
(mozilla-aurora and mozilla-beta) Fix numOperands of RRegExpMatcher, and RRegExpTester. r=h4writer
Approval Request Comment
> [Feature/regressing bug #]
bug 1207922
> [User impact if declined]
Possibly exploit, but not yet confirmed this can be exploited.
> [Describe test coverage new/current, TreeHerder]
Statically checked by Part 2, but Part 2 will be overkill to uplift.
> [Risks and why]
Low, this patch is just changing wrong numbers.
> [String/UUID change made/needed]
None
Attachment #8750885 -
Flags: approval-mozilla-beta?
Attachment #8750885 -
Flags: approval-mozilla-aurora?
Comment on attachment 8750885 [details] [diff] [review]
(mozilla-aurora and mozilla-beta) Fix numOperands of RRegExpMatcher, and RRegExpTester. r=h4writer
Sec-high issue, Aurora48+, Beta47+
Attachment #8750885 -
Flags: approval-mozilla-beta?
Attachment #8750885 -
Flags: approval-mozilla-beta+
Attachment #8750885 -
Flags: approval-mozilla-aurora?
Attachment #8750885 -
Flags: approval-mozilla-aurora+
Comment 19•9 years ago
|
||
Comment 20•9 years ago
|
||
Updated•9 years ago
|
Group: javascript-core-security → core-security-release
Updated•9 years ago
|
Flags: qe-verify-
Whiteboard: [post-critsmash-triage]
Updated•9 years ago
|
Whiteboard: [post-critsmash-triage] → [post-critsmash-triage][adv-main47+]
Updated•8 years ago
|
Group: core-security-release
You need to log in
before you can comment on or make changes to this bug.
Description
•