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 |
11 // process that has no ASAN runtime. | 11 // process that has no ASAN runtime. |
12 // | 12 // |
13 // We have three options here: | 13 // We have three options here: |
14 // 1) use our custom build of Python that have ASAN runtime linked in, | 14 // 1) use our custom build of Python that have ASAN runtime linked in, |
15 // 2) do not instrument pyautolib with ASAN support, | 15 // 2) do not instrument pyautolib with ASAN support, |
16 // 3) use this fake asan thunks linked to pyautolib so that instrumented code | 16 // 3) use this fake asan thunks linked to pyautolib so that instrumented code |
17 // does not complain. | 17 // does not complain. |
18 // | 18 // |
19 // Note that we should not use real ASAN runtime linked with DSO because it will | 19 // Note that we should not use real ASAN runtime linked with DSO because it will |
20 // not have information about memory allocations made prior to DSO load. | 20 // not have information about memory allocations made prior to DSO load. |
21 // | 21 // |
22 // Option (2) is not easy because pyautolib uses code from Chrome | 22 // Option (2) is not easy because pyautolib uses code from Chrome |
23 // (see chrome_tests.gypi, dependencies for target_name: pyautolib) that | 23 // (see chrome_tests.gypi, dependencies for target_name: pyautolib) that |
24 // has been instrumented with ASAN. So even if we disable -faddress-sanitizer | 24 // has been instrumented with ASAN. So even if we disable -sanitize=address |
25 // for pyautolib own sources, ASAN instrumentation will creep in from there. | 25 // for pyautolib own sources, ASAN instrumentation will creep in from there. |
26 // To avoid ASAN instrumentation, we might force Chrome build to compile all our | 26 // To avoid ASAN instrumentation, we might force Chrome build to compile all our |
27 // dependencies one more time without -faddress-sanitizer. | 27 // dependencies one more time without -fsanitize=address. |
28 // | 28 // |
29 // Note also that using these empty stubs prevents ASAN from catching bugs in | 29 // Note also that using these empty stubs prevents ASAN from catching bugs in |
30 // Python-pyautolib process. But we do not need it, we are interested in Chrome | 30 // Python-pyautolib process. But we do not need it, we are interested in Chrome |
31 // bugs. | 31 // bugs. |
32 | 32 |
33 | 33 |
34 #include <stdio.h> | 34 #include <stdio.h> |
35 #include <stdlib.h> | 35 #include <stdlib.h> |
36 #include <sys/mman.h> | 36 #include <sys/mman.h> |
37 | 37 |
(...skipping 29 matching lines...) Expand all Loading... |
67 void __asan_report_load2() { } | 67 void __asan_report_load2() { } |
68 void __asan_report_load4() { } | 68 void __asan_report_load4() { } |
69 void __asan_report_load8() { } | 69 void __asan_report_load8() { } |
70 void __asan_report_load16() { } | 70 void __asan_report_load16() { } |
71 void __asan_report_store1() { } | 71 void __asan_report_store1() { } |
72 void __asan_report_store2() { } | 72 void __asan_report_store2() { } |
73 void __asan_report_store4() { } | 73 void __asan_report_store4() { } |
74 void __asan_report_store8() { } | 74 void __asan_report_store8() { } |
75 void __asan_report_store16() { } | 75 void __asan_report_store16() { } |
76 void __asan_set_error_report_callback() { } | 76 void __asan_set_error_report_callback() { } |
OLD | NEW |