AddressSanitizer: heap-use-after-free /builds/worker/workspace/build/src/dom/canvas/WebGLContext.cpp:2259:44 in mozilla::WebGLContext::FuncScope::FuncScope(mozilla::WebGLContext const&, char const*)
Categories
(Core :: Graphics: CanvasWebGL, defect, P1)
Tracking
()
People
(Reporter: jkratzer, Assigned: jgilbert)
References
(Blocks 2 open bugs)
Details
(4 keywords, Whiteboard: [gfx-noted][post-critsmash-triage][adv-main68+][adv-esr60.8+])
Attachments
(4 files, 1 obsolete file)
|
136 bytes,
text/html
|
Details | |
|
850 bytes,
text/html
|
Details | |
|
47 bytes,
text/x-phabricator-request
|
jcristau
:
approval-mozilla-beta+
abillings
:
sec-approval+
|
Details | Review |
|
11.97 KB,
patch
|
jgilbert
:
review+
RyanVM
:
approval-mozilla-esr60+
|
Details | Diff | Splinter Review |
Updated•6 years ago
|
Updated•6 years ago
|
| Reporter | ||
Comment 1•6 years ago
|
||
| Reporter | ||
Comment 2•6 years ago
|
||
| Reporter | ||
Comment 3•6 years ago
|
||
Comment 4•6 years ago
|
||
| Reporter | ||
Comment 5•6 years ago
|
||
Comment 6•6 years ago
|
||
| Assignee | ||
Comment 7•6 years ago
|
||
| Assignee | ||
Comment 8•6 years ago
|
||
I don't see how we can get here?
We mark all extensions as lost in DestroyResourcesAndContext, and we call that from the WebGLContext dtor, so unless CC is bypassing the dtor (or there's a race condition somehow??), I don't see how we could reach the FuncScope ctor.
| Assignee | ||
Comment 10•6 years ago
|
||
Ooooh crap, is WebGLContext::Unlink not calling ~WebGLContext, thus skipping DestroyResourcesAndContext??
Well that could certainly help explain our intermittant CI OOMs also!
| Assignee | ||
Updated•6 years ago
|
Comment 11•6 years ago
|
||
(In reply to Jeff Gilbert [:jgilbert] from comment #10)
Ooooh crap, is WebGLContext::Unlink not calling ~WebGLContext, thus skipping DestroyResourcesAndContext??
Yeah, Unlink never calls the dtor. Having some kind of "destroy resources" method that gets called in both Unlink and the dtor is a fairly common pattern. (An Unlink method should also be able to deal with getting called on the same object multiple times, though if you are already making the dtor do the same cleanup as Unlink that shouldn't be an issue.)
| Assignee | ||
Comment 12•6 years ago
|
||
Looks like Unlink is clearing mExtensions, so our later pseudo-weak-ptr logic in DestroyResourcesAndContext sees a big ol' array of null! Oops!
Updated•6 years ago
|
| Assignee | ||
Comment 14•6 years ago
|
||
| Assignee | ||
Comment 15•6 years ago
|
||
Please test this build:
https://treeherder.mozilla.org/#/jobs?repo=try&revision=909092cb3dc0496fe8aa0641db16f6fe22b5e514
I believe I have it fixed locally with that change.
| Reporter | ||
Comment 16•6 years ago
|
||
(In reply to Jeff Gilbert [:jgilbert] from comment #15)
Please test this build:
https://treeherder.mozilla.org/#/jobs?repo=try&revision=909092cb3dc0496fe8aa0641db16f6fe22b5e514I believe I have it fixed locally with that change.
I can no longer trigger this issue using the patch in comment 14. Please note that I had to make an additional try build with --fuzzing enabled due to the calls to FuzzingFunctions.
| Assignee | ||
Comment 17•6 years ago
|
||
Comment on attachment 9066294 [details]
Bug 1515052 - Use WeakPtr for extension parent pointer.
Security Approval Request
- How easily could an exploit be constructed based on the patch?: Medium: Patching a raw pointer to a WeakPtr is a big hint that there's a UAF somewhere, but it's not necessarily clear why or how to incur it.
- Do comments in the patch, the check-in comment, or tests included in the patch paint a bulls-eye on the security problem?: No
- Which older supported branches are affected by this flaw?: all
- If not all supported branches, which bug introduced the flaw?: None
- Do you have backports for the affected branches?: No
- If not, how different, hard to create, and risky will they be?: Easy to backport.
- How likely is this patch to cause regressions; how much testing does it need?: Very unlikely to cause regressions.
Updated•6 years ago
|
| Assignee | ||
Updated•6 years ago
|
Comment 18•6 years ago
|
||
sec-approval+ for checkin on June 4, two weeks into the new cycle.
Updated•6 years ago
|
| Assignee | ||
Comment 19•6 years ago
|
||
ESR Uplift Approval Request
- If this is not a sec:{high,crit} bug, please state case for ESR consideration: sec-high
- User impact if declined: UAF crash, sec-high
- Fix Landed on Version:
- Risk to taking this patch: Low
- Why is the change risky/not risky? (and alternatives if risky): Replaces a raw pointer with a weak_ptr, which is pretty safe.
Pretty trivial rebase conflicts resolved for esr60 backport. Try run:
https://treeherder.mozilla.org/#/jobs?repo=try&selectedJob=248812592&revision=83fdb6da850d28e2d0a27abd49dcb7fca650b13a - String or UUID changes made by this patch: none
| Assignee | ||
Comment 20•6 years ago
|
||
Comment on attachment 9066294 [details]
Bug 1515052 - Use WeakPtr for extension parent pointer.
Beta/Release Uplift Approval Request
- User impact if declined: sec-high UAF, possible crashes
- Is this code covered by automated tests?: Yes
- Has the fix been verified in Nightly?: No
- 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): No rebase conflicts, and we're largely replacing a raw pointer with a weak_ptr and adding null checks.
- String changes made/needed: none
| Assignee | ||
Comment 21•6 years ago
|
||
I forgot to ask for uplifts. :(
Comment 22•6 years ago
|
||
Updated•6 years ago
|
Comment 23•6 years ago
|
||
Comment on attachment 9066294 [details]
Bug 1515052 - Use WeakPtr for extension parent pointer.
webgl sec fix, approved for 68.0b8
Comment 24•6 years ago
|
||
Comment 25•6 years ago
|
||
| uplift | ||
Updated•6 years ago
|
Comment 26•6 years ago
•
|
||
Hi, I managed to reproduce this issue in an older version of Firefox but this issue no longer occurs in Firefox beta 68.0b12 or our latest Nightly build 69.0a1 (2019-06-20) on Ubuntu 18.04. I will mark this issue accordingly.
| Assignee | ||
Comment 27•6 years ago
|
||
Great, thanks!
Comment 28•6 years ago
|
||
Comment 29•6 years ago
|
||
| uplift | ||
Comment 30•6 years ago
|
||
I have marked this issue verified as fixed since it's a Won't fix for esr60.
Updated•6 years ago
|
Updated•6 years ago
|
Comment 31•6 years ago
•
|
||
This issue is also verified as fixed in 60.7.3esr.I will mark this issue accordingly.
This is the build I used to verify this issue : https://tools.taskcluster.net/index/gecko.v2.mozilla-esr60.latest.firefox/linux64-fuzzing-asan-opt
Updated•6 years ago
|
Updated•5 years ago
|
Updated•5 years ago
|
Description
•