aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrea Fioraldi <andreafioraldi@gmail.com>2020-01-31 18:49:26 +0100
committerAndrea Fioraldi <andreafioraldi@gmail.com>2020-01-31 18:49:26 +0100
commitf2511a39ae795469d661a8d1a6347ca281e2b80f (patch)
tree48ee1fb0d7d54af8f2f9d92d1d9a9eee65efdedf /src
parentf5d46187023b23beff9797e8b461a9a041db3e9f (diff)
parent4094dcdf888b03144bf918eb1ca2f9ad50764bc8 (diff)
downloadafl++-f2511a39ae795469d661a8d1a6347ca281e2b80f.tar.gz
Merge branch 'master' of github.com:vanhauser-thc/AFLplusplus
Diffstat (limited to 'src')
-rw-r--r--src/afl-fuzz-init.c25
1 files changed, 21 insertions, 4 deletions
diff --git a/src/afl-fuzz-init.c b/src/afl-fuzz-init.c
index 6efa6227..33b89a89 100644
--- a/src/afl-fuzz-init.c
+++ b/src/afl-fuzz-init.c
@@ -237,15 +237,32 @@ void bind_to_free_cpu(void) {
}
#elif defined(__FreeBSD__) || defined(__DragonFly__)
- if (pthread_setaffinity_np(pthread_self(), sizeof(c), &c))
- PFATAL("pthread_setaffinity failed");
+ if (pthread_setaffinity_np(pthread_self(), sizeof(c), &c)) {
+
+ if (cpu_start == 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
+ ;
+
+ }
#elif defined(__NetBSD__)
-if (pthread_setaffinity_np(pthread_self(), cpuset_size(c), c))
- PFATAL("pthread_setaffinity failed");
+if (pthread_setaffinity_np(pthread_self(), cpuset_size(c), c)) {
+
+ if (cpu_start == 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);
#else
// this will need something for other platforms
+// TODO: Solaris/Illumos has processor_bind ... might worth a try
#endif
}