[webkit-changes] [WebKit/WebKit] efa2af: IPC stream sync message send hangs sometimes when ...

Kimmo Kinnunen noreply at github.com
Thu Sep 5 15:47:18 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: efa2afee8f4a050d542c6ab8a881f5f0714f2165
      https://github.com/WebKit/WebKit/commit/efa2afee8f4a050d542c6ab8a881f5f0714f2165
  Author: Kimmo Kinnunen <kkinnunen at apple.com>
  Date:   2024-09-05 (Thu, 05 Sep 2024)

  Changed paths:
    M Source/WebKit/Platform/IPC/StreamServerConnection.cpp
    M Source/WebKit/Platform/IPC/StreamServerConnection.h
    M Source/WebKit/Shared/IPCStreamTester.cpp
    M Source/WebKit/Shared/IPCStreamTester.h
    M Source/WebKit/Shared/IPCStreamTester.messages.in
    M Tools/TestWebKitAPI/Tests/IPC/StreamConnectionTests.cpp

  Log Message:
  -----------
  IPC stream sync message send hangs sometimes when using NotStreamEncodableReply
https://bugs.webkit.org/show_bug.cgi?id=279188
rdar://133004320

Reviewed by Simon Fraser.

Normal stream IPC sync message reply protocol is that the reply would be
written to the beginning of the message buffer and the whole buffer
would be released to the client.

In case of NotStreamEncodableReply, the buffer would be released to the
client but the out of stream (OOS) message would be sent via
IPC::Connection. This would be done to support replying with
kernel-transferred objects.

There was be a race condition with the implementation, where the OOS
message would be sent by the server and received by the client before
the server would continue. This would cause the client to write the
subsequent messages to the unexpected index of the message buffer. Once
the server would continue, it would release the message buffer to the
client, overwriting the clients index values.

Fix by first releasing the buffer to the client and then sending the OOS
message.

* Source/WebKit/Platform/IPC/StreamServerConnection.cpp:
(IPC::StreamServerConnection::dispatchStreamMessage):
* Source/WebKit/Platform/IPC/StreamServerConnection.h:
(IPC::StreamServerConnection::sendSyncReply):
* Source/WebKit/Shared/IPCStreamTester.cpp:
(WebKit::IPCStreamTester::syncMessage):
(WebKit::IPCStreamTester::syncMessageNotStreamEncodableReply):
(WebKit::IPCStreamTester::emptyMessage):
* Source/WebKit/Shared/IPCStreamTester.h:
* Source/WebKit/Shared/IPCStreamTester.messages.in:
* Tools/TestWebKitAPI/Tests/IPC/StreamConnectionTests.cpp:
(TestWebKitAPI::TEST_P):

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



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list