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

Issue 9150030: Initialize IPC:ChannelHandle from existing HANDLE (Closed)

Created:
8 years, 11 months ago by amit
Modified:
8 years, 11 months ago
CC:
chromium-reviews, darin-cc_chromium.org, jam, brettw-cc_chromium.org, sanjeevr
Base URL:
http://git.chromium.org/chromium/src.git@master
Visibility:
Public.

Description

Initialize IPC:ChannelHandle from existing HANDLE 1] Add a ctor to IPC:ChannelHandle that takes a pipe HANDLE. 2] Corresponding change in Channel::ChannelImpl::CreatePipe to attach to the given pipe instead of creating a new one. Being able to hand over a pipe handle to IPC::Channel in this way has other advantages such as using anonymous pipes and safer connections between process with different level of privileges. Here's how it can be done: Server Process: - Create a server pipe, anonymous pipe is fine too. - Server creates a client handle of pipe using CreateFile. - Use DuplicateHandle to duplicate this handle for the client process. - pass over the handle value to the client process, say using comman line. Client process: - Simply receive the handle from the server and hand it over to IPC:Channel using IPC::ChannelHandle. Apart from being more flexible, this is more secure as it removes the 'connection window' while using names. BUG=none TEST=none Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=118786

Patch Set 1 #

Total comments: 1

Patch Set 2 : added assignment operator #

Patch Set 3 : fixed build error #

Total comments: 8

Patch Set 4 : copy handle instead of duplicate/close #

Patch Set 5 : check DuplicateHandle error #

Patch Set 6 : added dchecks #

Total comments: 4

Patch Set 7 : added a test #

Total comments: 1

Patch Set 8 : use #elif #

Total comments: 2

Patch Set 9 : return false instead of DCHECK for inconsistent pipe mode #

Patch Set 10 : use string16 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+104 lines, -12 lines) Patch
M ipc/ipc_channel_handle.h View 1 2 3 4 5 6 7 4 chunks +23 lines, -7 lines 0 comments Download
M ipc/ipc_channel_win.cc View 1 2 3 4 5 6 7 8 9 4 chunks +36 lines, -5 lines 0 comments Download
M ipc/ipc_message_utils.cc View 1 2 3 1 chunk +4 lines, -0 lines 0 comments Download
M ipc/ipc_tests.cc View 1 2 3 4 5 6 1 chunk +41 lines, -0 lines 0 comments Download

Messages

Total messages: 15 (0 generated)
sanjeevr
https://chromiumcodereview.appspot.com/9150030/diff/1/ipc/ipc_channel_handle.h File ipc/ipc_channel_handle.h (right): https://chromiumcodereview.appspot.com/9150030/diff/1/ipc/ipc_channel_handle.h#newcode42 ipc/ipc_channel_handle.h:42: ChannelHandle(HANDLE h) : pipe(h) {} A channel handle that ...
8 years, 11 months ago (2012-01-19 15:36:32 UTC) #1
cpu_(ooo_6.6-7.5)
I support the idea, but have questions, see below. https://chromiumcodereview.appspot.com/9150030/diff/6002/base/win/scoped_handle.h File base/win/scoped_handle.h (right): https://chromiumcodereview.appspot.com/9150030/diff/6002/base/win/scoped_handle.h#newcode1 base/win/scoped_handle.h:1: ...
8 years, 11 months ago (2012-01-19 20:56:04 UTC) #2
amit
I agree with the concern about ScopedHandle closing the ChannelHandle. I can remove it and ...
8 years, 11 months ago (2012-01-19 21:09:19 UTC) #3
cpu_(ooo_6.6-7.5)
Yes, let's try that On 2012/01/19 21:09:19, amit wrote: > I agree with the concern ...
8 years, 11 months ago (2012-01-20 04:35:47 UTC) #4
amit
Changed ChannelHandle to copy handle value, reverted ScopedHandle and addressed other comments. PTAL.
8 years, 11 months ago (2012-01-20 18:06:52 UTC) #5
cpu_(ooo_6.6-7.5)
lgtm with comments and if you promise a simple test in a following CL. http://codereview.chromium.org/9150030/diff/8006/ipc/ipc_channel_handle.h ...
8 years, 11 months ago (2012-01-20 22:22:24 UTC) #6
amit
Added a test, made the HANDLE ctor explicit, verified mode using GetNamedPipeInfo along other suggested ...
8 years, 11 months ago (2012-01-20 23:20:47 UTC) #7
jam
http://codereview.chromium.org/9150030/diff/15002/ipc/ipc_channel_handle.h File ipc/ipc_channel_handle.h (right): http://codereview.chromium.org/9150030/diff/15002/ipc/ipc_channel_handle.h#newcode16 ipc/ipc_channel_handle.h:16: #if defined(OS_WIN) nit: in this file and ipc_message_utils.cc, if ...
8 years, 11 months ago (2012-01-20 23:25:06 UTC) #8
amit
Changed in ipc_channel_handle.h but not in ipc_message_utils.cc as I didn't want to change the order ...
8 years, 11 months ago (2012-01-23 07:20:06 UTC) #9
cpu_(ooo_6.6-7.5)
lgtm on the changes, one important comment below: http://codereview.chromium.org/9150030/diff/16001/ipc/ipc_channel_win.cc File ipc/ipc_channel_win.cc (right): http://codereview.chromium.org/9150030/diff/16001/ipc/ipc_channel_win.cc#newcode140 ipc/ipc_channel_win.cc:140: DCHECK(flags ...
8 years, 11 months ago (2012-01-23 18:55:34 UTC) #10
amit
http://codereview.chromium.org/9150030/diff/16001/ipc/ipc_channel_win.cc File ipc/ipc_channel_win.cc (right): http://codereview.chromium.org/9150030/diff/16001/ipc/ipc_channel_win.cc#newcode140 ipc/ipc_channel_win.cc:140: DCHECK(flags & PIPE_SERVER_END); On 2012/01/23 18:55:34, cpu wrote: > ...
8 years, 11 months ago (2012-01-23 19:58:40 UTC) #11
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/amit@chromium.org/9150030/19002
8 years, 11 months ago (2012-01-23 22:38:11 UTC) #12
commit-bot: I haz the power
Presubmit check for 9150030-19002 failed and returned exit status 1. Running presubmit commit checks ...
8 years, 11 months ago (2012-01-23 22:38:15 UTC) #13
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/amit@chromium.org/9150030/22002
8 years, 11 months ago (2012-01-24 00:57:44 UTC) #14
commit-bot: I haz the power
8 years, 11 months ago (2012-01-24 02:36:07 UTC) #15
Change committed as 118786

Powered by Google App Engine
This is Rietveld 408576698