diff options
author | mcgrathr@chromium.org <mcgrathr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-06 18:07:05 +0000 |
---|---|---|
committer | mcgrathr@chromium.org <mcgrathr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-06 18:07:05 +0000 |
commit | 103dccfa2877fed72cdcd7daafba3c81a51ab923 (patch) | |
tree | d45afb9c2a47c9fe53c0e98dfd0f3d02f4dd173d /base/shared_memory_posix.cc | |
parent | a1cff7858ed955e9792955dce46277ba57b2cb81 (diff) | |
download | chromium_src-103dccfa2877fed72cdcd7daafba3c81a51ab923.zip chromium_src-103dccfa2877fed72cdcd7daafba3c81a51ab923.tar.gz chromium_src-103dccfa2877fed72cdcd7daafba3c81a51ab923.tar.bz2 |
Adaptively use temp dir instead of /dev/shm for executable shmem file on Linux
On some Linux systems, files from /dev/shm cannot have PROT_EXEC applied to
their mappings. This depends on picayune setup details that vary between
distributions and kernels and could vary between installations. So just
use an empirical test of whether it works or not, and fall back to using
generic temporary space instead of /dev/shm for the executable case if needed.
BUG= http://code.google.com/p/chromium/issues/detail?id=103377
TEST= SharedMemory.AnonymousExecutable with /dev/shm mounted noexec
R=mark@chromium.org
Review URL: http://codereview.chromium.org/8800025
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@113228 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/shared_memory_posix.cc')
-rw-r--r-- | base/shared_memory_posix.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/base/shared_memory_posix.cc b/base/shared_memory_posix.cc index 030061a0..a66c859 100644 --- a/base/shared_memory_posix.cc +++ b/base/shared_memory_posix.cc @@ -123,7 +123,7 @@ bool SharedMemory::Create(const SharedMemoryCreateOptions& options) { DCHECK(!options.open_existing); // Q: Why not use the shm_open() etc. APIs? // A: Because they're limited to 4mb on OS X. FFFFFFFUUUUUUUUUUU - fp = file_util::CreateAndOpenTemporaryShmemFile(&path); + fp = file_util::CreateAndOpenTemporaryShmemFile(&path, options.executable); // Deleting the file prevents anyone else from mapping it in // (making it private), and prevents the need for cleanup (once @@ -317,7 +317,7 @@ bool SharedMemory::FilePathForMemoryName(const std::string& mem_name, DCHECK_EQ(std::string::npos, mem_name.find('\0')); FilePath temp_dir; - if (!file_util::GetShmemTempDir(&temp_dir)) + if (!file_util::GetShmemTempDir(&temp_dir, false)) return false; #if !defined(OS_MACOSX) |