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 #include "components/nacl/loader/nacl_listener.h" | 5 #include "components/nacl/loader/nacl_listener.h" |
6 | 6 |
7 #include <errno.h> | 7 #include <errno.h> |
8 #include <stdlib.h> | 8 #include <stdlib.h> |
9 | 9 |
10 #if defined(OS_POSIX) | 10 #if defined(OS_POSIX) |
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 args->enable_dyncode_syscalls = params.enable_dyncode_syscalls; | 395 args->enable_dyncode_syscalls = params.enable_dyncode_syscalls; |
396 if (!params.enable_dyncode_syscalls) { | 396 if (!params.enable_dyncode_syscalls) { |
397 // Bound the initial nexe's code segment size under PNaCl to | 397 // Bound the initial nexe's code segment size under PNaCl to |
398 // reduce the chance of a code spraying attack succeeding (see | 398 // reduce the chance of a code spraying attack succeeding (see |
399 // https://code.google.com/p/nativeclient/issues/detail?id=3572). | 399 // https://code.google.com/p/nativeclient/issues/detail?id=3572). |
400 // We assume that !params.enable_dyncode_syscalls is synonymous | 400 // We assume that !params.enable_dyncode_syscalls is synonymous |
401 // with PNaCl. We can't apply this arbitrary limit outside of | 401 // with PNaCl. We can't apply this arbitrary limit outside of |
402 // PNaCl because it might break existing NaCl apps, and this limit | 402 // PNaCl because it might break existing NaCl apps, and this limit |
403 // is only useful if the dyncode syscalls are disabled. | 403 // is only useful if the dyncode syscalls are disabled. |
404 args->initial_nexe_max_code_bytes = 32 << 20; // 32 MB | 404 args->initial_nexe_max_code_bytes = 32 << 20; // 32 MB |
| 405 |
| 406 // Indicate that this is a PNaCl module. |
| 407 // TODO(jvoung): Plumb through something indicating that this is PNaCl |
| 408 // instead of relying on enable_dyncode_syscalls. |
| 409 args->pnacl_mode = 1; |
405 } | 410 } |
406 #if defined(OS_LINUX) || defined(OS_MACOSX) | 411 #if defined(OS_LINUX) || defined(OS_MACOSX) |
407 args->debug_stub_server_bound_socket_fd = nacl::ToNativeHandle( | 412 args->debug_stub_server_bound_socket_fd = nacl::ToNativeHandle( |
408 params.debug_stub_server_bound_socket); | 413 params.debug_stub_server_bound_socket); |
409 #endif | 414 #endif |
410 #if defined(OS_WIN) | 415 #if defined(OS_WIN) |
411 args->broker_duplicate_handle_func = BrokerDuplicateHandle; | 416 args->broker_duplicate_handle_func = BrokerDuplicateHandle; |
412 args->attach_debug_exception_handler_func = AttachDebugExceptionHandler; | 417 args->attach_debug_exception_handler_func = AttachDebugExceptionHandler; |
413 #endif | 418 #endif |
414 #if defined(OS_LINUX) | 419 #if defined(OS_LINUX) |
415 args->prereserved_sandbox_size = prereserved_sandbox_size_; | 420 args->prereserved_sandbox_size = prereserved_sandbox_size_; |
416 #endif | 421 #endif |
417 | 422 |
418 #if defined(OS_LINUX) | 423 #if defined(OS_LINUX) |
419 if (params.enable_nonsfi_mode) { | 424 if (params.enable_nonsfi_mode) { |
420 nacl::nonsfi::MainStart(args->imc_bootstrap_handle); | 425 nacl::nonsfi::MainStart(args->imc_bootstrap_handle); |
421 NOTREACHED(); | 426 NOTREACHED(); |
422 return; | 427 return; |
423 } | 428 } |
424 #endif | 429 #endif |
425 NaClChromeMainStartApp(nap, args); | 430 NaClChromeMainStartApp(nap, args); |
426 NOTREACHED(); | 431 NOTREACHED(); |
427 } | 432 } |
OLD | NEW |