Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(694)

Issue 1137453002: content: Pass IOSurface references using Mach IPC. (Closed)

Created:
5 years, 7 months ago by reveman
Modified:
5 years, 6 months ago
CC:
chromium-reviews, danakj+watch_chromium.org, darin-cc_chromium.org, jam, jbauman+watch_chromium.org, kalyank, piman+watch_chromium.org, sievers+watch_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

content: 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 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1141 lines, -37 lines) Patch
M content/app/content_main_runner.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2 chunks +14 lines, -0 lines 0 comments Download
A content/browser/browser_io_surface_manager_mac.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 1 chunk +115 lines, -0 lines 0 comments Download
A content/browser/browser_io_surface_manager_mac.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 chunk +297 lines, -0 lines 0 comments Download
A content/browser/browser_io_surface_manager_mac_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 1 chunk +242 lines, -0 lines 0 comments Download
M content/browser/browser_main_loop.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 2 chunks +8 lines, -0 lines 0 comments Download
M content/browser/child_process_launcher.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2 chunks +4 lines, -0 lines 0 comments Download
M content/browser/gpu/gpu_process_host.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 2 chunks +10 lines, -0 lines 0 comments Download
M content/browser/renderer_host/render_process_host_impl.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2 chunks +10 lines, -0 lines 0 comments Download
M content/browser/renderer_host/render_process_host_impl.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 3 chunks +19 lines, -0 lines 0 comments Download
A content/child/child_io_surface_manager_mac.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 chunk +53 lines, -0 lines 0 comments Download
A content/child/child_io_surface_manager_mac.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 1 chunk +143 lines, -0 lines 0 comments Download
M content/child/child_thread_impl.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 2 chunks +7 lines, -0 lines 0 comments Download
M content/child/child_thread_impl.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 3 chunks +15 lines, -0 lines 0 comments Download
M content/common/child_process_messages.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 3 chunks +11 lines, -3 lines 0 comments Download
M content/common/gpu/client/gpu_memory_buffer_impl_io_surface.cc View 3 chunks +2 lines, -2 lines 0 comments Download
M content/common/gpu/gpu_memory_buffer_factory_io_surface.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 3 chunks +16 lines, -15 lines 0 comments Download
A content/common/mac/io_surface_manager.h View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +41 lines, -0 lines 0 comments Download
A + content/common/mac/io_surface_manager.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 chunk +5 lines, -5 lines 0 comments Download
A content/common/mac/io_surface_manager_messages.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 chunk +66 lines, -0 lines 0 comments Download
A content/common/mac/io_surface_manager_token.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 chunk +16 lines, -0 lines 0 comments Download
M content/content_browser.gypi View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 chunk +2 lines, -0 lines 0 comments Download
M content/content_child.gypi View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 chunk +2 lines, -0 lines 0 comments Download
M content/content_common.gypi View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 chunk +4 lines, -0 lines 0 comments Download
M content/content_tests.gypi View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 chunk +1 line, -0 lines 0 comments Download
M content/test/content_test_suite.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 3 chunks +33 lines, -0 lines 0 comments Download
M gpu/command_buffer/common/mailbox.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 2 chunks +4 lines, -1 line 0 comments Download
M ui/gfx/gpu_memory_buffer.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 chunk +0 lines, -3 lines 0 comments Download
M ui/gfx/gpu_memory_buffer.cc View 1 chunk +1 line, -8 lines 0 comments Download

Messages

Total messages: 42 (11 generated)
reveman
5 years, 7 months ago (2015-05-07 20:36:44 UTC) #2
Daniele Castagna
As far as I understand, it lgtm. Someone with better knowledge of the Mach and ...
5 years, 7 months ago (2015-05-08 18:58:30 UTC) #3
reveman
+avi https://codereview.chromium.org/1137453002/diff/20001/content/browser/mach_broker_mac.h File content/browser/mach_broker_mac.h (right): https://codereview.chromium.org/1137453002/diff/20001/content/browser/mach_broker_mac.h#newcode58 content/browser/mach_broker_mac.h:58: // process. On 2015/05/08 at 18:58:30, Daniele Castagna ...
5 years, 7 months ago (2015-05-09 15:54:56 UTC) #5
Avi (use Gerrit)
I have some objections to the placement of code, but I am not qualified to ...
5 years, 7 months ago (2015-05-09 18:00:28 UTC) #6
reveman
https://codereview.chromium.org/1137453002/diff/40001/content/app/content_main_runner.cc File content/app/content_main_runner.cc (right): https://codereview.chromium.org/1137453002/diff/40001/content/app/content_main_runner.cc#newcode132 content/app/content_main_runner.cc:132: class IOSurfaceManagerImpl : public IOSurfaceManager { On 2015/05/09 at ...
5 years, 7 months ago (2015-05-09 19:24:24 UTC) #7
Avi (use Gerrit)
https://codereview.chromium.org/1137453002/diff/40001/content/app/content_main_runner.cc File content/app/content_main_runner.cc (right): https://codereview.chromium.org/1137453002/diff/40001/content/app/content_main_runner.cc#newcode132 content/app/content_main_runner.cc:132: class IOSurfaceManagerImpl : public IOSurfaceManager { On 2015/05/09 19:24:23, ...
5 years, 7 months ago (2015-05-09 20:41:02 UTC) #8
reveman
PTAL https://codereview.chromium.org/1137453002/diff/40001/content/app/content_main_runner.cc File content/app/content_main_runner.cc (right): https://codereview.chromium.org/1137453002/diff/40001/content/app/content_main_runner.cc#newcode132 content/app/content_main_runner.cc:132: class IOSurfaceManagerImpl : public IOSurfaceManager { On 2015/05/09 ...
5 years, 7 months ago (2015-05-10 18:45:08 UTC) #9
Avi (use Gerrit)
I'm cool with the organization now, but find a Mach reviewer. I'll stamp when they're ...
5 years, 7 months ago (2015-05-10 20:00:04 UTC) #10
reveman
+rsesek for everything Mach related fyi, design doc: https://docs.google.com/a/chromium.org/document/d/1L8wZtEDtQ2S6dLfNcZHopMgZVzq2z7OrUCedXitTAkU/edit?usp=sharing
5 years, 7 months ago (2015-05-11 15:03:18 UTC) #12
Robert Sesek
Still looking, but I have a high-level question: Is there a strong need to co-mingle ...
5 years, 7 months ago (2015-05-12 23:15:25 UTC) #13
reveman
https://codereview.chromium.org/1137453002/diff/140001/content/common/mac/io_surface_manager.h File content/common/mac/io_surface_manager.h (right): https://codereview.chromium.org/1137453002/diff/140001/content/common/mac/io_surface_manager.h#newcode14 content/common/mac/io_surface_manager.h:14: class CONTENT_EXPORT IOSurfaceManager { On 2015/05/12 at 23:15:25, Robert ...
5 years, 7 months ago (2015-05-15 14:48:58 UTC) #14
Robert Sesek
Nice, definitely a lot cleaner than before. https://codereview.chromium.org/1137453002/diff/210001/content/browser/browser_io_surface_manager_mac.cc File content/browser/browser_io_surface_manager_mac.cc (right): https://codereview.chromium.org/1137453002/diff/210001/content/browser/browser_io_surface_manager_mac.cc#newcode7 content/browser/browser_io_surface_manager_mac.cc:7: #include <bsm/libbsm.h> ...
5 years, 7 months ago (2015-05-15 21:45:05 UTC) #15
reveman
PTAL https://codereview.chromium.org/1137453002/diff/210001/content/browser/browser_io_surface_manager_mac.cc File content/browser/browser_io_surface_manager_mac.cc (right): https://codereview.chromium.org/1137453002/diff/210001/content/browser/browser_io_surface_manager_mac.cc#newcode7 content/browser/browser_io_surface_manager_mac.cc:7: #include <bsm/libbsm.h> On 2015/05/15 at 21:45:05, Robert Sesek ...
5 years, 7 months ago (2015-05-18 18:15:39 UTC) #16
Robert Sesek
https://codereview.chromium.org/1137453002/diff/210001/content/browser/browser_io_surface_manager_mac.cc File content/browser/browser_io_surface_manager_mac.cc (right): https://codereview.chromium.org/1137453002/diff/210001/content/browser/browser_io_surface_manager_mac.cc#newcode224 content/browser/browser_io_surface_manager_mac.cc:224: } On 2015/05/18 18:15:38, reveman wrote: > On 2015/05/15 ...
5 years, 7 months ago (2015-05-19 23:26:24 UTC) #17
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1137453002/330001
5 years, 7 months ago (2015-05-27 05:02:18 UTC) #20
reveman
+piman for gpu/ PTAL https://codereview.chromium.org/1137453002/diff/310001/content/browser/browser_io_surface_manager_mac.cc File content/browser/browser_io_surface_manager_mac.cc (right): https://codereview.chromium.org/1137453002/diff/310001/content/browser/browser_io_surface_manager_mac.cc#newcode152 content/browser/browser_io_surface_manager_mac.cc:152: HandleRequest(); On 2015/05/19 at 23:26:23, ...
5 years, 7 months ago (2015-05-27 05:03:18 UTC) #22
reveman
+piman for gpu/ PTAL
5 years, 7 months ago (2015-05-27 05:03:20 UTC) #24
commit-bot: I haz the power
Dry run: This issue passed the CQ dry run.
5 years, 7 months ago (2015-05-27 06:12:00 UTC) #26
piman
LGTM for gpu. I know nothing about mach IPC so I'll let others evaluate the ...
5 years, 7 months ago (2015-05-27 19:37:17 UTC) #27
Robert Sesek
Looking really good now. Just some nits now. https://codereview.chromium.org/1137453002/diff/310001/content/browser/browser_io_surface_manager_mac.cc File content/browser/browser_io_surface_manager_mac.cc (right): https://codereview.chromium.org/1137453002/diff/310001/content/browser/browser_io_surface_manager_mac.cc#newcode198 content/browser/browser_io_surface_manager_mac.cc:198: return; ...
5 years, 6 months ago (2015-05-28 18:25:12 UTC) #28
reveman
https://codereview.chromium.org/1137453002/diff/330001/content/browser/browser_io_surface_manager_mac.cc File content/browser/browser_io_surface_manager_mac.cc (right): https://codereview.chromium.org/1137453002/diff/330001/content/browser/browser_io_surface_manager_mac.cc#newcode197 content/browser/browser_io_surface_manager_mac.cc:197: // Unregister requests are asynchronous and does not require ...
5 years, 6 months ago (2015-05-29 00:09:02 UTC) #29
Robert Sesek
https://codereview.chromium.org/1137453002/diff/330001/content/browser/browser_io_surface_manager_mac_unittest.cc File content/browser/browser_io_surface_manager_mac_unittest.cc (right): https://codereview.chromium.org/1137453002/diff/330001/content/browser/browser_io_surface_manager_mac_unittest.cc#newcode82 content/browser/browser_io_surface_manager_mac_unittest.cc:82: } On 2015/05/29 00:09:02, reveman wrote: > On 2015/05/28 ...
5 years, 6 months ago (2015-06-01 21:58:07 UTC) #30
reveman
https://codereview.chromium.org/1137453002/diff/330001/content/browser/browser_io_surface_manager_mac_unittest.cc File content/browser/browser_io_surface_manager_mac_unittest.cc (right): https://codereview.chromium.org/1137453002/diff/330001/content/browser/browser_io_surface_manager_mac_unittest.cc#newcode82 content/browser/browser_io_surface_manager_mac_unittest.cc:82: } On 2015/06/01 21:58:06, Robert Sesek wrote: > On ...
5 years, 6 months ago (2015-06-02 22:48:07 UTC) #31
Robert Sesek
LGTM
5 years, 6 months ago (2015-06-03 20:19:37 UTC) #32
reveman
Robert, thanks for taking the time to review this. Current patch is a major improvement ...
5 years, 6 months ago (2015-06-03 20:24:58 UTC) #33
Avi (use Gerrit)
One small nit; lgtm otherwise. https://codereview.chromium.org/1137453002/diff/370001/content/browser/browser_io_surface_manager_mac.cc File content/browser/browser_io_surface_manager_mac.cc (right): https://codereview.chromium.org/1137453002/diff/370001/content/browser/browser_io_surface_manager_mac.cc#newcode228 content/browser/browser_io_surface_manager_mac.cc:228: "Mach message token size ...
5 years, 6 months ago (2015-06-03 21:31:53 UTC) #34
reveman
+nasko for content/common/*_messages.h see https://docs.google.com/document/d/1L8wZtEDtQ2S6dLfNcZHopMgZVzq2z7OrUCedXitTAkU/edit?usp=sharing for more details https://codereview.chromium.org/1137453002/diff/370001/content/browser/browser_io_surface_manager_mac.cc File content/browser/browser_io_surface_manager_mac.cc (right): https://codereview.chromium.org/1137453002/diff/370001/content/browser/browser_io_surface_manager_mac.cc#newcode228 content/browser/browser_io_surface_manager_mac.cc:228: "Mach ...
5 years, 6 months ago (2015-06-03 22:47:49 UTC) #36
nasko
Rubberstamp LGTM for IPC, based on rsesek@'s review of this CL.
5 years, 6 months ago (2015-06-03 23:40:00 UTC) #37
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1137453002/390001
5 years, 6 months ago (2015-06-04 00:01:59 UTC) #40
commit-bot: I haz the power
Committed patchset #21 (id:390001)
5 years, 6 months ago (2015-06-04 01:27:18 UTC) #41
commit-bot: I haz the power
5 years, 6 months ago (2015-06-04 01:28:22 UTC) #42
Message was sent while issue was closed.
Patchset 21 (id:??) landed as
https://crrev.com/7c45b308edffa29d63d752fef7f7bf759a465a64
Cr-Commit-Position: refs/heads/master@{#332757}

Powered by Google App Engine
This is Rietveld 408576698