comparison clang/docs/SanitizerSpecialCaseList.rst @ 221:79ff65ed7e25

LLVM12 Original
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Tue, 15 Jun 2021 19:15:29 +0900
parents 1d019706d866
children c4bab56944e8
comparison
equal deleted inserted replaced
220:42394fc6a535 221:79ff65ed7e25
24 thread stack, bypassing the frame boundaries); 24 thread stack, bypassing the frame boundaries);
25 * ignore a known problem. 25 * ignore a known problem.
26 26
27 To achieve this, user may create a file listing the entities they want to 27 To achieve this, user may create a file listing the entities they want to
28 ignore, and pass it to clang at compile-time using 28 ignore, and pass it to clang at compile-time using
29 ``-fsanitize-blacklist`` flag. See :doc:`UsersManual` for details. 29 ``-fsanitize-ignorelist`` flag. See :doc:`UsersManual` for details.
30 30
31 Example 31 Example
32 ======= 32 =======
33 33
34 .. code-block:: bash 34 .. code-block:: bash
38 void bad_foo() { 38 void bad_foo() {
39 int *a = (int*)malloc(40); 39 int *a = (int*)malloc(40);
40 a[10] = 1; 40 a[10] = 1;
41 } 41 }
42 int main() { bad_foo(); } 42 int main() { bad_foo(); }
43 $ cat blacklist.txt 43 $ cat ignorelist.txt
44 # Ignore reports from bad_foo function. 44 # Ignore reports from bad_foo function.
45 fun:bad_foo 45 fun:bad_foo
46 $ clang -fsanitize=address foo.c ; ./a.out 46 $ clang -fsanitize=address foo.c ; ./a.out
47 # AddressSanitizer prints an error report. 47 # AddressSanitizer prints an error report.
48 $ clang -fsanitize=address -fsanitize-blacklist=blacklist.txt foo.c ; ./a.out 48 $ clang -fsanitize=address -fsanitize-ignorelist=ignorelist.txt foo.c ; ./a.out
49 # No error report here. 49 # No error report here.
50 50
51 Format 51 Format
52 ====== 52 ======
53 53
54 Blacklists consist of entries, optionally grouped into sections. Empty lines and 54 Ignorelists consist of entries, optionally grouped into sections. Empty lines
55 lines starting with "#" are ignored. 55 and lines starting with "#" are ignored.
56 56
57 Section names are regular expressions written in square brackets that denote 57 Section names are regular expressions written in square brackets that denote
58 which sanitizer the following entries apply to. For example, ``[address]`` 58 which sanitizer the following entries apply to. For example, ``[address]``
59 specifies AddressSanitizer while ``[cfi-vcall|cfi-icall]`` specifies Control 59 specifies AddressSanitizer while ``[cfi-vcall|cfi-icall]`` specifies Control
60 Flow Integrity virtual and indirect call checking. Entries without a section 60 Flow Integrity virtual and indirect call checking. Entries without a section
84 # Shell like usage of * is supported (* is treated as .*): 84 # Shell like usage of * is supported (* is treated as .*):
85 src:bad/sources/* 85 src:bad/sources/*
86 fun:*BadFunction* 86 fun:*BadFunction*
87 # Specific sanitizer tools may introduce categories. 87 # Specific sanitizer tools may introduce categories.
88 src:/special/path/*=special_sources 88 src:/special/path/*=special_sources
89 # Sections can be used to limit blacklist entries to specific sanitizers 89 # Sections can be used to limit ignorelist entries to specific sanitizers
90 [address] 90 [address]
91 fun:*BadASanFunc* 91 fun:*BadASanFunc*
92 # Section names are regular expressions 92 # Section names are regular expressions
93 [cfi-vcall|cfi-icall] 93 [cfi-vcall|cfi-icall]
94 fun:*BadCfiCall 94 fun:*BadCfiCall