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 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 #if defined(ADDRESS_SANITIZER) | 406 #if defined(ADDRESS_SANITIZER) |
407 // Do not install the SIGSEGV handler in ASan. This should make the NaCl | 407 // Do not install the SIGSEGV handler in ASan. This should make the NaCl |
408 // platform qualification test pass. | 408 // platform qualification test pass. |
409 // detect_odr_violation=0: http://crbug.com/376306 | 409 // detect_odr_violation=0: http://crbug.com/376306 |
410 static const char kAsanDefaultOptionsNaCl[] = | 410 static const char kAsanDefaultOptionsNaCl[] = |
411 "handle_segv=0:detect_odr_violation=0"; | 411 "handle_segv=0:detect_odr_violation=0"; |
412 | 412 |
413 // Override the default ASan options for the NaCl helper. | 413 // Override the default ASan options for the NaCl helper. |
414 // __asan_default_options should not be instrumented, because it is called | 414 // __asan_default_options should not be instrumented, because it is called |
415 // before ASan is initialized. | 415 // before ASan is initialized. |
416 extern "C" | 416 extern "C" __attribute__((no_sanitize_address)) |
417 __attribute__((no_sanitize_address)) | |
418 // The function isn't referenced from the executable itself. Make sure it isn't | 417 // The function isn't referenced from the executable itself. Make sure it isn't |
419 // stripped by the linker. | 418 // stripped by the linker. |
420 __attribute__((used)) | 419 __attribute__((used)) __attribute__((visibility("default"))) const char* |
421 __attribute__((visibility("default"))) | 420 __asan_default_optionsx() { |
422 const char* __asan_default_options() { | |
423 return kAsanDefaultOptionsNaCl; | 421 return kAsanDefaultOptionsNaCl; |
424 } | 422 } |
425 #endif | 423 #endif |
426 | 424 |
427 int main(int argc, char* argv[]) { | 425 int main(int argc, char* argv[]) { |
428 base::CommandLine::Init(argc, argv); | 426 base::CommandLine::Init(argc, argv); |
429 base::AtExitManager exit_manager; | 427 base::AtExitManager exit_manager; |
430 base::RandUint64(); // acquire /dev/urandom fd before sandbox is raised | 428 base::RandUint64(); // acquire /dev/urandom fd before sandbox is raised |
431 | 429 |
432 const NaClLoaderSystemInfo system_info = { | 430 const NaClLoaderSystemInfo system_info = { |
(...skipping 30 matching lines...) Expand all Loading... |
463 // Now handle requests from the Zygote. | 461 // Now handle requests from the Zygote. |
464 while (true) { | 462 while (true) { |
465 bool request_handled = HandleZygoteRequest( | 463 bool request_handled = HandleZygoteRequest( |
466 kNaClZygoteDescriptor, system_info, nacl_sandbox.get()); | 464 kNaClZygoteDescriptor, system_info, nacl_sandbox.get()); |
467 // Do not turn this into a CHECK() without thinking about robustness | 465 // Do not turn this into a CHECK() without thinking about robustness |
468 // against malicious IPC requests. | 466 // against malicious IPC requests. |
469 DCHECK(request_handled); | 467 DCHECK(request_handled); |
470 } | 468 } |
471 NOTREACHED(); | 469 NOTREACHED(); |
472 } | 470 } |
OLD | NEW |