diff options
author | Jasper Lievisse Adriaanse <j@jasper.la> | 2023-11-09 10:08:38 +0000 |
---|---|---|
committer | Jasper Lievisse Adriaanse <j@jasper.la> | 2023-11-09 10:15:14 +0000 |
commit | cfbf1209b532fcaa7d6817d9aac0f161c6819849 (patch) | |
tree | f80e8a8033181d0e5c03d806e71408b16a7dd125 | |
parent | 85c5b5218c6a7b2289f309fbd1625a5d0a602a00 (diff) | |
download | afl++-cfbf1209b532fcaa7d6817d9aac0f161c6819849.tar.gz |
Use direct call to write to OpenBSD
The linker on OpenBSD emits a warning when linking this file: warning: syscall() may go away, please rewrite code to use direct calls
-rw-r--r-- | instrumentation/afl-compiler-rt.o.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/instrumentation/afl-compiler-rt.o.c b/instrumentation/afl-compiler-rt.o.c index c3197c8a..4d7b1229 100644 --- a/instrumentation/afl-compiler-rt.o.c +++ b/instrumentation/afl-compiler-rt.o.c @@ -48,7 +48,7 @@ #include <errno.h> #include <sys/mman.h> -#ifndef __HAIKU__ +#if !defined(__HAIKU__) && !defined(__OpenBSD__) #include <sys/syscall.h> #endif #ifndef USEMMAP @@ -2253,11 +2253,13 @@ static int area_is_valid(void *ptr, size_t len) { if (unlikely(!ptr || __asan_region_is_poisoned(ptr, len))) { return 0; } -#ifndef __HAIKU__ - long r = syscall(SYS_write, __afl_dummy_fd[1], ptr, len); -#else +#ifdef __HAIKU__ long r = _kern_write(__afl_dummy_fd[1], -1, ptr, len); -#endif // HAIKU +#elif defined(__OpenBSD__) + long r = write(__afl_dummy_fd[1], ptr, len); +#else + long r = syscall(SYS_write, __afl_dummy_fd[1], ptr, len); +#endif // HAIKU, OPENBSD if (r <= 0 || r > len) return 0; |