Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebContent crashes if GPUP WebGL remote context buffer cannot be allocated #10504

Conversation

kkinnunen-apple
Copy link
Contributor

@kkinnunen-apple kkinnunen-apple commented Feb 22, 2023

8e47c0f

WebContent crashes if GPUP WebGL remote context buffer cannot be allocated
https://bugs.webkit.org/show_bug.cgi?id=252732
rdar://105612611

Reviewed by Geoffrey Garen.

Change RemoteGraphicsContextGLProxy and RemoteGPUProxy creation to be
nullable. If the IPC stream connection buffer allocation fails,
return gracefully instead of previous inteded CRASH().

Preserves the CRASH() in RemoteRenderingBackendProxy as current code
structure is such that it is expected always to be succesfully created.

* LayoutTests/webgl/webgl-fail-platform-context-creation-no-crash.html:
Remove a unneeded <script> from a similar test as below.
* LayoutTests/webgl/webgl-fail-remote-context-ipc-buffer-allocation-no-crash-expected.txt: Added.
* LayoutTests/webgl/webgl-fail-remote-context-ipc-buffer-allocation-no-crash.html: Copied from LayoutTests/webgl/webgl-fail-platform-context-creation-no-crash.html.
Add the test.
* Source/WebCore/html/canvas/WebGLContextAttributes.idl:
* Source/WebCore/platform/graphics/GraphicsContextGLAttributes.h:
* Source/WebKit/Platform/IPC/StreamClientConnection.cpp:
(IPC::StreamClientConnection::create):
(IPC::StreamClientConnection::StreamClientConnection):
* Source/WebKit/Platform/IPC/StreamClientConnection.h:
* Source/WebKit/Platform/IPC/StreamClientConnectionBuffer.h:
(IPC::StreamClientConnectionBuffer::create):
(IPC::StreamClientConnectionBuffer::StreamClientConnectionBuffer):
(IPC::StreamClientConnectionBuffer::createMemory): Deleted.
* Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in:
* Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.cpp:
(WebKit::RemoteGraphicsContextGLProxy::create):
(WebKit::RemoteGraphicsContextGLProxy::RemoteGraphicsContextGLProxy):
(WebKit::RemoteGraphicsContextGLProxy::initializeIPC):
* Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.h:
* Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp:
(WebKit::RemoteRenderingBackendProxy::ensureGPUProcessConnection):
* Source/WebKit/WebProcess/GPU/graphics/WebGPU/RemoteGPUProxy.cpp:
(WebKit::RemoteGPUProxy::create):
(WebKit::RemoteGPUProxy::RemoteGPUProxy):
(WebKit::RemoteGPUProxy::initializeIPC):
* Source/WebKit/WebProcess/GPU/graphics/WebGPU/RemoteGPUProxy.h:
* Source/WebKit/WebProcess/GPU/graphics/cocoa/RemoteGraphicsContextGLProxyCocoa.mm:
(WebKit::RemoteGraphicsContextGLProxy::platformCreate):
(WebKit::RemoteGraphicsContextGLProxy::create): Deleted.
* Source/WebKit/WebProcess/GPU/graphics/wc/RemoteGraphicsContextGLProxyWC.cpp:
(WebKit::RemoteGraphicsContextGLProxy::platformCreate):
(WebKit::RemoteGraphicsContextGLProxy::create): Deleted.
* Tools/TestWebKitAPI/Tests/IPC/StreamConnectionBufferTests.cpp:
(TestWebKitAPI::TEST):
* Tools/TestWebKitAPI/Tests/IPC/StreamConnectionTests.cpp:
(TestWebKitAPI::TEST_F):

Canonical link: https://commits.webkit.org/260738@main

29ea73b

Misc iOS, tvOS & watchOS macOS Linux Windows
❌ πŸ§ͺ style βœ… πŸ›  ios βœ… πŸ›  mac βœ… πŸ›  wpe βœ… πŸ›  wincairo
βœ… πŸ§ͺ bindings βœ… πŸ›  ios-sim βœ… πŸ›  mac-AS-debug βœ… πŸ›  gtk
βœ… πŸ§ͺ webkitperl βœ… πŸ§ͺ ios-wk2 βœ… πŸ§ͺ api-mac βœ… πŸ§ͺ gtk-wk2
βœ… πŸ§ͺ api-ios βœ… πŸ§ͺ mac-wk1 βœ… πŸ§ͺ api-gtk
βœ… πŸ›  tv βœ… πŸ§ͺ mac-wk2
βœ… πŸ›  tv-sim βœ… πŸ§ͺ mac-AS-debug-wk2
βœ… πŸ›  watch βœ… πŸ§ͺ mac-wk2-stress
βœ… πŸ›  πŸ§ͺ merge βœ… πŸ›  watch-sim

@kkinnunen-apple kkinnunen-apple added the WebGL Bugs in WebKit’s implementation of the WebGL standard. label Feb 22, 2023
@kkinnunen-apple kkinnunen-apple force-pushed the out-of-memory-remote-graphics-context-gl-no-crash branch from 40aef20 to 8d31d5a Compare February 22, 2023 09:40
@kkinnunen-apple kkinnunen-apple force-pushed the out-of-memory-remote-graphics-context-gl-no-crash branch from 8d31d5a to 29ea73b Compare February 22, 2023 19:03
@kkinnunen-apple
Copy link
Contributor Author

style error is unfortunately needed due to somebody wanting to do that ifdeffing

Copy link
Contributor

@geoffreygaren geoffreygaren left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r=me

@kkinnunen-apple kkinnunen-apple added the merge-queue Applied to send a pull request to merge-queue label Feb 23, 2023
…cated

https://bugs.webkit.org/show_bug.cgi?id=252732
rdar://105612611

Reviewed by Geoffrey Garen.

Change RemoteGraphicsContextGLProxy and RemoteGPUProxy creation to be
nullable. If the IPC stream connection buffer allocation fails,
return gracefully instead of previous inteded CRASH().

Preserves the CRASH() in RemoteRenderingBackendProxy as current code
structure is such that it is expected always to be succesfully created.

* LayoutTests/webgl/webgl-fail-platform-context-creation-no-crash.html:
Remove a unneeded <script> from a similar test as below.
* LayoutTests/webgl/webgl-fail-remote-context-ipc-buffer-allocation-no-crash-expected.txt: Added.
* LayoutTests/webgl/webgl-fail-remote-context-ipc-buffer-allocation-no-crash.html: Copied from LayoutTests/webgl/webgl-fail-platform-context-creation-no-crash.html.
Add the test.
* Source/WebCore/html/canvas/WebGLContextAttributes.idl:
* Source/WebCore/platform/graphics/GraphicsContextGLAttributes.h:
* Source/WebKit/Platform/IPC/StreamClientConnection.cpp:
(IPC::StreamClientConnection::create):
(IPC::StreamClientConnection::StreamClientConnection):
* Source/WebKit/Platform/IPC/StreamClientConnection.h:
* Source/WebKit/Platform/IPC/StreamClientConnectionBuffer.h:
(IPC::StreamClientConnectionBuffer::create):
(IPC::StreamClientConnectionBuffer::StreamClientConnectionBuffer):
(IPC::StreamClientConnectionBuffer::createMemory): Deleted.
* Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in:
* Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.cpp:
(WebKit::RemoteGraphicsContextGLProxy::create):
(WebKit::RemoteGraphicsContextGLProxy::RemoteGraphicsContextGLProxy):
(WebKit::RemoteGraphicsContextGLProxy::initializeIPC):
* Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.h:
* Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp:
(WebKit::RemoteRenderingBackendProxy::ensureGPUProcessConnection):
* Source/WebKit/WebProcess/GPU/graphics/WebGPU/RemoteGPUProxy.cpp:
(WebKit::RemoteGPUProxy::create):
(WebKit::RemoteGPUProxy::RemoteGPUProxy):
(WebKit::RemoteGPUProxy::initializeIPC):
* Source/WebKit/WebProcess/GPU/graphics/WebGPU/RemoteGPUProxy.h:
* Source/WebKit/WebProcess/GPU/graphics/cocoa/RemoteGraphicsContextGLProxyCocoa.mm:
(WebKit::RemoteGraphicsContextGLProxy::platformCreate):
(WebKit::RemoteGraphicsContextGLProxy::create): Deleted.
* Source/WebKit/WebProcess/GPU/graphics/wc/RemoteGraphicsContextGLProxyWC.cpp:
(WebKit::RemoteGraphicsContextGLProxy::platformCreate):
(WebKit::RemoteGraphicsContextGLProxy::create): Deleted.
* Tools/TestWebKitAPI/Tests/IPC/StreamConnectionBufferTests.cpp:
(TestWebKitAPI::TEST):
* Tools/TestWebKitAPI/Tests/IPC/StreamConnectionTests.cpp:
(TestWebKitAPI::TEST_F):

Canonical link: https://commits.webkit.org/260738@main
@webkit-early-warning-system webkit-early-warning-system force-pushed the out-of-memory-remote-graphics-context-gl-no-crash branch from 29ea73b to 8e47c0f Compare February 23, 2023 10:43
@webkit-commit-queue
Copy link
Collaborator

Committed 260738@main (8e47c0f): https://commits.webkit.org/260738@main

Reviewed commits have been landed. Closing PR #10504 and removing active labels.

@webkit-early-warning-system webkit-early-warning-system merged commit 8e47c0f into WebKit:main Feb 23, 2023
@webkit-commit-queue webkit-commit-queue removed the merge-queue Applied to send a pull request to merge-queue label Feb 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
WebGL Bugs in WebKit’s implementation of the WebGL standard.
Projects
None yet
4 participants