about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/afl-forkserver.c4
-rw-r--r--src/afl-fuzz-init.c56
-rw-r--r--src/afl-fuzz-stats.c2
-rw-r--r--src/afl-gotcpu.c3
4 files changed, 31 insertions, 34 deletions
diff --git a/src/afl-forkserver.c b/src/afl-forkserver.c
index a549e471..330fb1de 100644
--- a/src/afl-forkserver.c
+++ b/src/afl-forkserver.c
@@ -837,8 +837,8 @@ void afl_fsrv_write_to_testcase(afl_forkserver_t *fsrv, u8 *buf, size_t len) {
 
     *fsrv->shmem_fuzz_len = len;
     memcpy(fsrv->shmem_fuzz, buf, len);
-    // printf("test case len: %u [0]:0x%02x\n", *fsrv->shmem_fuzz_len, buf[0]);
-    // fflush(stdout);
+    // fprintf(stderr, "FS crc: %08x len: %u\n", hash32(fsrv->shmem_fuzz,
+    // *fsrv->shmem_fuzz_len, 0xa5b35705), *fsrv->shmem_fuzz_len);
 
   } else {
 
diff --git a/src/afl-fuzz-init.c b/src/afl-fuzz-init.c
index 16980681..1245d94b 100644
--- a/src/afl-fuzz-init.c
+++ b/src/afl-fuzz-init.c
@@ -38,7 +38,7 @@ void bind_to_free_cpu(afl_state_t *afl) {
   #elif defined(__NetBSD__)
   cpuset_t *         c;
   #elif defined(__sun)
-  psetid_t c;
+  psetid_t            c;
   #endif
 
   u8  cpu_used[4096] = {0};
@@ -185,10 +185,10 @@ void bind_to_free_cpu(afl_state_t *afl) {
   ck_free(procs);
   #elif defined(__sun)
   kstat_named_t *n;
-  kstat_ctl_t *m;
-  kstat_t *k;
-  cpu_stat_t cs;
-  u32 ncpus;
+  kstat_ctl_t *  m;
+  kstat_t *      k;
+  cpu_stat_t     cs;
+  u32            ncpus;
 
   m = kstat_open();
 
@@ -213,10 +213,9 @@ void bind_to_free_cpu(afl_state_t *afl) {
   n = kstat_data_lookup(k, "ncpus");
   ncpus = n->value.i32;
 
-  if (ncpus > sizeof(cpu_used))
-	  ncpus = sizeof(cpu_used);
+  if (ncpus > sizeof(cpu_used)) ncpus = sizeof(cpu_used);
 
-  for (i = 0; i < ncpus; i ++) {
+  for (i = 0; i < ncpus; i++) {
 
     k = kstat_lookup(m, "cpu_stat", i, NULL);
     if (kstat_read(m, k, &cs)) {
@@ -226,8 +225,7 @@ void bind_to_free_cpu(afl_state_t *afl) {
 
     }
 
-    if (cs.cpu_sysinfo.cpu[CPU_IDLE] > 0)
-      continue;
+    if (cs.cpu_sysinfo.cpu[CPU_IDLE] > 0) continue;
 
     if (cs.cpu_sysinfo.cpu[CPU_USER] > 0 || cs.cpu_sysinfo.cpu[CPU_KERNEL] > 0)
       cpu_used[i] = 1;
@@ -283,8 +281,8 @@ void bind_to_free_cpu(afl_state_t *afl) {
   if (c == NULL) PFATAL("cpuset_create failed");
   cpuset_set(i, c);
   #elif defined(__sun)
-  pset_create(&c);
-  if (pset_assign(c, i, NULL)) PFATAL("pset_assign failed");
+pset_create(&c);
+if (pset_assign(c, i, NULL)) PFATAL("pset_assign failed");
   #endif
 
   #if defined(__linux__)
@@ -316,31 +314,31 @@ void bind_to_free_cpu(afl_state_t *afl) {
   }
 
   #elif defined(__NetBSD__)
-  if (pthread_setaffinity_np(pthread_self(), cpuset_size(c), c)) {
+if (pthread_setaffinity_np(pthread_self(), cpuset_size(c), c)) {
 
-    if (cpu_start == afl->cpu_core_count)
-      PFATAL("pthread_setaffinity failed for cpu %d, exit", i);
-    WARNF("pthread_setaffinity failed to CPU %d, trying next CPU", i);
-    cpu_start++;
-    goto try
+  if (cpu_start == afl->cpu_core_count)
+    PFATAL("pthread_setaffinity failed for cpu %d, exit", i);
+  WARNF("pthread_setaffinity failed to CPU %d, trying next CPU", i);
+  cpu_start++;
+  goto try
     ;
 
-  }
+}
 
-  cpuset_destroy(c);
+cpuset_destroy(c);
   #elif defined(__sun)
-  if (pset_bind(c, P_PID, getpid(), NULL)) {
+if (pset_bind(c, P_PID, getpid(), NULL)) {
 
-    if (cpu_start == afl->cpu_core_count)
-      PFATAL("pset_bind failed for cpu %d, exit", i);
-    WARNF("pthread_setaffinity failed to CPU %d, trying next CPU", i);
-    cpu_start++;
-    goto try
-      ;
+  if (cpu_start == afl->cpu_core_count)
+    PFATAL("pset_bind failed for cpu %d, exit", i);
+  WARNF("pthread_setaffinity failed to CPU %d, trying next CPU", i);
+  cpu_start++;
+  goto try
+    ;
 
-  }
+}
 
-  pset_destroy(c);
+pset_destroy(c);
   #else
   // this will need something for other platforms
   // TODO: Solaris/Illumos has processor_bind ... might worth a try
diff --git a/src/afl-fuzz-stats.c b/src/afl-fuzz-stats.c
index 4493f34d..5d2e5358 100644
--- a/src/afl-fuzz-stats.c
+++ b/src/afl-fuzz-stats.c
@@ -125,7 +125,7 @@ void write_stats_file(afl_state_t *afl, double bitmap_cvg, double stability,
       (unsigned long int)(rus.ru_maxrss >> 10),
 #endif
 #ifdef HAVE_AFFINITY
-      afl->cpu_aff, 
+      afl->cpu_aff,
 #else
       -1,
 #endif
diff --git a/src/afl-gotcpu.c b/src/afl-gotcpu.c
index bdf63e8f..bd0f7de6 100644
--- a/src/afl-gotcpu.c
+++ b/src/afl-gotcpu.c
@@ -204,8 +204,7 @@ int main(int argc, char **argv) {
   #endif
 
   #if defined(__sun)
-      if (pset_bind(c, P_PID, getpid(), NULL))
-        PFATAL("pset_bind failed");
+      if (pset_bind(c, P_PID, getpid(), NULL)) PFATAL("pset_bind failed");
 
       pset_destroy(c);
   #endif