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

Issue 1387963004: Create a broker interface for the new Mojo EDK so that the browser can create and duplicate messa... (Closed)

Created:
5 years, 2 months ago by jam
Modified:
5 years ago
CC:
Aaron Boodman, abarth-chromium, asanka, ben+mojo_chromium.org, benjhayden+dwatch_chromium.org, chromium-reviews, darin (slow to review), qsr+mojo_chromium.org, viettrungluu+watch_chromium.org, yzshen+watch_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Create a broker interface for the new Mojo EDK so that the browser can create and duplicate message pipes. This is needed on Windows because sandboxed processes can't create named pipes or duplicate their handles to other processes. Since the new EDK uses one OS pipe per Mojo pipe, child processes need the parent process' help. When a message pipe is created in a child process, it will ask the browser process to do it. When a child process wants to send a mojo pipe to another process, it exchanges the pipe handle with an integer token that it sends instead. The receiving process can exchange that token with a pipe handle. With this patch, --use-new-edk works with chrome's sandbox. BUG=478251 R=rickyz@chromium.org, tsepez@chromium.org, yzshen@chromium.org Committed: https://chromium.googlesource.com/chromium/src/+/fbada2c0dfa76e3cad57432dc72fc033aa331b50

Patch Set 1 #

Patch Set 2 : merge #

Patch Set 3 : #

Patch Set 4 : #

Patch Set 5 : #

Patch Set 6 : #

Patch Set 7 : merge #

Patch Set 8 : merge #

Patch Set 9 : merge #

Patch Set 10 : minor build fixes #

Patch Set 11 : merge #

Patch Set 12 : windows only #

Patch Set 13 : merge #

Patch Set 14 : cleanup IPC, use multiple handles/tokens for efficiency, and create pipe in parent #

Patch Set 15 : merge #

Patch Set 16 : fix win64 build #

Patch Set 17 : fix linux #

Patch Set 18 : works on windows now #

Patch Set 19 : merge #

Patch Set 20 : merge #

Patch Set 21 : merge #

Patch Set 22 : fix unittests #

Patch Set 23 : hide classes from embedder #

Patch Set 24 : small cleanup #

Total comments: 27

Patch Set 25 : review comments #

Patch Set 26 : merge #

Total comments: 2

Patch Set 27 : review comments #

Total comments: 6

Patch Set 28 : review comments #

Total comments: 1

Patch Set 29 : merge #

Patch Set 30 : presubmit whitespace error #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+1254 lines, -205 lines) Patch
M content/app/mojo/mojo_init.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 2 chunks +16 lines, -0 lines 0 comments Download
M content/browser/browser_child_process_host_impl.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 3 chunks +8 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 20 21 22 23 24 25 26 27 28 2 chunks +11 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 18 19 20 21 22 23 24 25 1 chunk +3 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 20 21 22 3 chunks +12 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 20 21 22 2 chunks +8 lines, -1 line 0 comments Download
M content/test/run_all_unittests.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 chunk +2 lines, -2 lines 0 comments Download
M mojo/edk/embedder/embedder.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 2 chunks +22 lines, -0 lines 0 comments Download
M mojo/edk/embedder/embedder.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 4 chunks +44 lines, -0 lines 0 comments Download
M mojo/edk/embedder/embedder_internal.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +6 lines, -0 lines 0 comments Download
M mojo/edk/embedder/platform_channel_pair.h View 1 2 3 chunks +11 lines, -1 line 0 comments Download
M mojo/edk/embedder/platform_channel_pair_posix.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 4 chunks +33 lines, -17 lines 0 comments Download
M mojo/edk/embedder/platform_channel_pair_win.cc View 1 2 3 4 5 6 7 8 5 chunks +25 lines, -12 lines 0 comments Download
M mojo/edk/embedder/test_embedder.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 2 chunks +10 lines, -0 lines 0 comments Download
M mojo/edk/system/BUILD.gn View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 3 chunks +10 lines, -0 lines 0 comments Download
A mojo/edk/system/child_token_serializer_win.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 chunk +60 lines, -0 lines 0 comments Download
A mojo/edk/system/child_token_serializer_win.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 1 chunk +124 lines, -0 lines 0 comments Download
M mojo/edk/system/core.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 4 chunks +27 lines, -6 lines 0 comments Download
M mojo/edk/system/message_pipe_dispatcher.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 8 chunks +23 lines, -49 lines 0 comments Download
A mojo/edk/system/parent_token_serializer_state_win.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 chunk +65 lines, -0 lines 0 comments Download
A mojo/edk/system/parent_token_serializer_state_win.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 1 chunk +75 lines, -0 lines 0 comments Download
A mojo/edk/system/parent_token_serializer_win.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 chunk +59 lines, -0 lines 0 comments Download
A mojo/edk/system/parent_token_serializer_win.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 1 chunk +176 lines, -0 lines 0 comments Download
M mojo/edk/system/raw_channel_posix.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 1 chunk +9 lines, -3 lines 0 comments Download
M mojo/edk/system/raw_channel_win.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 5 chunks +11 lines, -43 lines 0 comments Download
A mojo/edk/system/simple_token_serializer_win.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 1 chunk +37 lines, -0 lines 0 comments Download
A mojo/edk/system/simple_token_serializer_win.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 1 chunk +78 lines, -0 lines 0 comments Download
A mojo/edk/system/token_serializer_messages_win.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 1 chunk +46 lines, -0 lines 1 comment Download
A mojo/edk/system/token_serializer_win.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 1 chunk +43 lines, -0 lines 0 comments Download
M mojo/edk/system/transport_data.cc View 1 2 3 4 5 6 7 1 chunk +1 line, -1 line 0 comments Download
M mojo/mojo_edk.gyp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 3 chunks +10 lines, -0 lines 0 comments Download
M mojo/runner/context.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 chunk +4 lines, -0 lines 0 comments Download
M mojo/runner/host/child_process.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 8 chunks +86 lines, -46 lines 0 comments Download
M mojo/runner/host/child_process_host.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 2 chunks +13 lines, -4 lines 0 comments Download
M mojo/runner/host/child_process_host.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 5 chunks +48 lines, -18 lines 0 comments Download
M third_party/mojo/src/mojo/edk/embedder/embedder.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 chunk +14 lines, -0 lines 0 comments Download
M third_party/mojo/src/mojo/edk/embedder/embedder.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 3 chunks +24 lines, -2 lines 0 comments Download

Messages

Total messages: 54 (26 generated)
jam
Yuzhu: main reviewer Justin: this is the change we discussed, please review from a security ...
5 years, 1 month ago (2015-11-20 16:38:17 UTC) #12
jam
btw I don't forsee new messages being added to token_serializer_messages_win.h (since that's all we need). ...
5 years, 1 month ago (2015-11-20 16:48:25 UTC) #13
jam
btw to summarize an in-person conversation with Yuzhu about handle leakage: It is possible that ...
5 years, 1 month ago (2015-11-20 18:55:04 UTC) #14
yzshen1
https://codereview.chromium.org/1387963004/diff/620001/mojo/edk/system/child_token_serializer_win.cc File mojo/edk/system/child_token_serializer_win.cc (right): https://codereview.chromium.org/1387963004/diff/620001/mojo/edk/system/child_token_serializer_win.cc#newcode54 mojo/edk/system/child_token_serializer_win.cc:54: WriteAndReadResponse(message, tokens, response_size); Is there any error handling needed ...
5 years, 1 month ago (2015-11-20 20:39:55 UTC) #15
jam
https://codereview.chromium.org/1387963004/diff/620001/mojo/edk/system/child_token_serializer_win.cc File mojo/edk/system/child_token_serializer_win.cc (right): https://codereview.chromium.org/1387963004/diff/620001/mojo/edk/system/child_token_serializer_win.cc#newcode54 mojo/edk/system/child_token_serializer_win.cc:54: WriteAndReadResponse(message, tokens, response_size); On 2015/11/20 20:39:55, yzshen1 wrote: > ...
5 years, 1 month ago (2015-11-21 01:26:10 UTC) #18
yzshen1
https://codereview.chromium.org/1387963004/diff/620001/mojo/edk/system/default_token_serializer_win.h File mojo/edk/system/default_token_serializer_win.h (right): https://codereview.chromium.org/1387963004/diff/620001/mojo/edk/system/default_token_serializer_win.h#newcode14 mojo/edk/system/default_token_serializer_win.h:14: // production use (i.e. with multi-process, sandboxes). It's provided ...
5 years, 1 month ago (2015-11-23 16:47:02 UTC) #19
jam
https://codereview.chromium.org/1387963004/diff/620001/mojo/edk/system/default_token_serializer_win.h File mojo/edk/system/default_token_serializer_win.h (right): https://codereview.chromium.org/1387963004/diff/620001/mojo/edk/system/default_token_serializer_win.h#newcode14 mojo/edk/system/default_token_serializer_win.h:14: // production use (i.e. with multi-process, sandboxes). It's provided ...
5 years, 1 month ago (2015-11-23 17:12:35 UTC) #20
jam
Switching to Tom for security review since jschuh is ooo
5 years, 1 month ago (2015-11-23 17:22:46 UTC) #22
yzshen1
On 2015/11/23 17:22:46, jam wrote: > Switching to Tom for security review since jschuh is ...
5 years, 1 month ago (2015-11-23 17:34:39 UTC) #23
Tom Sepez
+wfh for the specifics of the windows system calls. https://codereview.chromium.org/1387963004/diff/680001/mojo/edk/system/parent_token_serializer_state_win.cc File mojo/edk/system/parent_token_serializer_state_win.cc (right): https://codereview.chromium.org/1387963004/diff/680001/mojo/edk/system/parent_token_serializer_state_win.cc#newcode36 mojo/edk/system/parent_token_serializer_state_win.cc:36: ...
5 years, 1 month ago (2015-11-23 18:14:42 UTC) #25
Tom Sepez
+jln for mojo/runner/host/child_process.cc https://codereview.chromium.org/1387963004/diff/680001/mojo/edk/embedder/platform_channel_pair_posix.cc File mojo/edk/embedder/platform_channel_pair_posix.cc (right): https://codereview.chromium.org/1387963004/diff/680001/mojo/edk/embedder/platform_channel_pair_posix.cc#newcode49 mojo/edk/embedder/platform_channel_pair_posix.cc:49: // don't peak) as a way ...
5 years, 1 month ago (2015-11-23 18:28:54 UTC) #27
jam
https://codereview.chromium.org/1387963004/diff/680001/mojo/edk/system/parent_token_serializer_state_win.cc File mojo/edk/system/parent_token_serializer_state_win.cc (right): https://codereview.chromium.org/1387963004/diff/680001/mojo/edk/system/parent_token_serializer_state_win.cc#newcode36 mojo/edk/system/parent_token_serializer_state_win.cc:36: token = base::RandUint64(); On 2015/11/23 18:14:42, Tom Sepez wrote: ...
5 years, 1 month ago (2015-11-23 18:29:01 UTC) #28
jam
https://codereview.chromium.org/1387963004/diff/680001/mojo/edk/embedder/platform_channel_pair_posix.cc File mojo/edk/embedder/platform_channel_pair_posix.cc (right): https://codereview.chromium.org/1387963004/diff/680001/mojo/edk/embedder/platform_channel_pair_posix.cc#newcode49 mojo/edk/embedder/platform_channel_pair_posix.cc:49: // don't peak) as a way of determining later ...
5 years, 1 month ago (2015-11-23 18:38:16 UTC) #29
Tom Sepez
> > the method in crypto/random.h just calls out to the same implementation > (base::RandBytes) ...
5 years, 1 month ago (2015-11-23 18:38:40 UTC) #30
Will Harris
On 2015/11/23 18:38:40, Tom Sepez wrote: > > > > the method in crypto/random.h just ...
5 years, 1 month ago (2015-11-23 18:49:46 UTC) #31
jam
On 2015/11/23 18:28:54, Tom Sepez wrote: > +jln for mojo/runner/host/child_process.cc btw the non-windows changes there ...
5 years, 1 month ago (2015-11-23 18:58:21 UTC) #33
Tom Sepez
On 2015/11/23 18:58:21, jam wrote: > On 2015/11/23 18:28:54, Tom Sepez wrote: > > +jln ...
5 years, 1 month ago (2015-11-23 21:16:58 UTC) #34
jln (very slow on Chromium)
On 2015/11/23 21:16:58, Tom Sepez wrote: > On 2015/11/23 18:58:21, jam wrote: > > On ...
5 years, 1 month ago (2015-11-23 21:28:23 UTC) #36
Tom Sepez
> > Wanted jln to look at the sandbox stuff. > > Thanks Tom. After ...
5 years, 1 month ago (2015-11-24 00:17:48 UTC) #37
rickyz (no longer on Chrome)
sandbox move lgtm https://codereview.chromium.org/1387963004/diff/700001/mojo/edk/system/child_token_serializer_win.h File mojo/edk/system/child_token_serializer_win.h (right): https://codereview.chromium.org/1387963004/diff/700001/mojo/edk/system/child_token_serializer_win.h#newcode53 mojo/edk/system/child_token_serializer_win.h:53: base::internal::LockImpl lock_; Unlocking this on a ...
5 years, 1 month ago (2015-11-24 00:30:43 UTC) #38
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1387963004/720001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1387963004/720001
5 years ago (2015-11-24 01:27:06 UTC) #41
commit-bot: I haz the power
Try jobs failed on following builders: linux_chromium_chromeos_rel_ng on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_chromeos_rel_ng/builds/133204)
5 years ago (2015-11-24 03:12:45 UTC) #43
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1387963004/720001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1387963004/720001
5 years ago (2015-11-24 04:20:40 UTC) #45
commit-bot: I haz the power
Try jobs failed on following builders: chromium_presubmit on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/chromium_presubmit/builds/121612)
5 years ago (2015-11-24 04:32:09 UTC) #47
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1387963004/740001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1387963004/740001
5 years ago (2015-11-24 05:14:13 UTC) #50
commit-bot: I haz the power
Patchset 30 (id:??) landed as https://crrev.com/fbada2c0dfa76e3cad57432dc72fc033aa331b50 Cr-Commit-Position: refs/heads/master@{#361265}
5 years ago (2015-11-24 06:40:55 UTC) #51
jam
Committed patchset #30 (id:740001) manually as fbada2c0dfa76e3cad57432dc72fc033aa331b50 (presubmit successful).
5 years ago (2015-11-24 06:41:18 UTC) #52
brucedawson
5 years ago (2015-11-25 20:44:11 UTC) #54
Message was sent while issue was closed.
https://codereview.chromium.org/1387963004/diff/740001/mojo/edk/system/token_...
File mojo/edk/system/token_serializer_messages_win.h (right):

https://codereview.chromium.org/1387963004/diff/740001/mojo/edk/system/token_...
mojo/edk/system/token_serializer_messages_win.h:30: struct ALIGNAS(4)
TokenSerializerMessage {
What is the purpose of the ALIGNAS(4) directive here? VC++ 2015 doesn't like it:

warning C4359: 'mojo::edk::TokenSerializerMessage': Alignment specifier is less
than actual alignment (8), and will be ignored.

The problem is the uint64_t member which (even in 32-bit x86 builds with VC++)
has 8-byte alignment. And, it appears that __declspec(align()) can only be used
to increase the alignment, not decrease it.

Was the goal to change the *packing* of the struct, or the alignment? If the
packing of the struct was set to 4 then that would ensure that it was optimally
packed without hitting this problem, and would also reduce the alignment
requirements.

As it stands the struct is already optimally packed, although it's 8-byte
alignment requirement may affect structures that it is placed in.

I think that the fix is to remove the ALIGNAS(4) directive. VC++ 2013 is already
ignoring it - VC++ 2015 is just more honest about it.

Powered by Google App Engine
This is Rietveld 408576698