Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(155)

Side by Side Diff: testing/libfuzzer/getting_started.md

Issue 2578683002: [libfuzzer] force use_prebuilt_instrumented_libraries for libfuzzer (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « build/config/sanitizers/sanitizers.gni ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Getting Started with libFuzzer in Chrome 1 # Getting Started with libFuzzer in Chrome
2 2
3 *** note 3 *** note
4 **Prerequisites:** libFuzzer in Chrome is supported with GN on Linux only. 4 **Prerequisites:** libFuzzer in Chrome is supported with GN on Linux only.
5 *** 5 ***
6 6
7 This document will walk you through: 7 This document will walk you through:
8 8
9 * setting up your build enviroment. 9 * setting up your build enviroment.
10 * creating your first fuzzer. 10 * creating your first fuzzer.
(...skipping 11 matching lines...) Expand all
22 ```bash 22 ```bash
23 # With address sanitizer 23 # With address sanitizer
24 gn gen out/libfuzzer '--args=use_libfuzzer=true is_asan=true is_debug=false enab le_nacl=false' --check 24 gn gen out/libfuzzer '--args=use_libfuzzer=true is_asan=true is_debug=false enab le_nacl=false' --check
25 ``` 25 ```
26 26
27 Supported sanitizer configurations are: 27 Supported sanitizer configurations are:
28 28
29 | GN Argument | Description | 29 | GN Argument | Description |
30 |--------------|----| 30 |--------------|----|
31 | `is_asan=true` | enables [Address Sanitizer] to catch problems like buffer ove rruns. | 31 | `is_asan=true` | enables [Address Sanitizer] to catch problems like buffer ove rruns. |
32 | `is_msan=true` | enables [Memory Sanitizer] to catch problems like uninitialed reads. | 32 | `is_msan=true` | enables [Memory Sanitizer] to catch problems like uninitialed reads<sup>\[[1](#note1)\]</sup>. |
33 | `is_ubsan_security=true` | enables [Undefined Behavior Sanitizer] to catch<sup >\[[1](#Notes)\]</sup> undefined behavior like integer overflow. | 33 | `is_ubsan_security=true` | enables [Undefined Behavior Sanitizer] to catch<sup >\[[2](#note2)\]</sup> undefined behavior like integer overflow. |
34 | | it is possible to run libfuzzer without any sanitizers; *probably not what y ou want*.| 34 | | it is possible to run libfuzzer without any sanitizers; *probably not what y ou want*.|
35 35
36 36
37 ## Write Fuzzer Function 37 ## Write Fuzzer Function
38 38
39 Create a new .cc file and define a `LLVMFuzzerTestOneInput` function: 39 Create a new .cc file and define a `LLVMFuzzerTestOneInput` function:
40 40
41 ```cpp 41 ```cpp
42 #include <stddef.h> 42 #include <stddef.h>
43 #include <stdint.h> 43 #include <stdint.h>
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 130
131 ## Next Steps 131 ## Next Steps
132 132
133 * After your fuzzer is submitted, you should check its [ClusterFuzz status] in 133 * After your fuzzer is submitted, you should check its [ClusterFuzz status] in
134 a day or two. 134 a day or two.
135 * Check the [Efficient Fuzzer Guide] to better understand your fuzzer 135 * Check the [Efficient Fuzzer Guide] to better understand your fuzzer
136 performance and for optimization hints. 136 performance and for optimization hints.
137 137
138 138
139 ## Notes 139 ## Notes
140 [1] By default UBSan doesn't crash once undefined behavior has been detected. 140
141 *[1]* {#note1}You need to [download prebuilt instrumented libraries](https://www .chromium.org/developers/testing/memorysanitizer#TOC-How-to-build-and-run)
142 to use msan ([crbug/653712](https://bugs.chromium.org/p/chromium/issues/detail?i d=653712)):
143 ```bash
144 GYP_DEFINES='use_goma=1 msan=1 use_prebuilt_instrumented_libraries=1' gclient ru nhooks
145 ```
146
147 *[2]* {#note2}By default UBSan doesn't crash once undefined behavior has been de tected.
141 To make it crash the following additional option should be provided: 148 To make it crash the following additional option should be provided:
142
143 ```bash 149 ```bash
144 UBSAN_OPTIONS=halt_on_error=1 ./fuzzer <corpus_directory_or_single_testcase_path > 150 UBSAN_OPTIONS=halt_on_error=1 ./fuzzer <corpus_directory_or_single_testcase_path >
145 ``` 151 ```
146
147 Other useful options (used by ClusterFuzz) are: 152 Other useful options (used by ClusterFuzz) are:
148 ```bash 153 ```bash
149 UBSAN_OPTIONS=symbolize=1:halt_on_error=1:print_stacktrace=1 ./fuzzer <corpus_di rectory_or_single_testcase_path> 154 UBSAN_OPTIONS=symbolize=1:halt_on_error=1:print_stacktrace=1 ./fuzzer <corpus_di rectory_or_single_testcase_path>
150 ``` 155 ```
151 156
152 157
158
153 [Address Sanitizer]: http://clang.llvm.org/docs/AddressSanitizer.html 159 [Address Sanitizer]: http://clang.llvm.org/docs/AddressSanitizer.html
154 [ClusterFuzz status]: clusterfuzz.md#Status-Links 160 [ClusterFuzz status]: clusterfuzz.md#Status-Links
155 [Efficient Fuzzer Guide]: efficient_fuzzer.md 161 [Efficient Fuzzer Guide]: efficient_fuzzer.md
156 [Fuzzer Dictionary]: efficient_fuzzer.md#Fuzzer-Dictionary 162 [Fuzzer Dictionary]: efficient_fuzzer.md#Fuzzer-Dictionary
157 [Maximum Testcase Length]: efficient_fuzzer.md#Maximum-Testcase-Length 163 [Maximum Testcase Length]: efficient_fuzzer.md#Maximum-Testcase-Length
158 [Memory Sanitizer]: http://clang.llvm.org/docs/MemorySanitizer.html 164 [Memory Sanitizer]: http://clang.llvm.org/docs/MemorySanitizer.html
159 [Seed Corpus]: efficient_fuzzer.md#Seed-Corpus 165 [Seed Corpus]: efficient_fuzzer.md#Seed-Corpus
160 [Undefined Behavior Sanitizer]: http://clang.llvm.org/docs/UndefinedBehaviorSani tizer.html 166 [Undefined Behavior Sanitizer]: http://clang.llvm.org/docs/UndefinedBehaviorSani tizer.html
161 [crbug/598448]: https://bugs.chromium.org/p/chromium/issues/detail?id=598448 167 [crbug/598448]: https://bugs.chromium.org/p/chromium/issues/detail?id=598448
162 [url_parse_fuzzer.cc]: https://code.google.com/p/chromium/codesearch#chromium/sr c/testing/libfuzzer/fuzzers/url_parse_fuzzer.cc 168 [url_parse_fuzzer.cc]: https://code.google.com/p/chromium/codesearch#chromium/sr c/testing/libfuzzer/fuzzers/url_parse_fuzzer.cc
OLDNEW
« no previous file with comments | « build/config/sanitizers/sanitizers.gni ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698