[PATCH] D66233: Always print DSO map on Fuchsia libFuzzer launch
Jake Ehrlich via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 16 17:35:48 PDT 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rL372056: [libFuzzer] Always print DSO map on Fuchsia libFuzzer launch (authored by jakehehrlich, committed by ).
Herald added a subscriber: delcypher.
Changed prior to commit:
https://reviews.llvm.org/D66233?vs=215169&id=220411#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D66233/new/
https://reviews.llvm.org/D66233
Files:
compiler-rt/trunk/lib/fuzzer/FuzzerExtFunctions.def
compiler-rt/trunk/lib/fuzzer/FuzzerUtilFuchsia.cpp
Index: compiler-rt/trunk/lib/fuzzer/FuzzerExtFunctions.def
===================================================================
--- compiler-rt/trunk/lib/fuzzer/FuzzerExtFunctions.def
+++ compiler-rt/trunk/lib/fuzzer/FuzzerExtFunctions.def
@@ -33,6 +33,7 @@
(void (*malloc_hook)(const volatile void *, size_t),
void (*free_hook)(const volatile void *)),
false);
+EXT_FUNC(__sanitizer_log_write, void, (const char *buf, size_t len), false);
EXT_FUNC(__sanitizer_purge_allocator, void, (), false);
EXT_FUNC(__sanitizer_print_memory_profile, void, (size_t, size_t), false);
EXT_FUNC(__sanitizer_print_stack_trace, void, (), true);
Index: compiler-rt/trunk/lib/fuzzer/FuzzerUtilFuchsia.cpp
===================================================================
--- compiler-rt/trunk/lib/fuzzer/FuzzerUtilFuchsia.cpp
+++ compiler-rt/trunk/lib/fuzzer/FuzzerUtilFuchsia.cpp
@@ -311,6 +311,17 @@
// Platform specific functions.
void SetSignalHandler(const FuzzingOptions &Options) {
+ // Make sure information from libFuzzer and the sanitizers are easy to
+ // reassemble. `__sanitizer_log_write` has the added benefit of ensuring the
+ // DSO map is always available for the symbolizer.
+ // A uint64_t fits in 20 chars, so 64 is plenty.
+ char Buf[64];
+ memset(Buf, 0, sizeof(Buf));
+ snprintf(Buf, sizeof(Buf), "==%lu== INFO: libFuzzer starting.\n", GetPid());
+ if (EF->__sanitizer_log_write)
+ __sanitizer_log_write(Buf, sizeof(Buf));
+ Printf("%s", Buf);
+
// Set up alarm handler if needed.
if (Options.UnitTimeoutSec > 0) {
std::thread T(AlarmHandler, Options.UnitTimeoutSec / 2 + 1);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66233.220411.patch
Type: text/x-patch
Size: 1643 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190917/73e2cd8c/attachment.bin>
More information about the llvm-commits
mailing list