OLD | NEW |
1 /* | 1 /* |
2 american fuzzy lop - wrapper for GCC and clang | 2 american fuzzy lop - wrapper for GCC and clang |
3 ---------------------------------------------- | 3 ---------------------------------------------- |
4 | 4 |
5 Written and maintained by Michal Zalewski <lcamtuf@google.com> | 5 Written and maintained by Michal Zalewski <lcamtuf@google.com> |
6 | 6 |
7 Copyright 2013, 2014, 2015 Google Inc. All rights reserved. | 7 Copyright 2013, 2014, 2015 Google Inc. All rights reserved. |
8 | 8 |
9 Licensed under the Apache License, Version 2.0 (the "License"); | 9 Licensed under the Apache License, Version 2.0 (the "License"); |
10 you may not use this file except in compliance with the License. | 10 you may not use this file except in compliance with the License. |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 } | 222 } |
223 | 223 |
224 if (asan_set) { | 224 if (asan_set) { |
225 | 225 |
226 /* Pass this on to afl-as to adjust map density. */ | 226 /* Pass this on to afl-as to adjust map density. */ |
227 | 227 |
228 setenv("AFL_USE_ASAN", "1", 1); | 228 setenv("AFL_USE_ASAN", "1", 1); |
229 | 229 |
230 } else if (getenv("AFL_USE_ASAN")) { | 230 } else if (getenv("AFL_USE_ASAN")) { |
231 | 231 |
232 cc_params[cc_par_cnt++] = "-fsanitize=address"; | |
233 | |
234 if (getenv("AFL_USE_MSAN")) | 232 if (getenv("AFL_USE_MSAN")) |
235 FATAL("ASAN and MSAN are mutually exclusive"); | 233 FATAL("ASAN and MSAN are mutually exclusive"); |
236 | 234 |
| 235 if (getenv("AFL_HARDEN")) |
| 236 FATAL("ASAN and AFL_HARDEN are mutually exclusive"); |
| 237 |
| 238 cc_params[cc_par_cnt++] = "-U_FORTIFY_SOURCE"; |
| 239 cc_params[cc_par_cnt++] = "-fsanitize=address"; |
| 240 |
237 } else if (getenv("AFL_USE_MSAN")) { | 241 } else if (getenv("AFL_USE_MSAN")) { |
238 | 242 |
239 cc_params[cc_par_cnt++] = "-fsanitize=memory"; | |
240 | |
241 if (getenv("AFL_USE_ASAN")) | 243 if (getenv("AFL_USE_ASAN")) |
242 FATAL("ASAN and MSAN are mutually exclusive"); | 244 FATAL("ASAN and MSAN are mutually exclusive"); |
243 | 245 |
| 246 if (getenv("AFL_HARDEN")) |
| 247 FATAL("MSAN and AFL_HARDEN are mutually exclusive"); |
| 248 |
| 249 cc_params[cc_par_cnt++] = "-U_FORTIFY_SOURCE"; |
| 250 cc_params[cc_par_cnt++] = "-fsanitize=memory"; |
| 251 |
| 252 |
244 } | 253 } |
245 | 254 |
246 if (!getenv("AFL_DONT_OPTIMIZE")) { | 255 if (!getenv("AFL_DONT_OPTIMIZE")) { |
247 | 256 |
248 #if defined(__FreeBSD__) && defined(__x86_64__) | 257 #if defined(__FreeBSD__) && defined(__x86_64__) |
249 | 258 |
250 /* On 64-bit FreeBSD systems, clang -g -m32 is broken, but -m32 itself | 259 /* On 64-bit FreeBSD systems, clang -g -m32 is broken, but -m32 itself |
251 works OK. This has nothing to do with us, but let's avoid triggering | 260 works OK. This has nothing to do with us, but let's avoid triggering |
252 that bug. */ | 261 that bug. */ |
253 | 262 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 " CXX=%s/afl-g++ ./configure\n\n" | 316 " CXX=%s/afl-g++ ./configure\n\n" |
308 | 317 |
309 "You can specify custom next-stage toolchain via AFL_CC, AFL_CXX, and A
FL_AS.\n" | 318 "You can specify custom next-stage toolchain via AFL_CC, AFL_CXX, and A
FL_AS.\n" |
310 "Setting AFL_HARDEN enables hardening optimizations in the compiled cod
e.\n\n", | 319 "Setting AFL_HARDEN enables hardening optimizations in the compiled cod
e.\n\n", |
311 BIN_PATH, BIN_PATH); | 320 BIN_PATH, BIN_PATH); |
312 | 321 |
313 exit(1); | 322 exit(1); |
314 | 323 |
315 } | 324 } |
316 | 325 |
317 | |
318 find_as(argv[0]); | 326 find_as(argv[0]); |
319 | 327 |
320 edit_params(argc, argv); | 328 edit_params(argc, argv); |
321 | 329 |
322 execvp(cc_params[0], (char**)cc_params); | 330 execvp(cc_params[0], (char**)cc_params); |
323 | 331 |
324 FATAL("Oops, failed to execute '%s' - check your PATH", cc_params[0]); | 332 FATAL("Oops, failed to execute '%s' - check your PATH", cc_params[0]); |
325 | 333 |
326 return 0; | 334 return 0; |
327 | 335 |
328 } | 336 } |
OLD | NEW |