Descriptioncontent: Pass IOSurface references using Mach IPC.
This removes the use of global IOSurfaces and instead passes
ownership between processes using Mach IPC.
The IOSurface GpuMemoryBuffer factory instance in the GPU
process sends a synchronous Mach message to the browser
process to register each IOSurface it creates. IOSurface
registration messages are handled by the
BrowserIOSurfaceManager class and child processes can use
a Mach message to acquire a reference to an IOSurface that
has been registered with the manager.
The BrowserIOSurfaceManager class keeps track of the
ownership of each IOSurface and prevents a child process
from acquiring a reference to an IOSurface that it doesn't
own. A unique unguessable token is generated for each child
process that is allowed to use IOSurfaces. The token
restricts what IOSurfaces a child process has access to
and prevents a malicious process from gaining access to
IOSurfaces it doesn't own.
Security Considerations
-----------------------
In general, this is a major improvement to security as it
provides proper sand-boxing of IOSurfaces. Prior to this
change, IOSurfaces were global and any process on the
system (including all renderer processes) had access to
all IOSurfaces. The renderer who owns the IOSurface is
the only process (except for the browser and GPU) that
has access to the IOSurface as a result of this change.
Passing of IOSurface references to child processes require
a Mach port to be open in the child process sandbox for
sending messages to the browser. As a result, Mach message
handling in the browser process
(BrowserIOSurfaceManager::Handle*Request) requires
validation and proper error handling to prevent a
malicious renderer from exploiting this channel.
BUG=323304
TEST=content_unittests --gtest_filter=GpuMemoryBuffer*/1, content_unittests --gtest_filter=BrowserIOSurfaceManagerTest.*, content_shell --enable-native-gpu-memory-buffers
Committed: https://crrev.com/7c45b308edffa29d63d752fef7f7bf759a465a64
Cr-Commit-Position: refs/heads/master@{#332757}
Patch Set 1 #Patch Set 2 : Add MachBrokerTest.IOSurfaces test #
Total comments: 8
Patch Set 3 : dcastagna's review #
Total comments: 11
Patch Set 4 : move IOSurfaceManagerImpl into mach_broker_mac.mm #Patch Set 5 : rm blankline #Patch Set 6 : remove unecesssary style changes #Patch Set 7 : #Patch Set 8 : remove parameter from MachBroker::InitChildProcess #
Total comments: 6
Patch Set 9 : v2 #Patch Set 10 : v3 #Patch Set 11 : lint #Patch Set 12 : update comment #
Total comments: 41
Patch Set 13 : rsesek's review #Patch Set 14 : add more unit tests #Patch Set 15 : fix comment #Patch Set 16 : add DCHECKs to ChildIOSurfaceManager #Patch Set 17 : rebase, remove extra DCHECKs and fix reply port typo #
Total comments: 20
Patch Set 18 : rsesek's review #
Total comments: 22
Patch Set 19 : rsesek's review #
Total comments: 6
Patch Set 20 : break up unit tests #
Total comments: 2
Patch Set 21 : static_assert #Messages
Total messages: 42 (11 generated)
|