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

Issue 1418113003: mac: Add auto-close and share-read-only functionality to SharedMemory. (Closed)

Created:
5 years, 2 months ago by erikchen
Modified:
5 years, 2 months ago
CC:
chromium-reviews, darin-cc_chromium.org, jam, gavinp+memory_chromium.org, vmpstr+watch_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

mac: Add auto-close and share-read-only functionality to Mach based SharedMemory. base::FileDescriptor has a property |auto_close| that is used to indicate that when the object is passed to an IPC message, the message takes ownership of the underlying OS handle. Since SharedMemoryHandle needs to be interchangeable with base::FileDescriptor, I added a property with similar functionality named |ownership_passes_to_ipc_|. The method ShareToProcess() is used to lower the current and maximum protection of the underlying OS handle before it is transferred to a different process. I implemented this functionality for Mach memory objects. BUG=535711 Committed: https://crrev.com/033bbbcb63cab781552dfb435c035131c423de30 Cr-Commit-Position: refs/heads/master@{#355880}

Patch Set 1 #

Patch Set 2 : #

Patch Set 3 : #

Patch Set 4 : #

Total comments: 4

Patch Set 5 : Comments from mark. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+443 lines, -22 lines) Patch
M base/memory/shared_memory_handle.h View 2 chunks +9 lines, -0 lines 0 comments Download
M base/memory/shared_memory_handle_mac.cc View 1 2 3 4 6 chunks +22 lines, -2 lines 0 comments Download
M base/memory/shared_memory_mac.cc View 1 2 3 4 3 chunks +69 lines, -1 line 0 comments Download
M base/memory/shared_memory_mac_unittest.cc View 1 2 3 4 7 chunks +164 lines, -14 lines 0 comments Download
M ipc/attachment_broker_mac_unittest.cc View 1 2 3 4 15 chunks +130 lines, -5 lines 0 comments Download
M ipc/attachment_broker_privileged_mac_unittest.cc View 1 2 3 4 4 chunks +13 lines, -0 lines 0 comments Download
M ipc/ipc_message_utils.cc View 1 2 3 1 chunk +6 lines, -0 lines 0 comments Download
M ipc/test_util_mac.h View 1 1 chunk +5 lines, -0 lines 0 comments Download
M ipc/test_util_mac.cc View 1 2 chunks +25 lines, -0 lines 0 comments Download

Messages

Total messages: 21 (6 generated)
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1418113003/60001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1418113003/60001
5 years, 2 months ago (2015-10-23 00:29:02 UTC) #2
erikchen
mark: Please review.
5 years, 2 months ago (2015-10-23 00:34:29 UTC) #4
commit-bot: I haz the power
Dry run: This issue passed the CQ dry run.
5 years, 2 months ago (2015-10-23 01:47:21 UTC) #7
Mark Mentovai
LGTM https://codereview.chromium.org/1418113003/diff/60001/base/memory/shared_memory_handle_mac.cc File base/memory/shared_memory_handle_mac.cc (right): https://codereview.chromium.org/1418113003/diff/60001/base/memory/shared_memory_handle_mac.cc#newcode190 base/memory/shared_memory_handle_mac.cc:190: VM_PROT_WRITE | VM_PROT_READ | VM_PROT_IS_MASK, // Maximum protection ...
5 years, 2 months ago (2015-10-23 14:24:03 UTC) #8
erikchen
https://codereview.chromium.org/1418113003/diff/60001/base/memory/shared_memory_handle_mac.cc File base/memory/shared_memory_handle_mac.cc (right): https://codereview.chromium.org/1418113003/diff/60001/base/memory/shared_memory_handle_mac.cc#newcode190 base/memory/shared_memory_handle_mac.cc:190: VM_PROT_WRITE | VM_PROT_READ | VM_PROT_IS_MASK, // Maximum protection On ...
5 years, 2 months ago (2015-10-23 17:13:31 UTC) #9
Mark Mentovai
(1) is mostly only sucky because 10.6, which nobody tests, will behave differently than other ...
5 years, 2 months ago (2015-10-23 17:16:31 UTC) #10
erikchen
mark: PTAL https://codereview.chromium.org/1418113003/diff/60001/base/memory/shared_memory_mac.cc File base/memory/shared_memory_mac.cc (right): https://codereview.chromium.org/1418113003/diff/60001/base/memory/shared_memory_mac.cc#newcode410 base/memory/shared_memory_mac.cc:410: // Unmap() and Close(). On 2015/10/23 14:24:03, ...
5 years, 2 months ago (2015-10-23 17:25:56 UTC) #11
Mark Mentovai
LGTM. OK, no 10.6 support it is.
5 years, 2 months ago (2015-10-23 17:36:19 UTC) #12
erikchen
tsepez: Please review.
5 years, 2 months ago (2015-10-23 17:38:18 UTC) #14
erikchen
On 2015/10/23 17:38:18, erikchen wrote: > tsepez: Please review. *Please review ipc/
5 years, 2 months ago (2015-10-23 17:39:05 UTC) #15
Tom Sepez
lgtm
5 years, 2 months ago (2015-10-23 18:28:29 UTC) #16
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1418113003/80001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1418113003/80001
5 years, 2 months ago (2015-10-23 18:34:57 UTC) #18
commit-bot: I haz the power
Committed patchset #5 (id:80001)
5 years, 2 months ago (2015-10-23 21:05:32 UTC) #19
commit-bot: I haz the power
Patchset 5 (id:??) landed as https://crrev.com/033bbbcb63cab781552dfb435c035131c423de30 Cr-Commit-Position: refs/heads/master@{#355880}
5 years, 2 months ago (2015-10-23 21:07:18 UTC) #20
erikchen
5 years, 2 months ago (2015-10-23 22:29:53 UTC) #21
Message was sent while issue was closed.
A revert of this CL (patchset #5 id:80001) has been created in
https://codereview.chromium.org/1421933002/ by erikchen@chromium.org.

The reason for reverting is: New unit-tests failing on 10.8

http://build.chromium.org/p/chromium.mac/builders/Mac10.8%20Tests/builds/1013....

Powered by Google App Engine
This is Rietveld 408576698