Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 // A mini-zygote specifically for Native Client. | 5 // A mini-zygote specifically for Native Client. |
| 6 | 6 |
| 7 #include "components/nacl/loader/nacl_helper_linux.h" | 7 #include "components/nacl/loader/nacl_helper_linux.h" |
| 8 | 8 |
| 9 #include <errno.h> | 9 #include <errno.h> |
| 10 #include <fcntl.h> | 10 #include <fcntl.h> |
| (...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 404 return prereserved_sandbox_size; | 404 return prereserved_sandbox_size; |
| 405 } | 405 } |
| 406 #endif | 406 #endif |
| 407 | 407 |
| 408 } // namespace | 408 } // namespace |
| 409 | 409 |
| 410 #if defined(ADDRESS_SANITIZER) | 410 #if defined(ADDRESS_SANITIZER) |
| 411 // Do not install the SIGSEGV handler in ASan. This should make the NaCl | 411 // Do not install the SIGSEGV handler in ASan. This should make the NaCl |
| 412 // platform qualification test pass. | 412 // platform qualification test pass. |
| 413 // detect_odr_violation=0: http://crbug.com/376306 | 413 // detect_odr_violation=0: http://crbug.com/376306 |
| 414 static const char kAsanDefaultOptionsNaCl[] = | 414 extern const char* kAsanDefaultOptionsNaCl; |
| 415 "handle_segv=0:detect_odr_violation=0"; | 415 const char* kAsanDefaultOptionsNaCl = "handle_segv=0:detect_odr_violation=0"; |
| 416 | |
| 417 // Override the default ASan options for the NaCl helper. | |
| 418 // __asan_default_options should not be instrumented, because it is called | |
| 419 // before ASan is initialized. | |
| 420 extern "C" | |
| 421 __attribute__((no_sanitize_address)) | |
|
bradnelson
2017/05/26 17:52:43
Why isn't this needed anymore?
(This executable ge
| |
| 422 // The function isn't referenced from the executable itself. Make sure it isn't | |
| 423 // stripped by the linker. | |
| 424 __attribute__((used)) | |
| 425 __attribute__((visibility("default"))) | |
| 426 const char* __asan_default_options() { | |
| 427 return kAsanDefaultOptionsNaCl; | |
| 428 } | |
| 429 #endif | 416 #endif |
| 430 | 417 |
| 431 int main(int argc, char* argv[]) { | 418 int main(int argc, char* argv[]) { |
| 432 base::CommandLine::Init(argc, argv); | 419 base::CommandLine::Init(argc, argv); |
| 433 base::AtExitManager exit_manager; | 420 base::AtExitManager exit_manager; |
| 434 base::RandUint64(); // acquire /dev/urandom fd before sandbox is raised | 421 base::RandUint64(); // acquire /dev/urandom fd before sandbox is raised |
| 435 | 422 |
| 436 const NaClLoaderSystemInfo system_info = { | 423 const NaClLoaderSystemInfo system_info = { |
| 437 #if !defined(OS_NACL_NONSFI) | 424 #if !defined(OS_NACL_NONSFI) |
| 438 // These are not used by nacl_helper_nonsfi. | 425 // These are not used by nacl_helper_nonsfi. |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 467 // Now handle requests from the Zygote. | 454 // Now handle requests from the Zygote. |
| 468 while (true) { | 455 while (true) { |
| 469 bool request_handled = HandleZygoteRequest( | 456 bool request_handled = HandleZygoteRequest( |
| 470 kNaClZygoteDescriptor, system_info, nacl_sandbox.get()); | 457 kNaClZygoteDescriptor, system_info, nacl_sandbox.get()); |
| 471 // Do not turn this into a CHECK() without thinking about robustness | 458 // Do not turn this into a CHECK() without thinking about robustness |
| 472 // against malicious IPC requests. | 459 // against malicious IPC requests. |
| 473 DCHECK(request_handled); | 460 DCHECK(request_handled); |
| 474 } | 461 } |
| 475 NOTREACHED(); | 462 NOTREACHED(); |
| 476 } | 463 } |
| OLD | NEW |