DescriptionFix gpu command buffer use after free by GrContext
ContextProviderCommandBuffer owns a WebGraphicsContext3DCommandBufferImpl and a
GrContextForWebGraphicsContext3D via scoped_ptr. The problem was
that the GrContext object held by GrContextForWebGraphicsContext3D
depended on interface pointers that reference an interface that is owned
by WebGraphicsContext3DCommandBufferImpl, so whenever the
GrContext outlived the ContextProviderCommandBuffer, we ended up in a
state where the interface function pointers are deallocated, but still
referenced. Then, attempts to use the GrContext would result in using
deallocated function pointers. Because the GrContext is a ref counted
object, it can easily outlive the ContextProviderCommandBuffer. This led to
a dangerous situation where we had to be careful about object destruction
order.
This CL fixes the problem for good by wrapping the ownership of the
WebGraphicsContext3DCommandBufferImpl into a subclass of
GrGLInterface, which is a ref counted object that can be owned jointly by
the GrContext and the ContextProviderCommandBuffer, thus guaranteeing
that the command buffer interface will remain valid for the lifetimes of the
GrContext and of the ContextProviderCommandBuffer.
BUG=551143
CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel
Committed: https://crrev.com/d87aa1f1aee6ab0181eadaae827a5768981c1ccc
Cr-Commit-Position: refs/heads/master@{#359493}
Patch Set 1 #Patch Set 2 : WIP #Patch Set 3 : added test #Patch Set 4 : debug fix + style #Patch Set 5 : blind android fix #
Total comments: 1
Patch Set 6 : thread check + various tweaks #Patch Set 7 : android build fix + adding BindToCurrentThread on gr_interface_ #
Total comments: 1
Patch Set 8 : applied boliu feedback #Patch Set 9 : android build fix #Patch Set 10 : fix android webview build + browser test #
Total comments: 5
Patch Set 11 : tweaks #Patch Set 12 : blimp build fix #Patch Set 13 : try enabling test on all platforms #Patch Set 14 : test fixup #Messages
Total messages: 24 (8 generated)
|