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

Side by Side Diff: base/memory/shared_memory.h

Issue 1501003002: Added protection against mapping image sections between processes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixes from review Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | base/memory/shared_memory_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef BASE_MEMORY_SHARED_MEMORY_H_ 5 #ifndef BASE_MEMORY_SHARED_MEMORY_H_
6 #define BASE_MEMORY_SHARED_MEMORY_H_ 6 #define BASE_MEMORY_SHARED_MEMORY_H_
7 7
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 9
10 #include <string> 10 #include <string>
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 enum ShareMode { 275 enum ShareMode {
276 SHARE_READONLY, 276 SHARE_READONLY,
277 SHARE_CURRENT_MODE, 277 SHARE_CURRENT_MODE,
278 }; 278 };
279 bool ShareToProcessCommon(ProcessHandle process, 279 bool ShareToProcessCommon(ProcessHandle process,
280 SharedMemoryHandle* new_handle, 280 SharedMemoryHandle* new_handle,
281 bool close_self, 281 bool close_self,
282 ShareMode); 282 ShareMode);
283 283
284 #if defined(OS_WIN) 284 #if defined(OS_WIN)
285 // If true indicates this came from an external source so needs extra checks
286 // before being mapped.
287 bool external_section_;
285 std::wstring name_; 288 std::wstring name_;
286 HANDLE mapped_file_; 289 HANDLE mapped_file_;
287 #elif defined(OS_MACOSX) && !defined(OS_IOS) 290 #elif defined(OS_MACOSX) && !defined(OS_IOS)
288 // The OS primitive that backs the shared memory region. 291 // The OS primitive that backs the shared memory region.
289 SharedMemoryHandle shm_; 292 SharedMemoryHandle shm_;
290 293
291 // The mechanism by which the memory is mapped. Only valid if |memory_| is not 294 // The mechanism by which the memory is mapped. Only valid if |memory_| is not
292 // |nullptr|. 295 // |nullptr|.
293 SharedMemoryHandle::Type mapped_memory_mechanism_; 296 SharedMemoryHandle::Type mapped_memory_mechanism_;
294 297
295 int readonly_mapped_file_; 298 int readonly_mapped_file_;
296 #elif defined(OS_POSIX) 299 #elif defined(OS_POSIX)
297 int mapped_file_; 300 int mapped_file_;
298 int readonly_mapped_file_; 301 int readonly_mapped_file_;
299 #endif 302 #endif
300 size_t mapped_size_; 303 size_t mapped_size_;
301 void* memory_; 304 void* memory_;
302 bool read_only_; 305 bool read_only_;
303 size_t requested_size_; 306 size_t requested_size_;
304 307
305 DISALLOW_COPY_AND_ASSIGN(SharedMemory); 308 DISALLOW_COPY_AND_ASSIGN(SharedMemory);
306 }; 309 };
307 } // namespace base 310 } // namespace base
308 311
309 #endif // BASE_MEMORY_SHARED_MEMORY_H_ 312 #endif // BASE_MEMORY_SHARED_MEMORY_H_
OLDNEW
« no previous file with comments | « no previous file | base/memory/shared_memory_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698