CallArgs::operator[] should release assert
Categories
(Core :: JavaScript Engine, task)
Tracking
()
People
(Reporter: mccr8, Assigned: mccr8)
References
Details
Attachments
(3 files)
|
48 bytes,
text/x-phabricator-request
|
Details | |
|
48 bytes,
text/x-phabricator-request
|
phab-bot
:
approval-mozilla-esr140+
|
Details |
|
48 bytes,
text/x-phabricator-request
|
phab-bot
:
approval-mozilla-esr115+
|
Details |
CallArgs::get() does a bounds check on length(), but CallArgs::operator[] does not. This means that if somebody is refactoring code from the former to the latter it can become unsafe. The easiest way to fix this is to change the MOZ_ASSERT in operator[] to a MOZ_RELEASE_ASSERT.
| Assignee | ||
Comment 1•8 months ago
|
||
Updated•8 months ago
|
| Assignee | ||
Comment 2•8 months ago
|
||
I haven't done any performance testing but it is probably fine right?
Comment 3•8 months ago
|
||
I don't think I'm inherently opposed to this patch (though I wouldn't be surprised if there are workloads where we do in fact detect a perf regression -- this is on some hot paths).
I will say though, get and operator[] have different semantics and I'd be kind of uncomfortable with patches that are trying to change from one to the other without a fair amount of review.
| Assignee | ||
Comment 4•8 months ago
|
||
(In reply to Matthew Gaudet (he/him) [:mgaudet] from comment #3)
I don't think I'm inherently opposed to this patch (though I wouldn't be surprised if there are workloads where we do in fact detect a perf regression -- this is on some hot paths).
I'm hoping that the branch being very well predicted will avoid performance regressions. That being said, there are a handful of places where we had to opt-out of release mode bounds checks for nsTArray because it was showing up on profiles. Still, I think a safe-by-default approach is better.
I will say though,
getandoperator[]have different semantics and I'd be kind of uncomfortable with patches that are trying to change from one to the other without a fair amount of review.
Yes, that is why I am not changing the semantics. An out-of-bounds access will be undefined behavior without my patch, so changing it to a crash is consistent.
| Assignee | ||
Updated•8 months ago
|
Comment 7•8 months ago
|
||
| bugherder | ||
Updated•7 months ago
|
| Assignee | ||
Updated•7 months ago
|
Comment 8•7 months ago
|
||
firefox-esr140 Uplift Approval Request
- User impact if declined: This provides "belt and suspenders" protection against potential sec-high issues in SpiderMonkey. That being said, the fuzzers should be good at finding any place that has this problem so it is unlikely we have any.
- Code covered by automated testing: yes
- Fix verified in Nightly: yes
- Needs manual QE test: no
- Steps to reproduce for manual QE testing: none
- Risk associated with taking this patch: low
- Explanation of risk level: This adds some checks that should never fail. The only real risk is performance regressions, but it has been on m-c for about a week and a half without any regressions so I think it is fine.
- String changes made/needed: none
- Is Android affected?: yes
| Assignee | ||
Comment 9•7 months ago
|
||
Original Revision: https://phabricator.services.mozilla.com/D264095
Comment 10•7 months ago
|
||
firefox-esr115 Uplift Approval Request
- User impact if declined: This provides "belt and suspenders" protection against potential sec-high issues in SpiderMonkey. That being said, the fuzzers should be good at finding any place that has this problem so it is unlikely we have any.
- Code covered by automated testing: yes
- Fix verified in Nightly: yes
- Needs manual QE test: no
- Steps to reproduce for manual QE testing: none
- Risk associated with taking this patch: low
- Explanation of risk level: This adds some checks that should never fail. The only real risk is performance regressions, but it has been on m-c for about a week and a half without any regressions so I think it is fine.
- String changes made/needed: none
- Is Android affected?: yes
| Assignee | ||
Comment 11•7 months ago
|
||
Original Revision: https://phabricator.services.mozilla.com/D264095
Updated•7 months ago
|
Updated•7 months ago
|
Comment 12•7 months ago
|
||
| uplift | ||
Updated•7 months ago
|
Updated•7 months ago
|
Comment 13•7 months ago
|
||
| uplift | ||
Description
•