OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The Native Client Authors. All rights reserved. | 2 * Copyright (c) 2012 The Native Client Authors. All rights reserved. |
3 * Use of this source code is governed by a BSD-style license that can be | 3 * Use of this source code is governed by a BSD-style license that can be |
4 * found in the LICENSE file. | 4 * found in the LICENSE file. |
5 */ | 5 */ |
6 | 6 |
7 /* | 7 /* |
8 * POSIX-specific routines for verifying that Data Execution Prevention is | 8 * POSIX-specific routines for verifying that Data Execution Prevention is |
9 * functional. | 9 * functional. |
10 */ | 10 */ |
11 | 11 |
12 #include <setjmp.h> | 12 #include <setjmp.h> |
13 #include <stdlib.h> | 13 #include <stdlib.h> |
14 #include <signal.h> | 14 #include <signal.h> |
15 | 15 |
16 #include "native_client/src/include/nacl_compiler_annotations.h" | 16 #include "native_client/src/include/nacl_compiler_annotations.h" |
17 #include "native_client/src/shared/platform/nacl_check.h" | 17 #include "native_client/src/shared/platform/nacl_check.h" |
18 #include "native_client/src/trusted/platform_qualify/nacl_dep_qualify.h" | 18 #include "native_client/src/trusted/platform_qualify/nacl_dep_qualify.h" |
19 #include "native_client/src/trusted/platform_qualify/linux/sysv_shm_and_mmap.h" | |
20 | 19 |
21 #if NACL_OSX | 20 #if NACL_OSX |
22 #include <mach/mach.h> | 21 #include <mach/mach.h> |
23 #endif | 22 #endif |
24 | 23 |
25 #if (NACL_OSX && NACL_ARCH(NACL_BUILD_ARCH) == NACL_x86 && \ | 24 #if (NACL_OSX && NACL_ARCH(NACL_BUILD_ARCH) == NACL_x86 && \ |
26 NACL_BUILD_SUBARCH == 64) | 25 NACL_BUILD_SUBARCH == 64) |
27 # define EXPECTED_SIGNAL SIGBUS | 26 # define EXPECTED_SIGNAL SIGBUS |
28 #else | 27 #else |
29 # define EXPECTED_SIGNAL SIGSEGV | 28 # define EXPECTED_SIGNAL SIGSEGV |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 int NaClAttemptToExecuteData(void) { | 146 int NaClAttemptToExecuteData(void) { |
148 int result; | 147 int result; |
149 char *thunk_buffer = malloc(64); | 148 char *thunk_buffer = malloc(64); |
150 if (NULL == thunk_buffer) { | 149 if (NULL == thunk_buffer) { |
151 return 0; | 150 return 0; |
152 } | 151 } |
153 result = NaClAttemptToExecuteDataAtAddr(thunk_buffer, 64); | 152 result = NaClAttemptToExecuteDataAtAddr(thunk_buffer, 64); |
154 free(thunk_buffer); | 153 free(thunk_buffer); |
155 return result; | 154 return result; |
156 } | 155 } |
OLD | NEW |