Dynamic instrumentation filtering for LLVM native (#1971)

* Add two dynamic instrumentation filter methods to runtime

* Always use pc-table with native pcguard

* Add make_symbol_list.py and README
This commit is contained in:
Christian Holler (:decoder)
2024-01-26 15:46:56 +01:00
committed by GitHub
parent 2f9eeef60c
commit 58b80b68bc
4 changed files with 393 additions and 40 deletions

View File

@ -1920,35 +1920,27 @@ void add_native_pcguard(aflcc_state_t *aflcc) {
/* If llvm-config doesn't figure out LLVM_MAJOR, just
go on anyway and let compiler complain if doesn't work. */
if (aflcc->instrument_opt_mode & INSTRUMENT_OPT_CODECOV) {
#if LLVM_MAJOR > 0 && LLVM_MAJOR < 6
FATAL("pcguard instrumentation with pc-table requires LLVM 6.0.1+");
FATAL("pcguard instrumentation with pc-table requires LLVM 6.0.1+");
#else
#if LLVM_MAJOR == 0
WARNF(
"pcguard instrumentation with pc-table requires LLVM 6.0.1+"
" otherwise the compiler will fail");
WARNF(
"pcguard instrumentation with pc-table requires LLVM 6.0.1+"
" otherwise the compiler will fail");
#endif
if (aflcc->instrument_opt_mode & INSTRUMENT_OPT_CODECOV) {
insert_param(aflcc,
"-fsanitize-coverage=trace-pc-guard,bb,no-prune,pc-table");
#endif
} else {
#if LLVM_MAJOR > 0 && LLVM_MAJOR < 4
FATAL("pcguard instrumentation requires LLVM 4.0.1+");
#else
#if LLVM_MAJOR == 0
WARNF(
"pcguard instrumentation requires LLVM 4.0.1+"
" otherwise the compiler will fail");
#endif
insert_param(aflcc, "-fsanitize-coverage=trace-pc-guard");
#endif
insert_param(aflcc, "-fsanitize-coverage=trace-pc-guard,pc-table");
}
#endif
}
void add_optimized_pcguard(aflcc_state_t *aflcc) {