Make it possible to save runtime errors units from for example fsanitize=undefined to make it easier to reproduce them.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
First question: why is a log file not enough?
It will contain the full sanitizer report (not just summary) and the reproducer.
Frankly, to me this looks like a duplicated functionality.
lib/Fuzzer/FuzzerFlags.def | ||
---|---|---|
62 | write more detailed description (e.g. "save sanitizer error report to a file with 'error-' prefix" or some such) | |
lib/Fuzzer/FuzzerLoop.cpp | ||
16 | __sanitizer_report_error_summary may be used by other parts of code linked with libSanitizer. |
Can you not say the same thing for the current written timeout- and crash files? I like having the files right away it makes it more convenient.
lib/Fuzzer/FuzzerLoop.cpp | ||
---|---|---|
16 | Is there an alternative to sanitizer_report_error_summary to receive the runtime error reports? I wanted to use asan_set_error_report_callback but that doesn't work
I wanted to use replicate the original behaviour of __sanitizer_report_error_summary that does fuzzer::Printf("%s\n", ErrorSummary); |
That's a bit different. The timeout- and crash- files can be directly given back to the fuzzer (the target function).
The file with the log is for a human being to analyze -- the same as for the error report.
lib/Fuzzer/FuzzerLoop.cpp | ||
---|---|---|
16 | asan_set_error_report_callback is closer to what you need but
Does __sanitizer_set_report_path do (almost) what you need? |
I don't save the error log but the corresponding unit that is active during time the sanitizer reports the runtime error which results in the same file as timeout and crash files.
I am sorry, I may be missing something, can we start again?
What problem exactly are you trying to solve?
My problem is that I want to have an easy way to reproduce undefined behaviour errors for further debugging purposes or to put it into my testcases. I want to achieve that saving the active unit during the time ubsan reported the error.
lib/Fuzzer/FuzzerLoop.cpp | ||
---|---|---|
16 |
|
That's exactly what I always need too. But the way current way of doing this work fine to me:
- Run the fuzzer with stderr pointed to a file (if running with -jobs=N, stderr is directed to fuzz-NN.log)
- When the crash happens, the log file contains *all* the information needed to reproduce the error: the message from the sanitizers, the input file encoded in hex and base64, the name of a separate file where the reproducer has been dumped to.
So, before considering this patch I need to understand what's missing in the existing functionality.
BTW, I've noticed fixes in PCRE2 based on your reports. Great work!
My problem is that I want to have an easy way to reproduce undefined
behaviour errors for further debugging purposes or to put it into my
testcases. I want to achieve that saving the active unit during the time
ubsan reported the error.
It is about UBSAN (!) errors. Ubsan reports only and doesn't crash the
process.
For example:
src/pcre2_compile.c:6453:42: runtime error: unsigned integer overflow:
4294967295 + 1 cannot be represented in type 'unsigned int'
SUMMARY: AddressSanitizer: undefined-behavior src/pcre2_compile.c:6453:42
in
I want to save the unit that was running during the error.
Kind regards,
Karl Skomski
It is about UBSAN (!) errors. Ubsan reports only and doesn't crash the
process.
Aha, so that's what you need to fix, not the fuzzer.
Will -fno-sanitize-recover=undefined work for you?
Yes that would be a way to handle it albeit I would still use my patch
because I don't really want the fuzzer to crash from undefined behaviour. I
only want a reproducible unit and some log event with the unit information.
Also I don't want it to save under crash-*. But I am not desperate to merge
it I am happy with my patch :D
Kind regards,
Karl Skomski
Yes that would be a way to handle it albeit I would still use my patch
because I don't really want the fuzzer to crash from undefined behaviour. I
I think this is wrong.
The fuzzer is designed in assumption that any interesting bug leads to a process crash
and I'd like to preserve this simplicity.
write more detailed description (e.g. "save sanitizer error report to a file with 'error-' prefix" or some such)