OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // Fake Address Sanitizer run-time support. | 5 // Fake Address Sanitizer run-time support. |
6 // Enough for programs to link and run, but will not find any errors. | 6 // Enough for programs to link and run, but will not find any errors. |
7 // Also, linking this to shared libraries voids the warranty. | 7 // Also, linking this to shared libraries voids the warranty. |
8 // | 8 // |
9 // We need this fake thunks if we build Chrome with ASAN support because | 9 // We need this fake thunks if we build Chrome with ASAN support because |
10 // pyautolib DSO is instrumented with ASAN and is loaded to regular python | 10 // pyautolib DSO is instrumented with ASAN and is loaded to regular python |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 "You have been warned. Aborting."); | 58 "You have been warned. Aborting."); |
59 abort(); | 59 abort(); |
60 } | 60 } |
61 } | 61 } |
62 | 62 |
63 // Update the name when asan api updates. | 63 // Update the name when asan api updates. |
64 void __asan_init_v1() { | 64 void __asan_init_v1() { |
65 __asan_init(); | 65 __asan_init(); |
66 } | 66 } |
67 | 67 |
| 68 void __asan_init_v3() { |
| 69 static int inited = 0; |
| 70 if (inited) return; |
| 71 inited = 1; |
| 72 #if __WORDSIZE == 64 |
| 73 unsigned long start = 0x00007fff8000; |
| 74 unsigned long size = 0x100000000000; |
| 75 #else |
| 76 unsigned long start = 0x20000000; |
| 77 unsigned long size = 0x20000000; |
| 78 #endif |
| 79 void *res = mmap((void*)start, size, |
| 80 PROT_READ | PROT_WRITE, |
| 81 MAP_PRIVATE | MAP_ANON | MAP_FIXED | MAP_NORESERVE, |
| 82 0, 0); |
| 83 if (res == (void*)start) { |
| 84 fprintf(stderr, "Fake AddressSanitizer run-time initialized ok at %p\n", |
| 85 res); |
| 86 } else { |
| 87 fprintf(stderr, "Fake AddressSanitizer run-time failed to initialize.\n" |
| 88 "You have been warned. Aborting."); |
| 89 abort(); |
| 90 } |
| 91 } |
| 92 |
68 void __asan_handle_no_return() { } | 93 void __asan_handle_no_return() { } |
69 void __asan_register_globals() { } | 94 void __asan_register_globals() { } |
70 void __asan_report_load1() { } | 95 void __asan_report_load1() { } |
71 void __asan_report_load16() { } | 96 void __asan_report_load16() { } |
72 void __asan_report_load2() { } | 97 void __asan_report_load2() { } |
73 void __asan_report_load4() { } | 98 void __asan_report_load4() { } |
74 void __asan_report_load8() { } | 99 void __asan_report_load8() { } |
75 void __asan_report_load_n() { } | 100 void __asan_report_load_n() { } |
76 void __asan_report_store1() { } | 101 void __asan_report_store1() { } |
77 void __asan_report_store16() { } | 102 void __asan_report_store16() { } |
78 void __asan_report_store2() { } | 103 void __asan_report_store2() { } |
79 void __asan_report_store4() { } | 104 void __asan_report_store4() { } |
80 void __asan_report_store8() { } | 105 void __asan_report_store8() { } |
81 void __asan_report_store_n() { } | 106 void __asan_report_store_n() { } |
82 void __asan_set_error_report_callback() { } | 107 void __asan_set_error_report_callback() { } |
83 void __asan_unregister_globals() { } | 108 void __asan_unregister_globals() { } |
84 void __sanitizer_sandbox_on_notify() { } | 109 void __sanitizer_sandbox_on_notify() { } |
| 110 void __asan_before_dynamic_init(const char *module_name) { } |
| 111 void __asan_after_dynamic_init() { } |
| 112 |
OLD | NEW |