Bug 225781 - [GPU Process] Ensure RemoteRenderingBackendProxy is restored to its original state when GPUP connection is closed
Summary: [GPU Process] Ensure RemoteRenderingBackendProxy is restored to its original ...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Canvas (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Said Abou-Hallawa
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-05-13 14:05 PDT by Said Abou-Hallawa
Modified: 2021-05-15 21:06 PDT (History)
8 users (show)

See Also:


Attachments
Patch (10.51 KB, patch)
2021-05-13 14:32 PDT, Said Abou-Hallawa
no flags Details | Formatted Diff | Diff
Patch (9.25 KB, patch)
2021-05-14 16:09 PDT, Said Abou-Hallawa
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Said Abou-Hallawa 2021-05-13 14:05:56 PDT
RemoteRenderingBackendProxy::gpuProcessConnectionDidClose() is supposed to do that. But some members of RemoteRenderingBackendProxy are not cleared in this function.
Comment 1 Said Abou-Hallawa 2021-05-13 14:06:51 PDT
<rdar://76678163>
Comment 2 Said Abou-Hallawa 2021-05-13 14:32:42 PDT
Created attachment 428561 [details]
Patch
Comment 3 Simon Fraser (smfr) 2021-05-13 14:37:22 PDT
Comment on attachment 428561 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=428561&action=review

> Source/WebKit/ChangeLog:27
> +        No need for m_getPixelBufferSharedMemoryLength. The share memory length
> +        can be retrieved from SharedMemory::size();

Are you sure you're not undoing a security hardening here?
Comment 4 Said Abou-Hallawa 2021-05-13 15:08:17 PDT
Comment on attachment 428561 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=428561&action=review

>> Source/WebKit/ChangeLog:27
>> +        can be retrieved from SharedMemory::size();
> 
> Are you sure you're not undoing a security hardening here?

Can you please explain your point a little? I did not get it especially we have many data sizes in this context

IPCHandle::dataSize
IPCHandle::handle::m_size
SharedMemory::m_size // which is copied form the IPCHandle::handle::m_size.

What is the security hardening in adding a fourth one?
Comment 5 Simon Fraser (smfr) 2021-05-13 16:46:02 PDT
Comment on attachment 428561 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=428561&action=review

>>> Source/WebKit/ChangeLog:27
>>> +        can be retrieved from SharedMemory::size();
>> 
>> Are you sure you're not undoing a security hardening here?
> 
> Can you please explain your point a little? I did not get it especially we have many data sizes in this context
> 
> IPCHandle::dataSize
> IPCHandle::handle::m_size
> SharedMemory::m_size // which is copied form the IPCHandle::handle::m_size.
> 
> What is the security hardening in adding a fourth one?

There's a lot of discussion in https://bugs.webkit.org/show_bug.cgi?id=223732 which added this code. It seems that what Myles checked in was different from the last patch on the bug. He should explain why the code is as it is.
Comment 6 Ryosuke Niwa 2021-05-13 16:58:32 PDT
Comment on attachment 428561 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=428561&action=review

>>>> Source/WebKit/ChangeLog:27
>>>> +        can be retrieved from SharedMemory::size();
>>> 
>>> Are you sure you're not undoing a security hardening here?
>> 
>> Can you please explain your point a little? I did not get it especially we have many data sizes in this context
>> 
>> IPCHandle::dataSize
>> IPCHandle::handle::m_size
>> SharedMemory::m_size // which is copied form the IPCHandle::handle::m_size.
>> 
>> What is the security hardening in adding a fourth one?
> 
> There's a lot of discussion in https://bugs.webkit.org/show_bug.cgi?id=223732 which added this code. It seems that what Myles checked in was different from the last patch on the bug. He should explain why the code is as it is.

This code runs in WebContent process. There is no need to harden what gets sent back from GPU process.
In general, we trust stuff sent or replied from GPU process.
Also, SharedMemory::size is always correct. mach_vm_map ensures that it is
IPCHandle::dataSize could be arbitrary value, however, until SharedMemory::map is called since that's where we validate.
Comment 7 Said Abou-Hallawa 2021-05-14 16:09:44 PDT
Created attachment 428678 [details]
Patch
Comment 8 EWS 2021-05-15 21:06:35 PDT
Committed r277562 (237790@main): <https://commits.webkit.org/237790@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 428678 [details].