From 7f4b3a460a0b4f83e9039b57c033f6f43be08550 Mon Sep 17 00:00:00 2001 From: hexcoder- Date: Mon, 4 Jan 2021 22:23:04 +0100 Subject: more code cleanup (instrumentation) --- instrumentation/afl-gcc-pass.so.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'instrumentation/afl-gcc-pass.so.cc') diff --git a/instrumentation/afl-gcc-pass.so.cc b/instrumentation/afl-gcc-pass.so.cc index 25437609..7d9ccdc9 100644 --- a/instrumentation/afl-gcc-pass.so.cc +++ b/instrumentation/afl-gcc-pass.so.cc @@ -228,7 +228,7 @@ struct afl_pass : gimple_opt_pass { const bool neverZero; /* Count instrumented blocks. */ - int inst_blocks; + unsigned int inst_blocks; virtual unsigned int execute(function *fn) { @@ -931,7 +931,7 @@ int plugin_init(struct plugin_name_args * info, quiet = true; /* Decide instrumentation ratio. */ - int inst_ratio = 100; + unsigned int inst_ratio = 100U; if (char *inst_ratio_str = getenv("AFL_INST_RATIO")) if (sscanf(inst_ratio_str, "%u", &inst_ratio) != 1 || !inst_ratio || inst_ratio > 100) -- cgit 1.4.1 From 59b86b0db0c856bc659eb81a1bd3c414865ab1e4 Mon Sep 17 00:00:00 2001 From: van Hauser Date: Tue, 5 Jan 2021 19:20:10 +0100 Subject: haiku fix --- instrumentation/afl-gcc-pass.so.cc | 2 ++ 1 file changed, 2 insertions(+) (limited to 'instrumentation/afl-gcc-pass.so.cc') diff --git a/instrumentation/afl-gcc-pass.so.cc b/instrumentation/afl-gcc-pass.so.cc index 7d9ccdc9..47e1c1bf 100644 --- a/instrumentation/afl-gcc-pass.so.cc +++ b/instrumentation/afl-gcc-pass.so.cc @@ -444,8 +444,10 @@ struct afl_pass : gimple_opt_pass { DECL_EXTERNAL(decl) = 1; DECL_ARTIFICIAL(decl) = 1; TREE_STATIC(decl) = 1; +#if !defined(__ANDROID__) && !defined(__HAIKU__) set_decl_tls_model( decl, (flag_pic ? TLS_MODEL_INITIAL_EXEC : TLS_MODEL_LOCAL_EXEC)); +#endif return decl; } -- cgit 1.4.1 From 1827c65596803fae6add7aed269724f4bb041b0c Mon Sep 17 00:00:00 2001 From: van Hauser Date: Fri, 8 Jan 2021 12:55:05 +0100 Subject: better gcc_plugin error msg --- instrumentation/afl-compiler-rt.o.c | 10 +--------- instrumentation/afl-gcc-pass.so.cc | 5 +++-- 2 files changed, 4 insertions(+), 11 deletions(-) (limited to 'instrumentation/afl-gcc-pass.so.cc') diff --git a/instrumentation/afl-compiler-rt.o.c b/instrumentation/afl-compiler-rt.o.c index add303d7..f194510e 100644 --- a/instrumentation/afl-compiler-rt.o.c +++ b/instrumentation/afl-compiler-rt.o.c @@ -1437,15 +1437,7 @@ void __afl_coverage_abort() { // mark this area as especially interesting void __afl_coverage_interesting(u8 val, u32 id) { - if (id) { - - __afl_area_ptr[id] = val; - - } else { - - __afl_area_ptr[(rand() % __afl_map_size)] = val; - - } + __afl_area_ptr[id] = val; } diff --git a/instrumentation/afl-gcc-pass.so.cc b/instrumentation/afl-gcc-pass.so.cc index 47e1c1bf..65821c68 100644 --- a/instrumentation/afl-gcc-pass.so.cc +++ b/instrumentation/afl-gcc-pass.so.cc @@ -922,8 +922,9 @@ int plugin_init(struct plugin_name_args * info, struct plugin_gcc_version *version) { if (!plugin_default_version_check(version, &gcc_version)) - FATAL(G_("GCC and plugin have incompatible versions, expected GCC %d.%d"), - GCCPLUGIN_VERSION_MAJOR, GCCPLUGIN_VERSION_MINOR); + FATAL(G_("GCC and plugin have incompatible versions, expected GCC %d.%d, " + "is %s"), + GCCPLUGIN_VERSION_MAJOR, GCCPLUGIN_VERSION_MINOR, version->basever); /* Show a banner. */ bool quiet = false; -- cgit 1.4.1 From 813627cbd32be9466e0b5ad3a83ce8209dcfeb51 Mon Sep 17 00:00:00 2001 From: van Hauser Date: Fri, 8 Jan 2021 13:01:46 +0100 Subject: better gcc_plugin error msg --- instrumentation/afl-gcc-pass.so.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'instrumentation/afl-gcc-pass.so.cc') diff --git a/instrumentation/afl-gcc-pass.so.cc b/instrumentation/afl-gcc-pass.so.cc index 65821c68..41bb5152 100644 --- a/instrumentation/afl-gcc-pass.so.cc +++ b/instrumentation/afl-gcc-pass.so.cc @@ -922,9 +922,9 @@ int plugin_init(struct plugin_name_args * info, struct plugin_gcc_version *version) { if (!plugin_default_version_check(version, &gcc_version)) - FATAL(G_("GCC and plugin have incompatible versions, expected GCC %d.%d, " + FATAL(G_("GCC and plugin have incompatible versions, expected GCC %s, " "is %s"), - GCCPLUGIN_VERSION_MAJOR, GCCPLUGIN_VERSION_MINOR, version->basever); + gcc_version.basever, version->basever); /* Show a banner. */ bool quiet = false; -- cgit 1.4.1