[PATCH] D83494: [libFuzzer] Link libFuzzer's own interceptors when other compiler runtimes are not linked.
Mitch Phillips via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jul 14 09:55:50 PDT 2020
hctim added inline comments.
================
Comment at: clang/lib/Driver/SanitizerArgs.cpp:242
+bool SanitizerArgs::needsFuzzerInterceptors() const {
+ return needsFuzzer() && !needsAsanRt() && !needsHwasanRt() &&
+ !needsTsanRt() && !needsMsanRt();
----------------
HWASan doesn't have interceptors - we actually want fuzzer interceptors under `needsFuzzer() && needsHwasanRt()` (just remove the `!needsHwasanRt()`).
================
Comment at: compiler-rt/lib/fuzzer/FuzzerInterceptors.cpp:52
+// NOLINTNEXTLINE
+void __sanitizer_weak_hook_memcmp(void *, const void *, const void *, size_t,
+ int);
----------------
Why not `#include <sanitizer/common_interface_defs.h>` (and below)?
================
Comment at: compiler-rt/lib/fuzzer/FuzzerPlatform.h:1
-//===- FuzzerDefs.h - Internal header for the Fuzzer ------------*- C++ -* ===//
+//===-- FuzzerInterceptors.cpp --------------------------------------------===//
//
----------------
Nit - name change
================
Comment at: compiler-rt/lib/fuzzer/FuzzerPlatform.h:8
//===----------------------------------------------------------------------===//
-// Basic definitions.
+//
+// Common platform macros.
----------------
Nit - remove blank comment
================
Comment at: compiler-rt/test/fuzzer/memcmp.test:8
+RUN: not %run %t-MemcmpTest -seed=1 -runs=10000000 2>&1 | FileCheck %s --check-prefix=CHECK2
+CHECK2: BINGO
----------------
morehouse wrote:
> CHECK1 and CHECK2 is unnecessary. Let's use the same CHECK for both.
No need to have different `CHECK`'s throughout this patchset (in both tests we're checking for the same thing.
```
UNSUPPORTED: freebsd
RUN: %cpp_compiler %S/MemcmpTest.cpp -o %t-MemcmpTest
RUN: not %run %t-MemcmpTest -seed=1 -runs=10000000 2>&1 | FileCheck %s
RUN: %cpp_compiler -fno-sanitize=address -fno-builtin-memcmp %S/MemcmpTest.cpp -o %t-NoAsanMemcmpTest
RUN: not %run %t-MemcmpTest -seed=1 -runs=10000000 2>&1 | FileCheck %s
CHECK: BINGO
```
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D83494/new/
https://reviews.llvm.org/D83494
More information about the cfe-commits
mailing list