about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorvanhauser-thc <vh@thc.org>2023-04-16 12:42:32 +0200
committervanhauser-thc <vh@thc.org>2023-04-16 12:42:32 +0200
commit56f7e3aa088e715b054f10c01b6b5a7e5acf8931 (patch)
treeb2e3c154f14bfc9d7d284a92afdd508d119f1eea /src
parent87b9dc4ba0d14d7a144578faf37f899724b826a3 (diff)
downloadafl++-56f7e3aa088e715b054f10c01b6b5a7e5acf8931.tar.gz
hidden -Y option for nyx, code format
Diffstat (limited to 'src')
-rw-r--r--src/afl-analyze.c29
-rw-r--r--src/afl-common.c26
-rw-r--r--src/afl-forkserver.c151
-rw-r--r--src/afl-showmap.c54
-rw-r--r--src/afl-tmin.c27
5 files changed, 194 insertions, 93 deletions
diff --git a/src/afl-analyze.c b/src/afl-analyze.c
index 0a4e7fb5..5b122741 100644
--- a/src/afl-analyze.c
+++ b/src/afl-analyze.c
@@ -815,7 +815,7 @@ int main(int argc, char **argv_orig, char **envp) {
 
   afl_fsrv_init(&fsrv);
 
-  while ((opt = getopt(argc, argv, "+i:f:m:t:eAOQUWXh")) > 0) {
+  while ((opt = getopt(argc, argv, "+i:f:m:t:eAOQUWXYh")) > 0) {
 
     switch (opt) {
 
@@ -966,8 +966,9 @@ int main(int argc, char **argv_orig, char **envp) {
         fsrv.mem_limit = mem_limit;
 
         break;
-      
-  #ifdef __linux__
+
+      case 'Y':  // fallthough
+#ifdef __linux__
       case 'X':                                                 /* NYX mode */
 
         if (fsrv.nyx_mode) { FATAL("Multiple -X options not supported"); }
@@ -977,11 +978,11 @@ int main(int argc, char **argv_orig, char **envp) {
         fsrv.nyx_standalone = true;
 
         break;
-  #else
+#else
       case 'X':
         FATAL("Nyx mode is only availabe on linux...");
         break;
-  #endif
+#endif
 
       case 'h':
         usage(argv[0]);
@@ -1015,12 +1016,16 @@ int main(int argc, char **argv_orig, char **envp) {
   set_up_environment(argv);
 
 #ifdef __linux__
-  if(!fsrv.nyx_mode){
+  if (!fsrv.nyx_mode) {
+
     fsrv.target_path = find_binary(argv[optind]);
-  }
-  else{
+
+  } else {
+
     fsrv.target_path = ck_strdup(argv[optind]);
+
   }
+
 #else
   fsrv.target_path = find_binary(argv[optind]);
 #endif
@@ -1048,6 +1053,7 @@ int main(int argc, char **argv_orig, char **envp) {
     use_argv = get_cs_argv(argv[0], &target_path, argc - optind, argv + optind);
 
 #ifdef __linux__
+
   } else if (fsrv.nyx_mode) {
 
     fsrv.nyx_id = 0;
@@ -1055,7 +1061,9 @@ int main(int argc, char **argv_orig, char **envp) {
     u8 *libnyx_binary = find_afl_binary(argv[0], "libnyx.so");
     fsrv.nyx_handlers = afl_load_libnyx_plugin(libnyx_binary);
     if (fsrv.nyx_handlers == NULL) {
+
       FATAL("failed to initialize libnyx.so...");
+
     }
 
     fsrv.nyx_use_tmp_workdir = true;
@@ -1090,9 +1098,7 @@ int main(int argc, char **argv_orig, char **envp) {
 
   read_initial_file();
 #ifdef __linux__
-  if(!fsrv.nyx_mode){
-    (void)check_binary_signatures(fsrv.target_path);
-  }
+  if (!fsrv.nyx_mode) { (void)check_binary_signatures(fsrv.target_path); }
 #else
   (void)check_binary_signatures(fsrv.target_path);
 #endif
@@ -1119,7 +1125,6 @@ int main(int argc, char **argv_orig, char **envp) {
 
   OKF("We're done here. Have a nice day!\n");
 
-
   afl_shm_deinit(&shm);
   afl_fsrv_deinit(&fsrv);
   if (fsrv.target_path) { ck_free(fsrv.target_path); }
diff --git a/src/afl-common.c b/src/afl-common.c
index 5692e277..a5c48e80 100644
--- a/src/afl-common.c
+++ b/src/afl-common.c
@@ -1365,36 +1365,46 @@ s32 create_file(u8 *fn) {
  * etc.). This helper function basically creates both a path to a tmp workdir
  * and the workdir itself. If the environment variable TMPDIR is set, we use
  * that as the base directory, otherwise we use /tmp. */
-char* create_nyx_tmp_workdir(void) {
+char *create_nyx_tmp_workdir(void) {
 
   char *tmpdir = getenv("TMPDIR");
 
   if (!tmpdir) { tmpdir = "/tmp"; }
 
-  char* nyx_out_dir_path = alloc_printf("%s/.nyx_tmp_%d/", tmpdir, (u32)getpid());
+  char *nyx_out_dir_path =
+      alloc_printf("%s/.nyx_tmp_%d/", tmpdir, (u32)getpid());
 
-  if (mkdir(nyx_out_dir_path, 0700)) { 
-    PFATAL("Unable to create nyx workdir"); 
-  }
+  if (mkdir(nyx_out_dir_path, 0700)) { PFATAL("Unable to create nyx workdir"); }
 
   return nyx_out_dir_path;
+
 }
 
 /* Vice versa, we remove the tmp workdir for nyx with this helper function. */
-void remove_nyx_tmp_workdir(afl_forkserver_t *fsrv, char* nyx_out_dir_path) {
-  char* workdir_path = alloc_printf("%s/workdir", nyx_out_dir_path);
+void remove_nyx_tmp_workdir(afl_forkserver_t *fsrv, char *nyx_out_dir_path) {
+
+  char *workdir_path = alloc_printf("%s/workdir", nyx_out_dir_path);
 
   if (access(workdir_path, R_OK) == 0) {
-    if(fsrv->nyx_handlers->nyx_remove_work_dir(workdir_path) != true) {
+
+    if (fsrv->nyx_handlers->nyx_remove_work_dir(workdir_path) != true) {
+
       WARNF("Unable to remove nyx workdir (%s)", workdir_path);
+
     }
+
   }
 
   if (rmdir(nyx_out_dir_path)) {
+
     WARNF("Unable to remove nyx workdir (%s)", nyx_out_dir_path);
+
   }
 
   ck_free(workdir_path);
   ck_free(nyx_out_dir_path);
+
 }
+
 #endif
+
diff --git a/src/afl-forkserver.c b/src/afl-forkserver.c
index fd4e213d..aa8c8622 100644
--- a/src/afl-forkserver.c
+++ b/src/afl-forkserver.c
@@ -50,7 +50,7 @@
 #include <sys/stat.h>
 
 #ifdef __linux__
-#include <dlfcn.h>
+  #include <dlfcn.h>
 
 /* function to load nyx_helper function from libnyx.so */
 
@@ -66,22 +66,32 @@ nyx_plugin_handler_t *afl_load_libnyx_plugin(u8 *libnyx_binary) {
   plugin->nyx_config_load = dlsym(handle, "nyx_config_load");
   if (plugin->nyx_config_load == NULL) { goto fail; }
 
-  plugin->nyx_config_set_workdir_path = dlsym(handle, "nyx_config_set_workdir_path");
+  plugin->nyx_config_set_workdir_path =
+      dlsym(handle, "nyx_config_set_workdir_path");
   if (plugin->nyx_config_set_workdir_path == NULL) { goto fail; }
 
-  plugin->nyx_config_set_input_buffer_size = dlsym(handle, "nyx_config_set_input_buffer_size");
+  plugin->nyx_config_set_input_buffer_size =
+      dlsym(handle, "nyx_config_set_input_buffer_size");
   if (plugin->nyx_config_set_input_buffer_size == NULL) { goto fail; }
 
-  plugin->nyx_config_set_input_buffer_write_protection = dlsym(handle, "nyx_config_set_input_buffer_write_protection");
-  if (plugin->nyx_config_set_input_buffer_write_protection == NULL) { goto fail; }
+  plugin->nyx_config_set_input_buffer_write_protection =
+      dlsym(handle, "nyx_config_set_input_buffer_write_protection");
+  if (plugin->nyx_config_set_input_buffer_write_protection == NULL) {
 
-  plugin->nyx_config_set_hprintf_fd = dlsym(handle, "nyx_config_set_hprintf_fd");
+    goto fail;
+
+  }
+
+  plugin->nyx_config_set_hprintf_fd =
+      dlsym(handle, "nyx_config_set_hprintf_fd");
   if (plugin->nyx_config_set_hprintf_fd == NULL) { goto fail; }
 
-  plugin->nyx_config_set_process_role = dlsym(handle, "nyx_config_set_process_role");
+  plugin->nyx_config_set_process_role =
+      dlsym(handle, "nyx_config_set_process_role");
   if (plugin->nyx_config_set_process_role == NULL) { goto fail; }
 
-  plugin->nyx_config_set_reuse_snapshot_path = dlsym(handle, "nyx_config_set_reuse_snapshot_path");
+  plugin->nyx_config_set_reuse_snapshot_path =
+      dlsym(handle, "nyx_config_set_reuse_snapshot_path");
   if (plugin->nyx_config_set_reuse_snapshot_path == NULL) { goto fail; }
 
   plugin->nyx_new = dlsym(handle, "nyx_new");
@@ -119,7 +129,6 @@ nyx_plugin_handler_t *afl_load_libnyx_plugin(u8 *libnyx_binary) {
   plugin->nyx_remove_work_dir = dlsym(handle, "nyx_remove_work_dir");
   if (plugin->nyx_remove_work_dir == NULL) { goto fail; }
 
-
   OKF("libnyx plugin is ready!");
   return plugin;
 
@@ -131,33 +140,40 @@ fail:
 
 }
 
-void afl_nyx_runner_kill(afl_forkserver_t *fsrv){
+void afl_nyx_runner_kill(afl_forkserver_t *fsrv) {
+
   if (fsrv->nyx_mode) {
 
-    if (fsrv->nyx_aux_string){
-      ck_free(fsrv->nyx_aux_string);
-    }
+    if (fsrv->nyx_aux_string) { ck_free(fsrv->nyx_aux_string); }
 
     /* check if we actually got a valid nyx runner */
     if (fsrv->nyx_runner) {
+
       fsrv->nyx_handlers->nyx_shutdown(fsrv->nyx_runner);
+
     }
 
     /* if we have use a tmp work dir we need to remove it */
     if (fsrv->nyx_use_tmp_workdir && fsrv->nyx_tmp_workdir_path) {
+
       remove_nyx_tmp_workdir(fsrv, fsrv->nyx_tmp_workdir_path);
+
     }
+
   }
+
 }
 
-/* Wrapper for FATAL() that kills the nyx runner (and removes all created tmp
- * files) before exiting. Used before "afl_fsrv_killall()" is registered as
- * an atexit() handler. */
-#define NYX_PRE_FATAL(fsrv, x...) \
-  do {                     \
-    afl_nyx_runner_kill(fsrv); \
-    FATAL(x);            \
-  } while (0)
+  /* Wrapper for FATAL() that kills the nyx runner (and removes all created tmp
+   * files) before exiting. Used before "afl_fsrv_killall()" is registered as
+   * an atexit() handler. */
+  #define NYX_PRE_FATAL(fsrv, x...) \
+    do {                            \
+                                    \
+      afl_nyx_runner_kill(fsrv);    \
+      FATAL(x);                     \
+                                    \
+    } while (0)
 
 #endif
 
@@ -511,70 +527,116 @@ void afl_fsrv_start(afl_forkserver_t *fsrv, char **argv,
 
     if (!be_quiet) { ACTF("Spinning up the NYX backend..."); }
 
-    if (fsrv->nyx_use_tmp_workdir){
+    if (fsrv->nyx_use_tmp_workdir) {
+
       fsrv->nyx_tmp_workdir_path = create_nyx_tmp_workdir();
       fsrv->out_dir_path = fsrv->nyx_tmp_workdir_path;
+
     } else {
-      if (fsrv->out_dir_path == NULL) { NYX_PRE_FATAL(fsrv, "Nyx workdir path not found..."); }
+
+      if (fsrv->out_dir_path == NULL) {
+
+        NYX_PRE_FATAL(fsrv, "Nyx workdir path not found...");
+
+      }
+
     }
 
     /* libnyx expects an absolute path */
-    char* outdir_path_absolute = realpath(fsrv->out_dir_path, NULL);
-    if (outdir_path_absolute == NULL) { NYX_PRE_FATAL(fsrv, "Nyx workdir path cannot be resolved ..."); }
+    char *outdir_path_absolute = realpath(fsrv->out_dir_path, NULL);
+    if (outdir_path_absolute == NULL) {
+
+      NYX_PRE_FATAL(fsrv, "Nyx workdir path cannot be resolved ...");
+
+    }
 
     char *workdir_path = alloc_printf("%s/workdir", outdir_path_absolute);
 
-    if (fsrv->nyx_id == 0xFFFFFFFF) {NYX_PRE_FATAL(fsrv, "Nyx ID is not set..."); }
+    if (fsrv->nyx_id == 0xFFFFFFFF) {
+
+      NYX_PRE_FATAL(fsrv, "Nyx ID is not set...");
+
+    }
 
     if (fsrv->nyx_bind_cpu_id == 0xFFFFFFFF) {
+
       NYX_PRE_FATAL(fsrv, "Nyx CPU ID is not set...");
+
     }
 
-    void* nyx_config = fsrv->nyx_handlers->nyx_config_load(fsrv->target_path);
+    void *nyx_config = fsrv->nyx_handlers->nyx_config_load(fsrv->target_path);
 
     fsrv->nyx_handlers->nyx_config_set_workdir_path(nyx_config, workdir_path);
     fsrv->nyx_handlers->nyx_config_set_input_buffer_size(nyx_config, MAX_FILE);
-    fsrv->nyx_handlers->nyx_config_set_input_buffer_write_protection(nyx_config, true);
+    fsrv->nyx_handlers->nyx_config_set_input_buffer_write_protection(nyx_config,
+                                                                     true);
 
     if (fsrv->nyx_standalone) {
+
       fsrv->nyx_handlers->nyx_config_set_process_role(nyx_config, StandAlone);
+
     } else {
+
       if (fsrv->nyx_parent) {
+
         fsrv->nyx_handlers->nyx_config_set_process_role(nyx_config, Parent);
+
       } else {
+
         fsrv->nyx_handlers->nyx_config_set_process_role(nyx_config, Child);
+
       }
+
     }
 
-    if (getenv("NYX_REUSE_SNAPSHOT") != NULL){
+    if (getenv("NYX_REUSE_SNAPSHOT") != NULL) {
 
       if (access(getenv("NYX_REUSE_SNAPSHOT"), F_OK) == -1) {
+
         NYX_PRE_FATAL(fsrv, "NYX_REUSE_SNAPSHOT path does not exist");
+
       }
 
-      /* stupid sanity check to avoid passing an empty or invalid snapshot directory */
-      char* snapshot_file_path = alloc_printf("%s/global.state", getenv("NYX_REUSE_SNAPSHOT"));
+      /* stupid sanity check to avoid passing an empty or invalid snapshot
+       * directory */
+      char *snapshot_file_path =
+          alloc_printf("%s/global.state", getenv("NYX_REUSE_SNAPSHOT"));
       if (access(snapshot_file_path, R_OK) == -1) {
-        NYX_PRE_FATAL(fsrv, "NYX_REUSE_SNAPSHOT path does not contain a valid Nyx snapshot");
+
+        NYX_PRE_FATAL(
+            fsrv,
+            "NYX_REUSE_SNAPSHOT path does not contain a valid Nyx snapshot");
+
       }
+
       ck_free(snapshot_file_path);
 
       /* another sanity check to avoid passing a snapshot directory that is
-       * located in the current workdir (the workdir will be wiped by libnyx on startup) */
-      char* workdir_snapshot_path = alloc_printf("%s/workdir/snapshot", outdir_path_absolute);
-      char* reuse_snapshot_path_real = realpath(getenv("NYX_REUSE_SNAPSHOT"), NULL);
+       * located in the current workdir (the workdir will be wiped by libnyx on
+       * startup) */
+      char *workdir_snapshot_path =
+          alloc_printf("%s/workdir/snapshot", outdir_path_absolute);
+      char *reuse_snapshot_path_real =
+          realpath(getenv("NYX_REUSE_SNAPSHOT"), NULL);
+
+      if (strcmp(workdir_snapshot_path, reuse_snapshot_path_real) == 0) {
+
+        NYX_PRE_FATAL(fsrv,
+                      "NYX_REUSE_SNAPSHOT path is located in current workdir "
+                      "(use another output directory)");
 
-      if (strcmp(workdir_snapshot_path, reuse_snapshot_path_real) == 0){
-        NYX_PRE_FATAL(fsrv, "NYX_REUSE_SNAPSHOT path is located in current workdir (use another output directory)");
       }
 
       ck_free(reuse_snapshot_path_real);
       ck_free(workdir_snapshot_path);
 
-      fsrv->nyx_handlers->nyx_config_set_reuse_snapshot_path(nyx_config, getenv("NYX_REUSE_SNAPSHOT"));
+      fsrv->nyx_handlers->nyx_config_set_reuse_snapshot_path(
+          nyx_config, getenv("NYX_REUSE_SNAPSHOT"));
+
     }
 
-    fsrv->nyx_runner = fsrv->nyx_handlers->nyx_new(nyx_config, fsrv->nyx_bind_cpu_id);
+    fsrv->nyx_runner =
+        fsrv->nyx_handlers->nyx_new(nyx_config, fsrv->nyx_bind_cpu_id);
 
     ck_free(workdir_path);
     ck_free(outdir_path_absolute);
@@ -621,7 +683,8 @@ void afl_fsrv_start(afl_forkserver_t *fsrv, char **argv,
     /* autodict in Nyx mode */
     if (!ignore_autodict) {
 
-      char* x = alloc_printf("%s/workdir/dump/afl_autodict.txt", fsrv->out_dir_path);
+      char *x =
+          alloc_printf("%s/workdir/dump/afl_autodict.txt", fsrv->out_dir_path);
       int nyx_autodict_fd = open(x, O_RDONLY);
       ck_free(x);
 
@@ -634,8 +697,9 @@ void afl_fsrv_start(afl_forkserver_t *fsrv, char **argv,
           u8 *dict = ck_alloc(f_len);
           if (dict == NULL) {
 
-            NYX_PRE_FATAL(fsrv, "Could not allocate %u bytes of autodictionary memory",
-                  f_len);
+            NYX_PRE_FATAL(
+                fsrv, "Could not allocate %u bytes of autodictionary memory",
+                f_len);
 
           }
 
@@ -652,7 +716,8 @@ void afl_fsrv_start(afl_forkserver_t *fsrv, char **argv,
 
             } else {
 
-              NYX_PRE_FATAL(fsrv, 
+              NYX_PRE_FATAL(
+                  fsrv,
                   "Reading autodictionary fail at position %u with %u bytes "
                   "left.",
                   offset, len);
diff --git a/src/afl-showmap.c b/src/afl-showmap.c
index 832730fd..df030672 100644
--- a/src/afl-showmap.c
+++ b/src/afl-showmap.c
@@ -444,8 +444,11 @@ static void showmap_run_target_nyx_mode(afl_forkserver_t *fsrv) {
       FSRV_RUN_ERROR) {
 
     FATAL("Error running target in Nyx mode");
+
   }
+
 }
+
 #endif
 
 /* Execute target application. */
@@ -890,7 +893,7 @@ int main(int argc, char **argv_orig, char **envp) {
 
   if (getenv("AFL_QUIET") != NULL) { be_quiet = true; }
 
-  while ((opt = getopt(argc, argv, "+i:o:f:m:t:AeqCZOH:QUWbcrshX")) > 0) {
+  while ((opt = getopt(argc, argv, "+i:o:f:m:t:AeqCZOH:QUWbcrshXY")) > 0) {
 
     switch (opt) {
 
@@ -1078,7 +1081,8 @@ int main(int argc, char **argv_orig, char **envp) {
 
         break;
 
-  #ifdef __linux__
+      case 'Y':  // fallthough
+#ifdef __linux__
       case 'X':                                                 /* NYX mode */
 
         if (fsrv->nyx_mode) { FATAL("Multiple -X options not supported"); }
@@ -1088,11 +1092,11 @@ int main(int argc, char **argv_orig, char **envp) {
         fsrv->nyx_standalone = true;
 
         break;
-  #else
+#else
       case 'X':
         FATAL("Nyx mode is only availabe on linux...");
         break;
-  #endif
+#endif
 
       case 'b':
 
@@ -1166,12 +1170,16 @@ int main(int argc, char **argv_orig, char **envp) {
   set_up_environment(fsrv, argv);
 
 #ifdef __linux__
-  if(!fsrv->nyx_mode){
+  if (!fsrv->nyx_mode) {
+
     fsrv->target_path = find_binary(argv[optind]);
-  }
-  else{
+
+  } else {
+
     fsrv->target_path = ck_strdup(argv[optind]);
+
   }
+
 #else
   fsrv->target_path = find_binary(argv[optind]);
 #endif
@@ -1232,11 +1240,12 @@ int main(int argc, char **argv_orig, char **envp) {
         get_cs_argv(argv[0], &fsrv->target_path, argc - optind, argv + optind);
 
 #ifdef __linux__
+
   } else if (fsrv->nyx_mode) {
 
     use_argv = ck_alloc(sizeof(char *) * (1));
     use_argv[0] = argv[0];
-    
+
     fsrv->nyx_id = 0;
 
     u8 *libnyx_binary = find_afl_binary(use_argv[0], "libnyx.so");
@@ -1288,9 +1297,12 @@ int main(int argc, char **argv_orig, char **envp) {
   }
 
 #ifdef __linux__
-  if(!fsrv->nyx_mode && in_dir){
+  if (!fsrv->nyx_mode && in_dir) {
+
     (void)check_binary_signatures(fsrv->target_path);
+
   }
+
 #else
   if (in_dir) { (void)check_binary_signatures(fsrv->target_path); }
 #endif
@@ -1313,14 +1325,14 @@ int main(int argc, char **argv_orig, char **envp) {
   fsrv->shmem_fuzz_len = (u32 *)map;
   fsrv->shmem_fuzz = map + sizeof(u32);
 
-  configure_afl_kill_signals(
-      fsrv, NULL, NULL, (fsrv->qemu_mode || unicorn_mode 
-  #ifdef __linux__
-        || fsrv->nyx_mode
-  #endif
-        )
-            ? SIGKILL
-            : SIGTERM);
+  configure_afl_kill_signals(fsrv, NULL, NULL,
+                             (fsrv->qemu_mode || unicorn_mode
+#ifdef __linux__
+                              || fsrv->nyx_mode
+#endif
+                              )
+                                 ? SIGKILL
+                                 : SIGTERM);
 
   if (!fsrv->cs_mode && !fsrv->qemu_mode && !unicorn_mode) {
 
@@ -1464,13 +1476,18 @@ int main(int argc, char **argv_orig, char **envp) {
       shm_fuzz = deinit_shmem(fsrv, shm_fuzz);
 
 #ifdef __linux__
-    if(!fsrv->nyx_mode){
+    if (!fsrv->nyx_mode) {
+
 #endif
       showmap_run_target(fsrv, use_argv);
 #ifdef __linux__
+
     } else {
+
       showmap_run_target_nyx_mode(fsrv);
+
     }
+
 #endif
     tcnt = write_results_to_file(fsrv, out_file);
     if (!quiet_mode) {
@@ -1522,7 +1539,6 @@ int main(int argc, char **argv_orig, char **envp) {
 
   if (fsrv->target_path) { ck_free(fsrv->target_path); }
 
-
   afl_fsrv_deinit(fsrv);
 
   if (stdin_file) { ck_free(stdin_file); }
diff --git a/src/afl-tmin.c b/src/afl-tmin.c
index 98403049..e7442d1d 100644
--- a/src/afl-tmin.c
+++ b/src/afl-tmin.c
@@ -846,7 +846,7 @@ int main(int argc, char **argv_orig, char **envp) {
 
   SAYF(cCYA "afl-tmin" VERSION cRST " by Michal Zalewski\n");
 
-  while ((opt = getopt(argc, argv, "+i:o:f:m:t:B:xeAOQUWXHh")) > 0) {
+  while ((opt = getopt(argc, argv, "+i:o:f:m:t:B:xeAOQUWXYHh")) > 0) {
 
     switch (opt) {
 
@@ -1004,7 +1004,8 @@ int main(int argc, char **argv_orig, char **envp) {
 
         break;
 
-  #ifdef __linux__
+      case 'Y':  // fallthough
+#ifdef __linux__
       case 'X':                                                 /* NYX mode */
 
         if (fsrv->nyx_mode) { FATAL("Multiple -X options not supported"); }
@@ -1014,11 +1015,11 @@ int main(int argc, char **argv_orig, char **envp) {
         fsrv->nyx_standalone = true;
 
         break;
-  #else
+#else
       case 'X':
         FATAL("Nyx mode is only availabe on linux...");
         break;
-  #endif
+#endif
 
       case 'H':                                                /* Hang Mode */
 
@@ -1086,12 +1087,16 @@ int main(int argc, char **argv_orig, char **envp) {
   set_up_environment(fsrv, argv);
 
 #ifdef __linux__
-  if(!fsrv->nyx_mode){
+  if (!fsrv->nyx_mode) {
+
     fsrv->target_path = find_binary(argv[optind]);
-  }
-  else{
+
+  } else {
+
     fsrv->target_path = ck_strdup(argv[optind]);
+
   }
+
 #else
   fsrv->target_path = find_binary(argv[optind]);
 #endif
@@ -1120,6 +1125,7 @@ int main(int argc, char **argv_orig, char **envp) {
         get_cs_argv(argv[0], &fsrv->target_path, argc - optind, argv + optind);
 
 #ifdef __linux__
+
   } else if (fsrv->nyx_mode) {
 
     fsrv->nyx_id = 0;
@@ -1127,7 +1133,9 @@ int main(int argc, char **argv_orig, char **envp) {
     u8 *libnyx_binary = find_afl_binary(argv[0], "libnyx.so");
     fsrv->nyx_handlers = afl_load_libnyx_plugin(libnyx_binary);
     if (fsrv->nyx_handlers == NULL) {
+
       FATAL("failed to initialize libnyx.so...");
+
     }
 
     fsrv->nyx_use_tmp_workdir = true;
@@ -1207,9 +1215,7 @@ int main(int argc, char **argv_orig, char **envp) {
   read_initial_file();
 
 #ifdef __linux__
-  if(!fsrv->nyx_mode){
-    (void)check_binary_signatures(fsrv->target_path);
-  }
+  if (!fsrv->nyx_mode) { (void)check_binary_signatures(fsrv->target_path); }
 #else
   (void)check_binary_signatures(fsrv->target_path);
 #endif
@@ -1316,7 +1322,6 @@ int main(int argc, char **argv_orig, char **envp) {
 
   OKF("We're done here. Have a nice day!\n");
 
-
   remove_shm = 0;
   afl_shm_deinit(&shm);
   if (fsrv->use_shmem_fuzz) shm_fuzz = deinit_shmem(fsrv, shm_fuzz);