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

Issue 8585002: Give base::SharedMemory::CreateAnonymous an executable flag (Closed)

Created:
9 years, 1 month ago by Roland McGrath
Modified:
9 years ago
Reviewers:
Mark Mentovai, amit, jam
CC:
chromium-reviews, hclam+watch_chromium.org, scherkus (not reviewing), ddorwin+watch_chromium.org, fischman+watch_chromium.org, acolwell+watch_chromium.org, amit, brettw-cc_chromium.org, jam, annacc+watch_chromium.org, apatrick_chromium, dpranke-watch+content_chromium.org, joi+watch-content_chromium.org, robertshield, vrk (LEFT CHROMIUM), Paweł Hajdan Jr., ajwong+watch_chromium.org, darin-cc_chromium.org, native-client-reviews_googlegroups.com, ihf+watch_chromium.org
Visibility:
Public.

Description

Give base::SharedMemory::CreateAnonymous an executable flag NaCl on Mac and Linux needs to create a shared memory object that it can later make executable with mprotect. Express this need in the interface it uses. Add a test that pages mapped from such an object can later be passed to mprotect with PROT_EXEC. This lays the groundwork for a later change that will sometimes use a different method to allocate an object on Linux when it needs to be executable. On some Linux distributions, shm_open yields objects whose mappings cannot be made executable. BUG= http://code.google.com/p/chromium/issues/detail?id=103377 TEST= SharedMemory.AnonymousExecutable R=mark@chromium.org,jam@chromium.org,amit@chromium.org,ben@chromium.org Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=112570

Patch Set 1 #

Total comments: 1

Patch Set 2 : new interface, misc call sites unchanged #

Total comments: 5

Patch Set 3 : review changes #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+87 lines, -33 lines) Patch
M base/shared_memory.h View 1 2 3 chunks +39 lines, -2 lines 1 comment Download
M base/shared_memory_android.cc View 1 2 1 chunk +4 lines, -3 lines 0 comments Download
M base/shared_memory_posix.cc View 1 5 chunks +10 lines, -15 lines 0 comments Download
M base/shared_memory_unittest.cc View 1 2 2 chunks +22 lines, -0 lines 0 comments Download
M base/shared_memory_win.cc View 1 2 3 chunks +8 lines, -12 lines 0 comments Download
M chrome/browser/nacl_host/nacl_process_host.cc View 1 2 1 chunk +4 lines, -1 line 0 comments Download

Messages

Total messages: 15 (0 generated)
Roland McGrath
I listed so many reviewers just trying to cover all the OWNERS I found: base: ...
9 years, 1 month ago (2011-11-16 21:40:46 UTC) #1
Mark Seaborn
I discussed this with Roland. I think we want to put the logic into NaCl's ...
9 years, 1 month ago (2011-11-16 22:34:01 UTC) #2
jam
content lgtm
9 years, 1 month ago (2011-11-17 01:22:07 UTC) #3
Roland McGrath
It is looking like AppArmor may preclude the alternate tack we were considering. It's not ...
9 years, 1 month ago (2011-11-18 23:19:13 UTC) #4
Roland McGrath
Ping OWNERS...mark, amit, ben
9 years ago (2011-11-29 19:44:27 UTC) #5
Mark Mentovai
You asked us to look “in case we really do need this in.” I can ...
9 years ago (2011-11-29 19:46:50 UTC) #6
Roland McGrath
On 2011/11/29 19:46:50, Mark Mentovai wrote: > You asked us to look “in case we ...
9 years ago (2011-11-29 20:05:23 UTC) #7
Mark Mentovai
OK. Then I have one high-level comment. As you extend functions like this, it becomes ...
9 years ago (2011-11-29 20:08:28 UTC) #8
Mark Mentovai
http://codereview.chromium.org/8585002/diff/1/base/metrics/stats_table.cc File base/metrics/stats_table.cc (right): http://codereview.chromium.org/8585002/diff/1/base/metrics/stats_table.cc#newcode171 base/metrics/stats_table.cc:171: if (!priv->shared_memory_.CreateNamed(name, true, size, false)) I’m looking at uses ...
9 years ago (2011-11-29 20:10:43 UTC) #9
Roland McGrath
On 2011/11/29 20:08:28, Mark Mentovai wrote: > OK. Then I have one high-level comment. As ...
9 years ago (2011-11-29 21:03:16 UTC) #10
Mark Mentovai
I think having two bools is bad interface design. My preference would be to put ...
9 years ago (2011-11-29 21:09:13 UTC) #11
Roland McGrath
I made a struct for all the creation parameters and a generic Create() method taking ...
9 years ago (2011-11-29 23:55:23 UTC) #12
Mark Mentovai
I think this is workable as an interface now. http://codereview.chromium.org/8585002/diff/9002/base/shared_memory.h File base/shared_memory.h (right): http://codereview.chromium.org/8585002/diff/9002/base/shared_memory.h#newcode45 base/shared_memory.h:45: ...
9 years ago (2011-12-01 19:31:16 UTC) #13
Roland McGrath
I think I've addressed all your comments. PTAL Thanks, Roland
9 years ago (2011-12-01 21:17:29 UTC) #14
Mark Mentovai
9 years ago (2011-12-01 21:26:01 UTC) #15
LGTM

http://codereview.chromium.org/8585002/diff/17001/base/shared_memory.h
File base/shared_memory.h (right):

http://codereview.chromium.org/8585002/diff/17001/base/shared_memory.h#newcode42
base/shared_memory.h:42: struct SharedMemoryCreateOptions {
To promote more efficient memory use, please order the members in this struct
more appropriately:

pointer, uint32, bool, bool

Powered by Google App Engine
This is Rietveld 408576698