From feff8191ecbde9bb039e2311440f47e8f0325413 Mon Sep 17 00:00:00 2001 From: Akira Moroo Date: Mon, 15 Nov 2021 01:57:36 +0000 Subject: [PATCH] Fix platform check for `-A` CoreSight mode Signed-off-by: Akira Moroo --- src/afl-analyze.c | 10 ++++------ src/afl-fuzz.c | 10 ++++------ src/afl-showmap.c | 10 ++++------ src/afl-tmin.c | 10 ++++------ 4 files changed, 16 insertions(+), 24 deletions(-) diff --git a/src/afl-analyze.c b/src/afl-analyze.c index 6e1a9e7b..bc562c15 100644 --- a/src/afl-analyze.c +++ b/src/afl-analyze.c @@ -995,14 +995,12 @@ int main(int argc, char **argv_orig, char **envp) { case 'A': /* CoreSight mode */ +#if !defined(__aarch64__) || !defined(__linux__) + FATAL("-A option is not supported on this platform"); +#endif + if (cs_mode) { FATAL("Multiple -A options not supported"); } - if (!(__aarch64__ && __linux__)) { - - FATAL("-A option is not supported on this platform"); - - } - cs_mode = 1; fsrv.cs_mode = cs_mode; break; diff --git a/src/afl-fuzz.c b/src/afl-fuzz.c index e6d9508b..44363c2b 100644 --- a/src/afl-fuzz.c +++ b/src/afl-fuzz.c @@ -829,14 +829,12 @@ int main(int argc, char **argv_orig, char **envp) { case 'A': /* CoreSight mode */ + #if !defined(__aarch64__) || !defined(__linux__) + FATAL("-A option is not supported on this platform"); + #endif + if (afl->fsrv.cs_mode) { FATAL("Multiple -A options not supported"); } - if (!(__aarch64__ && __linux__)) { - - FATAL("-A option is not supported on this platform"); - - } - afl->fsrv.cs_mode = 1; break; diff --git a/src/afl-showmap.c b/src/afl-showmap.c index 0e7d9df6..899baaa0 100644 --- a/src/afl-showmap.c +++ b/src/afl-showmap.c @@ -1067,14 +1067,12 @@ int main(int argc, char **argv_orig, char **envp) { * undocumenetd feature "Another afl-cmin specific feature." */ case 'P': /* CoreSight mode */ +#if !defined(__aarch64__) || !defined(__linux__) + FATAL("-P option is not supported on this platform"); +#endif + if (fsrv->cs_mode) { FATAL("Multiple -P options not supported"); } - if (!(__aarch64__ && __linux__)) { - - FATAL("-P option is not supported on this platform"); - - } - fsrv->cs_mode = true; break; diff --git a/src/afl-tmin.c b/src/afl-tmin.c index 110beed5..22383a4e 100644 --- a/src/afl-tmin.c +++ b/src/afl-tmin.c @@ -1038,14 +1038,12 @@ int main(int argc, char **argv_orig, char **envp) { case 'A': /* CoreSight mode */ +#if !defined(__aarch64__) || !defined(__linux__) + FATAL("-A option is not supported on this platform"); +#endif + if (fsrv->cs_mode) { FATAL("Multiple -A options not supported"); } - if (!(__aarch64__ && __linux__)) { - - FATAL("-A option is not supported on this platform"); - - } - fsrv->cs_mode = 1; break;