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

Side by Side Diff: chrome/browser/nacl_host/nacl_process_host.cc

Issue 8585002: Give base::SharedMemory::CreateAnonymous an executable flag (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #include "build/build_config.h" 5 #include "build/build_config.h"
6 6
7 #include "chrome/browser/nacl_host/nacl_process_host.h" 7 #include "chrome/browser/nacl_host/nacl_process_host.h"
8 8
9 #if defined(OS_POSIX) 9 #if defined(OS_POSIX)
10 #include <fcntl.h> 10 #include <fcntl.h>
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 delete this; 497 delete this;
498 return; 498 return;
499 } 499 }
500 500
501 #if defined(OS_MACOSX) 501 #if defined(OS_MACOSX)
502 // For dynamic loading support, NaCl requires a file descriptor that 502 // For dynamic loading support, NaCl requires a file descriptor that
503 // was created in /tmp, since those created with shm_open() are not 503 // was created in /tmp, since those created with shm_open() are not
504 // mappable with PROT_EXEC. Rather than requiring an extra IPC 504 // mappable with PROT_EXEC. Rather than requiring an extra IPC
505 // round trip out of the sandbox, we create an FD here. 505 // round trip out of the sandbox, we create an FD here.
506 base::SharedMemory memory_buffer; 506 base::SharedMemory memory_buffer;
507 if (!memory_buffer.CreateAnonymous(/* size= */ 1)) { 507 if (!memory_buffer.CreateAnonymous(/* size= */ 1, true)) {
508 LOG(ERROR) << "Failed to allocate memory buffer"; 508 LOG(ERROR) << "Failed to allocate memory buffer";
509 delete this; 509 delete this;
510 return; 510 return;
511 } 511 }
512 nacl::FileDescriptor memory_fd; 512 nacl::FileDescriptor memory_fd;
513 memory_fd.fd = dup(memory_buffer.handle().fd); 513 memory_fd.fd = dup(memory_buffer.handle().fd);
514 if (memory_fd.fd < 0) { 514 if (memory_fd.fd < 0) {
515 LOG(ERROR) << "Failed to dup() a file descriptor"; 515 LOG(ERROR) << "Failed to dup() a file descriptor";
516 delete this; 516 delete this;
517 return; 517 return;
518 } 518 }
519 memory_fd.auto_close = true; 519 memory_fd.auto_close = true;
520 handles_for_sel_ldr.push_back(memory_fd); 520 handles_for_sel_ldr.push_back(memory_fd);
521 #endif 521 #endif
522 522
523 Send(new NaClProcessMsg_Start(handles_for_sel_ldr)); 523 Send(new NaClProcessMsg_Start(handles_for_sel_ldr));
524 internal_->sockets_for_sel_ldr.clear(); 524 internal_->sockets_for_sel_ldr.clear();
525 } 525 }
526 526
527 bool NaClProcessHost::OnMessageReceived(const IPC::Message& msg) { 527 bool NaClProcessHost::OnMessageReceived(const IPC::Message& msg) {
528 NOTREACHED() << "Invalid message with type = " << msg.type(); 528 NOTREACHED() << "Invalid message with type = " << msg.type();
529 return false; 529 return false;
530 } 530 }
531 531
532 bool NaClProcessHost::CanShutdown() { 532 bool NaClProcessHost::CanShutdown() {
533 return true; 533 return true;
534 } 534 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698