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

Issue 1677163003: base: Create file mappings with reduced access control permissions. (Closed)

Created:
4 years, 10 months ago by erikchen
Modified:
4 years, 9 months ago
CC:
chromium-reviews, 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

base: Create file mappings with reduced access control permissions. A newly created file mapping has two sets of permissions. It has access control permissions (WRITE_DAC, WRITE_OWNER, READ_CONTROL, and DELETE) and file permissions (FILE_MAP_READ, FILE_MAP_WRITE, etc.). ::DuplicateHandle() with the parameter DUPLICATE_SAME_ACCESS copies both sets of permissions. The Chrome sandbox prevents HANDLEs with the WRITE_DAC permission from being duplicated into unprivileged processes. But the only way to copy file permissions is with the parameter DUPLICATE_SAME_ACCESS. This means that there is no way for a privileged process to duplicate a file mapping into an unprivileged process while maintaining the previous file permissions. This CL removes all access control permissions of a file mapping immediately after creation, which effectively means that ::DuplicateHandle() only copies the file permissions. These permissions are only enforced if the file mapping has a name, so this CL also gives all file mappings a name. BUG=493414 Committed: https://crrev.com/4b12c0a123b31adcccb095cb2a49ca7b59f9f1fb Cr-Commit-Position: refs/heads/master@{#376358}

Patch Set 1 #

Patch Set 2 : #

Patch Set 3 : Fix type. #

Patch Set 4 : Update comments. #

Patch Set 5 : Always name shared memory handles. Add test. #

Patch Set 6 : Update comments, again. #

Total comments: 6

Patch Set 7 : Comments from mark. #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+261 lines, -5 lines) Patch
M base/BUILD.gn View 1 2 3 4 5 6 1 chunk +1 line, -0 lines 0 comments Download
M base/base.gyp View 1 2 3 4 5 6 1 chunk +2 lines, -1 line 0 comments Download
M base/memory/shared_memory_win.cc View 1 2 3 4 5 6 3 chunks +38 lines, -4 lines 0 comments Download
A base/memory/shared_memory_win_unittest.cc View 1 2 3 4 5 6 1 chunk +220 lines, -0 lines 2 comments Download

Messages

Total messages: 51 (22 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/1677163003/1 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1677163003/1
4 years, 10 months ago (2016-02-09 02:46:38 UTC) #2
commit-bot: I haz the power
Dry run: This issue passed the CQ dry run.
4 years, 10 months ago (2016-02-09 04:21:50 UTC) #4
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1677163003/40001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1677163003/40001
4 years, 10 months ago (2016-02-09 18:50:27 UTC) #6
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1677163003/60001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1677163003/60001
4 years, 10 months ago (2016-02-09 19:10:33 UTC) #10
erikchen
tsepez: Please review.
4 years, 10 months ago (2016-02-09 19:11:47 UTC) #12
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: android_chromium_gn_compile_dbg on tryserver.chromium.android (JOB_FAILED, https://build.chromium.org/p/tryserver.chromium.android/builders/android_chromium_gn_compile_dbg/builds/19536)
4 years, 10 months ago (2016-02-09 19:53:21 UTC) #14
Tom Sepez
LGTM, but get will or some windows expert to doublecheck.
4 years, 10 months ago (2016-02-10 00:30:54 UTC) #16
erikchen
On 2016/02/10 00:30:54, Tom Sepez wrote: > LGTM, but get will or some windows expert ...
4 years, 10 months ago (2016-02-10 00:31:32 UTC) #18
Tom Sepez
On 2016/02/10 00:30:54, Tom Sepez wrote: > LGTM, but get will or some windows expert ...
4 years, 10 months ago (2016-02-10 00:31:45 UTC) #19
penny
On 2016/02/10 00:31:45, Tom Sepez wrote: > On 2016/02/10 00:30:54, Tom Sepez wrote: > > ...
4 years, 10 months ago (2016-02-10 01:37:26 UTC) #20
erikchen
jschuh: Looking for a sanity check. mark: Looking for an OWNER review.
4 years, 10 months ago (2016-02-10 01:52:25 UTC) #22
jschuh
I have to think about what's correct here. The problem you're hitting is that Windows ...
4 years, 10 months ago (2016-02-10 06:49:05 UTC) #23
erikchen
penny: PTAL I talked with jschuh, and he recommended always naming the object. I did ...
4 years, 10 months ago (2016-02-13 01:36:36 UTC) #24
penny
The new test is great. See my tiny musings. Otherwise seems all good. https://codereview.chromium.org/1677163003/diff/100001/base/memory/shared_memory_win.cc File ...
4 years, 10 months ago (2016-02-17 00:32:24 UTC) #26
erikchen
https://codereview.chromium.org/1677163003/diff/100001/base/memory/shared_memory_win.cc File base/memory/shared_memory_win.cc (right): https://codereview.chromium.org/1677163003/diff/100001/base/memory/shared_memory_win.cc#newcode206 base/memory/shared_memory_win.cc:206: if (name_.empty()) { On 2016/02/17 00:32:24, penny wrote: > ...
4 years, 10 months ago (2016-02-17 00:43:22 UTC) #27
penny
On 2016/02/17 00:43:22, erikchen wrote: > https://codereview.chromium.org/1677163003/diff/100001/base/memory/shared_memory_win.cc > File base/memory/shared_memory_win.cc (right): > > https://codereview.chromium.org/1677163003/diff/100001/base/memory/shared_memory_win.cc#newcode206 > ...
4 years, 10 months ago (2016-02-17 00:47:39 UTC) #28
erikchen
On 2016/02/17 00:47:39, penny wrote: > On 2016/02/17 00:43:22, erikchen wrote: > > > https://codereview.chromium.org/1677163003/diff/100001/base/memory/shared_memory_win.cc ...
4 years, 10 months ago (2016-02-17 00:48:41 UTC) #29
Mark Mentovai
LGTM https://codereview.chromium.org/1677163003/diff/100001/base/memory/shared_memory_win.cc File base/memory/shared_memory_win.cc (right): https://codereview.chromium.org/1677163003/diff/100001/base/memory/shared_memory_win.cc#newcode95 base/memory/shared_memory_win.cc:95: ::CloseHandle(h); BOOL rv = ::CloseHandle(h); DCHECK(rv); ? https://codereview.chromium.org/1677163003/diff/100001/base/memory/shared_memory_win_unittest.cc ...
4 years, 10 months ago (2016-02-17 19:03:14 UTC) #30
erikchen
https://codereview.chromium.org/1677163003/diff/100001/base/memory/shared_memory_win.cc File base/memory/shared_memory_win.cc (right): https://codereview.chromium.org/1677163003/diff/100001/base/memory/shared_memory_win.cc#newcode95 base/memory/shared_memory_win.cc:95: ::CloseHandle(h); On 2016/02/17 19:03:14, Mark Mentovai wrote: > BOOL ...
4 years, 10 months ago (2016-02-17 19:22:27 UTC) #31
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1677163003/120001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1677163003/120001
4 years, 10 months ago (2016-02-17 19:24:15 UTC) #34
commit-bot: I haz the power
Try jobs failed on following builders: win8_chromium_ng on tryserver.chromium.win (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.win/builders/win8_chromium_ng/builds/104653)
4 years, 10 months ago (2016-02-17 20:13:30 UTC) #36
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1677163003/120001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1677163003/120001
4 years, 10 months ago (2016-02-18 19:26:59 UTC) #38
commit-bot: I haz the power
Try jobs failed on following builders: win_chromium_x64_rel_ng on tryserver.chromium.win (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.win/builders/win_chromium_x64_rel_ng/builds/170200)
4 years, 10 months ago (2016-02-18 21:40:52 UTC) #40
erikchen
On 2016/02/18 21:40:52, commit-bot: I haz the power wrote: > Try jobs failed on following ...
4 years, 10 months ago (2016-02-18 22:16:31 UTC) #41
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1677163003/120001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1677163003/120001
4 years, 10 months ago (2016-02-19 01:45:27 UTC) #43
commit-bot: I haz the power
Committed patchset #7 (id:120001)
4 years, 10 months ago (2016-02-19 03:15:51 UTC) #45
commit-bot: I haz the power
Patchset 7 (id:??) landed as https://crrev.com/4b12c0a123b31adcccb095cb2a49ca7b59f9f1fb Cr-Commit-Position: refs/heads/master@{#376358}
4 years, 10 months ago (2016-02-19 03:17:25 UTC) #47
Nico
https://codereview.chromium.org/1677163003/diff/120001/base/memory/shared_memory_win_unittest.cc File base/memory/shared_memory_win_unittest.cc (right): https://codereview.chromium.org/1677163003/diff/120001/base/memory/shared_memory_win_unittest.cc#newcode50 base/memory/shared_memory_win_unittest.cc:50: TOKEN_MANDATORY_LABEL TIL = {0}; FAILED: ninja -t msvc -e ...
4 years, 10 months ago (2016-02-19 03:33:01 UTC) #49
brucedawson
4 years, 10 months ago (2016-02-20 00:49:52 UTC) #51
Message was sent while issue was closed.
https://codereview.chromium.org/1677163003/diff/120001/base/memory/shared_mem...
File base/memory/shared_memory_win_unittest.cc (right):

https://codereview.chromium.org/1677163003/diff/120001/base/memory/shared_mem...
base/memory/shared_memory_win_unittest.cc:87: uint32_t handle_as_int =
reinterpret_cast<uint32_t>(handle);
VC++ 2015 prefers double casts for the truncation-plus-type-change, best done
with base::win::HandleToUint32. CL to do this (crrev.com/1715983002) and avoid
the warning is about to be sent for review. This is just an FYI.

Powered by Google App Engine
This is Rietveld 408576698