diff options
author | Christian Holler (:decoder) <choller@mozilla.com> | 2024-01-26 14:41:23 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-26 13:41:23 +0000 |
commit | 2f9eeef60cdd4ad43f8066af78009acd660a426c (patch) | |
tree | 5d74721371b39f38a7194ada42ce9d7824fca748 /src | |
parent | d88c97ad2887962a8565473269057d39d75f998d (diff) | |
download | afl++-2f9eeef60cdd4ad43f8066af78009acd660a426c.tar.gz |
Avoid adding llvmnative instrumentation when linking rust sanitizer runtime (#1969)
Diffstat (limited to 'src')
-rw-r--r-- | src/afl-cc.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/afl-cc.c b/src/afl-cc.c index 174b3783..6d8e1024 100644 --- a/src/afl-cc.c +++ b/src/afl-cc.c @@ -173,7 +173,8 @@ typedef struct aflcc_state { u8 fortify_set, x_set, bit_mode, preprocessor_only, have_unroll, have_o, have_pic, have_c, shared_linking, partial_linking, non_dash, have_fp, have_flto, have_hidden, have_fortify, have_fcf, have_staticasan, - have_asan, have_msan, have_ubsan, have_lsan, have_tsan, have_cfisan; + have_rust_asanrt, have_asan, have_msan, have_ubsan, have_lsan, have_tsan, + have_cfisan; // u8 *march_opt; u8 need_aflpplib; @@ -1908,6 +1909,14 @@ void add_sanitizers(aflcc_state_t *aflcc, char **envp) { void add_native_pcguard(aflcc_state_t *aflcc) { + /* If there is a rust ASan runtime on the command line, it is likely we're + * linking from rust and adding native flags requiring the sanitizer runtime + * will trigger native clang to add yet another runtime, causing linker + * errors. For now we shouldn't add instrumentation here, we're linking + * anyway. + */ + if (aflcc->have_rust_asanrt) { return; } + /* If llvm-config doesn't figure out LLVM_MAJOR, just go on anyway and let compiler complain if doesn't work. */ @@ -2480,6 +2489,10 @@ param_st parse_misc_params(aflcc_state_t *aflcc, u8 *cur_argv, u8 scan) { SCAN_KEEP(aflcc->have_staticasan, 1); + } else if (strstr(cur_argv, "librustc") && strstr(cur_argv, "_rt.asan.a")) { + + SCAN_KEEP(aflcc->have_rust_asanrt, 1); + } else if (!strcmp(cur_argv, "-fno-omit-frame-pointer")) { SCAN_KEEP(aflcc->have_fp, 1); |