[PATCH] D83987: Recommit "[libFuzzer] Disable implicit builtin knowledge about memcmp-like functions when -fsanitize=fuzzer-no-link is given."

2020-07-27 Thread Dokyung Song via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rGb52b2e1c1880: Recommit [libFuzzer] Disable implicit builtin knowledge about memcmp-like… (authored by dokyungs). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION

[PATCH] D83987: Recommit "[libFuzzer] Disable implicit builtin knowledge about memcmp-like functions when -fsanitize=fuzzer-no-link is given."

2020-07-27 Thread Dokyung Song via Phabricator via cfe-commits
dokyungs updated this revision to Diff 280982. dokyungs added a comment. Disable noasan-bcmp.test on darwin. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D83987/new/ https://reviews.llvm.org/D83987 Files: clang/lib/Driver/SanitizerArgs.cpp

[PATCH] D83987: Recommit "[libFuzzer] Disable implicit builtin knowledge about memcmp-like functions when -fsanitize=fuzzer-no-link is given."

2020-07-27 Thread Dokyung Song via Phabricator via cfe-commits
dokyungs updated this revision to Diff 280981. dokyungs added a comment. Add '-fno-builtin-bcmp' and a corresponding test case. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D83987/new/ https://reviews.llvm.org/D83987 Files:

[PATCH] D83987: [libFuzzer] Disable implicit builtin knowledge about memcmp-like functions when -fsanitize=fuzzer-no-link is given.

2020-07-24 Thread Dokyung Song via Phabricator via cfe-commits
dokyungs updated this revision to Diff 280507. dokyungs added a comment. Relanding this reverted commit. (See summary) Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D83987/new/ https://reviews.llvm.org/D83987 Files:

[PATCH] D83494: [libFuzzer] Link libFuzzer's own interceptors when other compiler runtimes are not linked.

2020-07-23 Thread Dokyung Song via Phabricator via cfe-commits
dokyungs added a comment. In D83494#2170838 , @dmajor wrote: > After this commit, several of our builds are failing with > `FuzzerInterceptors.cpp:30:10: fatal error: > 'sanitizer/common_interface_defs.h' file not found`. This is odd because the > file

[PATCH] D83494: [libFuzzer] Link libFuzzer's own interceptors when other compiler runtimes are not linked.

2020-07-23 Thread Dokyung Song via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. dokyungs marked an inline comment as done. Closed by commit rG831ae45e3dc6: Recommit [libFuzzer] Link libFuzzers own interceptors when other compiler… (authored by dokyungs). Repository: rG LLVM Github Monorepo CHANGES

[PATCH] D83494: [libFuzzer] Link libFuzzer's own interceptors when other compiler runtimes are not linked.

2020-07-22 Thread Dokyung Song via Phabricator via cfe-commits
dokyungs marked 2 inline comments as done. dokyungs added inline comments. Comment at: compiler-rt/lib/fuzzer/FuzzerInterceptors.cpp:86 +s2++; + } + return 0; morehouse wrote: > Lot's of common code with `internal_strncmp`. Let's factor it out into a >

[PATCH] D83494: [libFuzzer] Link libFuzzer's own interceptors when other compiler runtimes are not linked.

2020-07-22 Thread Dokyung Song via Phabricator via cfe-commits
dokyungs updated this revision to Diff 279982. dokyungs added a comment. Introduced a helper function to reduce duplicated code. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D83494/new/ https://reviews.llvm.org/D83494 Files:

[PATCH] D83494: [libFuzzer] Link libFuzzer's own interceptors when other compiler runtimes are not linked.

2020-07-22 Thread Dokyung Song via Phabricator via cfe-commits
dokyungs marked 4 inline comments as done. dokyungs added inline comments. Comment at: compiler-rt/test/fuzzer/custom-allocator.test:2 +UNSUPPORTED: freebsd +RUN: %cpp_compiler -fno-sanitize=all -fno-builtin %S/CustomAllocator.cpp -fPIC %ld_flags_rpath_so1 -O0 -shared -o

[PATCH] D83494: [libFuzzer] Link libFuzzer's own interceptors when other compiler runtimes are not linked.

2020-07-22 Thread Dokyung Song via Phabricator via cfe-commits
dokyungs updated this revision to Diff 279946. dokyungs marked an inline comment as done. dokyungs added a comment. Introduce internal_strcmp and update tests accordingly. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D83494/new/

[PATCH] D83494: [libFuzzer] Link libFuzzer's own interceptors when other compiler runtimes are not linked.

2020-07-17 Thread Dokyung Song via Phabricator via cfe-commits
dokyungs marked 4 inline comments as done. dokyungs added inline comments. Comment at: compiler-rt/lib/fuzzer/FuzzerInterceptors.cpp:119 +return internal_memcmp(s1, s2, n); + ensureFuzzerInited(); + int result = REAL(memcmp)(s1, s2, n); morehouse wrote: >

[PATCH] D83494: [libFuzzer] Link libFuzzer's own interceptors when other compiler runtimes are not linked.

2020-07-17 Thread Dokyung Song via Phabricator via cfe-commits
dokyungs updated this revision to Diff 278924. dokyungs marked 2 inline comments as done. dokyungs added a comment. Removed CustomAllocatorTest.cpp. Instead, use EmptyTest.cpp. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D83494/new/

[PATCH] D83494: [libFuzzer] Link libFuzzer's own interceptors when other compiler runtimes are not linked.

2020-07-17 Thread Dokyung Song via Phabricator via cfe-commits
dokyungs updated this revision to Diff 278923. dokyungs added a comment. Addressed comments. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D83494/new/ https://reviews.llvm.org/D83494 Files: clang/include/clang/Driver/SanitizerArgs.h

[PATCH] D83494: [libFuzzer] Link libFuzzer's own interceptors when other compiler runtimes are not linked.

2020-07-17 Thread Dokyung Song via Phabricator via cfe-commits
dokyungs updated this revision to Diff 278892. dokyungs added a comment. Introduce internal_(memcmp|strncmp|strstr) and use them before interceptors are fully initialized. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D83494/new/

[PATCH] D83987: [libFuzzer] Disable implicit builtin knowledge about memcmp-like functions when -fsanitize=fuzzer-no-link is given.

2020-07-16 Thread Dokyung Song via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rG12d1124c49be: [libFuzzer] Disable implicit builtin knowledge about memcmp-like functions when… (authored by dokyungs). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION

[PATCH] D83987: [libFuzzer] Disable implicit builtin knowledge about memcmp-like functions when -fsanitize=fuzzer-no-link is given.

2020-07-16 Thread Dokyung Song via Phabricator via cfe-commits
dokyungs updated this revision to Diff 278613. dokyungs added a comment. Adjusted the comment as suggested. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D83987/new/ https://reviews.llvm.org/D83987 Files: clang/lib/Driver/SanitizerArgs.cpp

[PATCH] D83987: [libFuzzer] Disable implicit builtin knowledge about memcmp-like functions when -fsanitize=fuzzer-no-link is given.

2020-07-16 Thread Dokyung Song via Phabricator via cfe-commits
dokyungs marked an inline comment as done. dokyungs added a comment. Thanks Mitch for the comment! Added a comment that explains that. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D83987/new/ https://reviews.llvm.org/D83987

[PATCH] D83987: [libFuzzer] Disable implicit builtin knowledge about memcmp-like functions when -fsanitize=fuzzer-no-link is given.

2020-07-16 Thread Dokyung Song via Phabricator via cfe-commits
dokyungs updated this revision to Diff 278610. dokyungs added a comment. Addressed comments. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D83987/new/ https://reviews.llvm.org/D83987 Files: clang/lib/Driver/SanitizerArgs.cpp

[PATCH] D83987: [libFuzzer] Disable implicit builtin knowledge about memcmp-like functions when -fsanitize=fuzzer-no-link is given.

2020-07-16 Thread Dokyung Song via Phabricator via cfe-commits
dokyungs created this revision. dokyungs added reviewers: morehouse, hctim. Herald added projects: clang, Sanitizers. Herald added subscribers: Sanitizers, cfe-commits. This patch disables implicit builtin knowledge about memcmp-like functions when compiling the program for fuzzing, i.e., when

[PATCH] D83494: [libFuzzer] Link libFuzzer's own interceptors when other compiler runtimes are not linked.

2020-07-16 Thread Dokyung Song via Phabricator via cfe-commits
dokyungs updated this revision to Diff 278589. dokyungs added a comment. Addressed comments. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D83494/new/ https://reviews.llvm.org/D83494 Files: clang/include/clang/Driver/SanitizerArgs.h

[PATCH] D83494: [libFuzzer] Link libFuzzer's own interceptors when other compiler runtimes are not linked.

2020-07-16 Thread Dokyung Song via Phabricator via cfe-commits
dokyungs updated this revision to Diff 278565. dokyungs added a comment. Addressed comments. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D83494/new/ https://reviews.llvm.org/D83494 Files: clang/include/clang/Driver/SanitizerArgs.h

[PATCH] D83494: [libFuzzer] Link libFuzzer's own interceptors when other compiler runtimes are not linked.

2020-07-15 Thread Dokyung Song via Phabricator via cfe-commits
dokyungs updated this revision to Diff 278341. dokyungs added a comment. Ensure the fuzzer RT module is initialized at the beginning of the interceptors. Interceptors can be called before __fuzzer_init is called. So I added a check at the beginning of the interceptors, which ensures that

[PATCH] D83494: [libFuzzer] Link libFuzzer's own interceptors when other compiler runtimes are not linked.

2020-07-14 Thread Dokyung Song via Phabricator via cfe-commits
dokyungs updated this revision to Diff 277996. dokyungs added a comment. Addressed comments. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D83494/new/ https://reviews.llvm.org/D83494 Files: clang/include/clang/Driver/SanitizerArgs.h

[PATCH] D83494: [libFuzzer] Link libFuzzer's own interceptors when other compiler runtimes are not linked.

2020-07-14 Thread Dokyung Song via Phabricator via cfe-commits
dokyungs updated this revision to Diff 277904. dokyungs marked 5 inline comments as done. dokyungs added a comment. Use one CHECK for two subtests Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D83494/new/ https://reviews.llvm.org/D83494 Files:

[PATCH] D83494: [libFuzzer] Link libFuzzer's own interceptors when other compiler runtimes are not linked.

2020-07-14 Thread Dokyung Song via Phabricator via cfe-commits
dokyungs updated this revision to Diff 277901. dokyungs added a comment. Addressed comments. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D83494/new/ https://reviews.llvm.org/D83494 Files: clang/include/clang/Driver/SanitizerArgs.h

[PATCH] D83494: [libFuzzer] Link libFuzzer's own interceptors when other compiler runtimes are not linked.

2020-07-14 Thread Dokyung Song via Phabricator via cfe-commits
dokyungs added a comment. In D83494#2150643 , @morehouse wrote: > In D83494#2148868 , @dokyungs wrote: > > > Addressed Matt's comments. > > > > A major change in this round that needs explanation is introduction of

[PATCH] D83494: [libFuzzer] Link libFuzzer's own interceptors when other compiler runtimes are not linked.

2020-07-13 Thread Dokyung Song via Phabricator via cfe-commits
dokyungs updated this revision to Diff 277625. dokyungs added a comment. Use unique output file name for each subtest, and add no-asan subtest in memcmp64.test Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D83494/new/

[PATCH] D83494: [libFuzzer] Link libFuzzer's own interceptors when other compiler runtimes are not linked.

2020-07-13 Thread Dokyung Song via Phabricator via cfe-commits
dokyungs updated this revision to Diff 277624. dokyungs added a comment. strncmp test should include -fno-builtin-strncmp, not -fno-builtin-strcmp Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D83494/new/ https://reviews.llvm.org/D83494 Files:

[PATCH] D83494: [libFuzzer] Link libFuzzer's own interceptors when other compiler runtimes are not linked.

2020-07-13 Thread Dokyung Song via Phabricator via cfe-commits
dokyungs marked 9 inline comments as done. dokyungs added inline comments. Comment at: compiler-rt/lib/fuzzer/FuzzerInterceptors.cpp:116 + +extern "C++" ATTRIBUTE_INTERFACE char *strstr(char *s1, const char *s2) { + char *result = REAL(strstr)(s1, s2);

[PATCH] D83494: [libFuzzer] Link libFuzzer's own interceptors when other compiler runtimes are not linked.

2020-07-13 Thread Dokyung Song via Phabricator via cfe-commits
dokyungs updated this revision to Diff 277620. dokyungs added a comment. Herald added a subscriber: krytarowski. Addressed Matt's comments. A major change in this round that needs explanation is introduction of FuzzerPlatform.h. Previously I defined `strstr` and `strcasestr` with `extern

[PATCH] D83494: [libFuzzer] Link libFuzzer's own interceptors when other compiler runtimes are not linked.

2020-07-13 Thread Dokyung Song via Phabricator via cfe-commits
dokyungs updated this revision to Diff 277530. dokyungs added a comment. Fixed a few LINT warnings by defining some macros that resemble the ones used in other sanitizer interception code. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D83494/new/

[PATCH] D83494: [libFuzzer] Link libFuzzer's own interceptors when other compiler runtimes are not linked.

2020-07-13 Thread Dokyung Song via Phabricator via cfe-commits
dokyungs added a comment. In D83494#2148043 , @hctim wrote: > In D83494#2147608 , @dokyungs wrote: > > > Builtin libfunc optimizations may transform memcmp and strcmp-like > > functions. To disable such

[PATCH] D83494: [libFuzzer] Link libFuzzer's own interceptors when other compiler runtimes are not linked.

2020-07-13 Thread Dokyung Song via Phabricator via cfe-commits
dokyungs updated this revision to Diff 277462. dokyungs added a comment. Add interceptors for all the functions libFuzzer has a weak interceptor for, and duplicate existing interceptor test cases with new compiler flags (-fno-sanitize=address). Builtin libfunc optimizations may transform

[PATCH] D83494: [libFuzzer] Link libFuzzer's own interceptors when other compiler runtimes are not linked.

2020-07-09 Thread Dokyung Song via Phabricator via cfe-commits
dokyungs created this revision. Herald added subscribers: Sanitizers, cfe-commits, mgorny. Herald added projects: clang, Sanitizers. libFuzzer intercepts certain library functions such as memcmp/strcmp by defining weak hooks. Weak hooks, however, are called only when other runtimes such as ASan