Commit 0427c17d authored by mcgrathr@chromium.org's avatar mcgrathr@chromium.org

Plumb executable flag through proxy to base::SharedMemory::Create.

base::SharedMemory now takes a flag for whether executability is required.
Plumb that through the Linux-only proxy for this interface.

BUG= http://code.google.com/p/chromium/issues/detail?id=103377
TEST= nacl still works

R=mseaborn@chromium.org,jam@chromium.org

Review URL: http://codereview.chromium.org/8776053

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@112818 0039d316-1c4b-4281-b951-d872f2087c98
parent 49dc8639
...@@ -373,12 +373,14 @@ class SandboxIPCProcess { ...@@ -373,12 +373,14 @@ class SandboxIPCProcess {
void HandleMakeSharedMemorySegment(int fd, const Pickle& pickle, void* iter, void HandleMakeSharedMemorySegment(int fd, const Pickle& pickle, void* iter,
std::vector<int>& fds) { std::vector<int>& fds) {
uint32_t shm_size; base::SharedMemoryCreateOptions options;
if (!pickle.ReadUInt32(&iter, &shm_size)) if (!pickle.ReadUInt32(&iter, &options.size))
return;
if (!pickle.ReadBool(&iter, &options.executable))
return; return;
int shm_fd = -1; int shm_fd = -1;
base::SharedMemory shm; base::SharedMemory shm;
if (shm.CreateAnonymous(shm_size)) if (shm.Create(options))
shm_fd = shm.handle().fd; shm_fd = shm.handle().fd;
Pickle reply; Pickle reply;
SendRendererReply(fds, reply, shm_fd); SendRendererReply(fds, reply, shm_fd);
......
...@@ -91,6 +91,7 @@ int MakeSharedMemorySegmentViaIPC(size_t length, bool executable) { ...@@ -91,6 +91,7 @@ int MakeSharedMemorySegmentViaIPC(size_t length, bool executable) {
Pickle request; Pickle request;
request.WriteInt(LinuxSandbox::METHOD_MAKE_SHARED_MEMORY_SEGMENT); request.WriteInt(LinuxSandbox::METHOD_MAKE_SHARED_MEMORY_SEGMENT);
request.WriteUInt32(length); request.WriteUInt32(length);
request.WriteBool(executable);
uint8_t reply_buf[10]; uint8_t reply_buf[10];
int result_fd; int result_fd;
ssize_t result = UnixDomainSocket::SendRecvMsg(GetSandboxFD(), ssize_t result = UnixDomainSocket::SendRecvMsg(GetSandboxFD(),
......
...@@ -13,9 +13,13 @@ ...@@ -13,9 +13,13 @@
namespace content { namespace content {
// Returns a file descriptor for a shared memory segment. // Returns a file descriptor for a shared memory segment. The
// The second argument is ignored because SHM segments are always // executable flag indicates that the caller intends to use mprotect
// mappable with PROT_EXEC on Linux. // with PROT_EXEC after making a mapping, but not that it intends to
// mmap with PROT_EXEC in the first place. (Some systems, such as
// ChromeOS, disallow PROT_EXEC in mmap on /dev/shm files but do allow
// PROT_EXEC in mprotect on mappings from such files. This function
// can yield an object that has that constraint.)
CONTENT_EXPORT int MakeSharedMemorySegmentViaIPC(size_t length, CONTENT_EXPORT int MakeSharedMemorySegmentViaIPC(size_t length,
bool executable); bool executable);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment