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 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
381 args->enable_dyncode_syscalls = params.enable_dyncode_syscalls; | 381 args->enable_dyncode_syscalls = params.enable_dyncode_syscalls; |
382 if (!params.enable_dyncode_syscalls) { | 382 if (!params.enable_dyncode_syscalls) { |
383 // Bound the initial nexe's code segment size under PNaCl to | 383 // Bound the initial nexe's code segment size under PNaCl to |
384 // reduce the chance of a code spraying attack succeeding (see | 384 // reduce the chance of a code spraying attack succeeding (see |
385 // https://code.google.com/p/nativeclient/issues/detail?id=3572). | 385 // https://code.google.com/p/nativeclient/issues/detail?id=3572). |
386 // We assume that !params.enable_dyncode_syscalls is synonymous | 386 // We assume that !params.enable_dyncode_syscalls is synonymous |
387 // with PNaCl. We can't apply this arbitrary limit outside of | 387 // with PNaCl. We can't apply this arbitrary limit outside of |
388 // PNaCl because it might break existing NaCl apps, and this limit | 388 // PNaCl because it might break existing NaCl apps, and this limit |
389 // is only useful if the dyncode syscalls are disabled. | 389 // is only useful if the dyncode syscalls are disabled. |
390 args->initial_nexe_max_code_bytes = 32 << 20; // 32 MB | 390 args->initial_nexe_max_code_bytes = 32 << 20; // 32 MB |
| 391 |
| 392 // Indicate that this is a PNaCl module. |
| 393 // TODO(jvoung): Plumb through something indicating that this is PNaCl |
| 394 // instead of relying on enable_dyncode_syscalls. |
| 395 args->pnacl_mode = 1; |
391 } | 396 } |
392 #if defined(OS_LINUX) || defined(OS_MACOSX) | 397 #if defined(OS_LINUX) || defined(OS_MACOSX) |
393 args->debug_stub_server_bound_socket_fd = nacl::ToNativeHandle( | 398 args->debug_stub_server_bound_socket_fd = nacl::ToNativeHandle( |
394 params.debug_stub_server_bound_socket); | 399 params.debug_stub_server_bound_socket); |
395 #endif | 400 #endif |
396 #if defined(OS_WIN) | 401 #if defined(OS_WIN) |
397 args->broker_duplicate_handle_func = BrokerDuplicateHandle; | 402 args->broker_duplicate_handle_func = BrokerDuplicateHandle; |
398 args->attach_debug_exception_handler_func = AttachDebugExceptionHandler; | 403 args->attach_debug_exception_handler_func = AttachDebugExceptionHandler; |
399 #endif | 404 #endif |
400 #if defined(OS_LINUX) | 405 #if defined(OS_LINUX) |
401 args->prereserved_sandbox_size = prereserved_sandbox_size_; | 406 args->prereserved_sandbox_size = prereserved_sandbox_size_; |
402 #endif | 407 #endif |
403 | 408 |
404 #if defined(OS_LINUX) | 409 #if defined(OS_LINUX) |
405 if (params.enable_nonsfi_mode) { | 410 if (params.enable_nonsfi_mode) { |
406 nacl::nonsfi::MainStart(args->imc_bootstrap_handle); | 411 nacl::nonsfi::MainStart(args->imc_bootstrap_handle); |
407 NOTREACHED(); | 412 NOTREACHED(); |
408 return; | 413 return; |
409 } | 414 } |
410 #endif | 415 #endif |
411 NaClChromeMainStartApp(nap, args); | 416 NaClChromeMainStartApp(nap, args); |
412 NOTREACHED(); | 417 NOTREACHED(); |
413 } | 418 } |
OLD | NEW |