mirror of
https://github.com/AFLplusplus/AFLplusplus.git
synced 2025-06-12 10:08:07 +00:00
Porting to Haiku.
getrusage does not implement resident memory gathering, no shm api neither.
This commit is contained in:
@ -119,6 +119,13 @@ ifeq "$(shell uname -s)" "NetBSD"
|
|||||||
LDFLAGS += -L /usr/pkg/lib/
|
LDFLAGS += -L /usr/pkg/lib/
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq "$(shell uname -s)" "Haiku"
|
||||||
|
SHMAT_OK=0
|
||||||
|
override CFLAGS += -DUSEMMAP=1 -Wno-error=format -fpic
|
||||||
|
LDFLAGS+=-Wno-deprecated-declarations -lgnu
|
||||||
|
SPECIAL_PERFORMANCE += -DUSEMMAP=1
|
||||||
|
endif
|
||||||
|
|
||||||
AFL_FUZZ_FILES = $(wildcard src/afl-fuzz*.c)
|
AFL_FUZZ_FILES = $(wildcard src/afl-fuzz*.c)
|
||||||
|
|
||||||
ifneq "$(shell command -v python3m 2>/dev/null)" ""
|
ifneq "$(shell command -v python3m 2>/dev/null)" ""
|
||||||
|
@ -61,12 +61,14 @@ ifeq "$(shell echo '$(HASH)include <sys/ipc.h>@$(HASH)include <sys/shm.h>@int ma
|
|||||||
else
|
else
|
||||||
SHMAT_OK=0
|
SHMAT_OK=0
|
||||||
CFLAGS+=-DUSEMMAP=1
|
CFLAGS+=-DUSEMMAP=1
|
||||||
LDFLAGS += -lrt
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq "$(TEST_MMAP)" "1"
|
ifeq "$(TEST_MMAP)" "1"
|
||||||
SHMAT_OK=0
|
SHMAT_OK=0
|
||||||
CFLAGS+=-DUSEMMAP=1
|
CFLAGS+=-DUSEMMAP=1
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifneq "$(shell uname -s)" "Haiku"
|
||||||
LDFLAGS += -lrt
|
LDFLAGS += -lrt
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -231,7 +231,7 @@ static void edit_params(u32 argc, char **argv) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USEMMAP
|
#if defined(USEMMAP) && !defined(__HAIKU__)
|
||||||
cc_params[cc_par_cnt++] = "-lrt";
|
cc_params[cc_par_cnt++] = "-lrt";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -35,7 +35,9 @@
|
|||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
|
#ifndef USEMMAP
|
||||||
#include <sys/shm.h>
|
#include <sys/shm.h>
|
||||||
|
#endif
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
@ -66,7 +66,9 @@
|
|||||||
|
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
#ifndef USEMMAP
|
||||||
#include <sys/shm.h>
|
#include <sys/shm.h>
|
||||||
|
#endif
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/resource.h>
|
#include <sys/resource.h>
|
||||||
|
@ -196,7 +196,7 @@ ifeq "$(shell echo 'int main() {return 0; }' | $(CLANG_BIN) -x c - -fuse-ld=`com
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
CFLAGS ?= -O3 -funroll-loops -D_FORTIFY_SOURCE=2
|
CFLAGS ?= -O3 -funroll-loops -fpic -D_FORTIFY_SOURCE=2
|
||||||
override CFLAGS += -Wall \
|
override CFLAGS += -Wall \
|
||||||
-g -Wno-pointer-sign -I ../include/ \
|
-g -Wno-pointer-sign -I ../include/ \
|
||||||
-DAFL_PATH=\"$(HELPER_PATH)\" -DBIN_PATH=\"$(BIN_PATH)\" \
|
-DAFL_PATH=\"$(HELPER_PATH)\" -DBIN_PATH=\"$(BIN_PATH)\" \
|
||||||
@ -209,7 +209,7 @@ ifdef AFL_TRACE_PC
|
|||||||
$(info Compile option AFL_TRACE_PC is deprecated, just set AFL_LLVM_INSTRUMENT=PCGUARD to activate when compiling targets )
|
$(info Compile option AFL_TRACE_PC is deprecated, just set AFL_LLVM_INSTRUMENT=PCGUARD to activate when compiling targets )
|
||||||
endif
|
endif
|
||||||
|
|
||||||
CXXFLAGS ?= -O3 -funroll-loops -D_FORTIFY_SOURCE=2
|
CXXFLAGS ?= -O3 -funroll-loops -fpic -D_FORTIFY_SOURCE=2
|
||||||
override CXXFLAGS += -Wall -g -I ../include/ \
|
override CXXFLAGS += -Wall -g -I ../include/ \
|
||||||
-DVERSION=\"$(VERSION)\" -Wno-variadic-macros
|
-DVERSION=\"$(VERSION)\" -Wno-variadic-macros
|
||||||
|
|
||||||
|
@ -464,7 +464,7 @@ static void edit_params(u32 argc, char **argv, char **envp) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USEMMAP
|
#if defined(USEMMAP) && !defined(__HAIKU__)
|
||||||
cc_params[cc_par_cnt++] = "-lrt";
|
cc_params[cc_par_cnt++] = "-lrt";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -51,7 +51,9 @@
|
|||||||
|
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
#ifndef USEMMAP
|
||||||
#include <sys/shm.h>
|
#include <sys/shm.h>
|
||||||
|
#endif
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/resource.h>
|
#include <sys/resource.h>
|
||||||
|
@ -31,7 +31,9 @@
|
|||||||
void write_stats_file(afl_state_t *afl, double bitmap_cvg, double stability,
|
void write_stats_file(afl_state_t *afl, double bitmap_cvg, double stability,
|
||||||
double eps) {
|
double eps) {
|
||||||
|
|
||||||
|
#ifndef __HAIKU__
|
||||||
struct rusage rus;
|
struct rusage rus;
|
||||||
|
#endif
|
||||||
|
|
||||||
unsigned long long int cur_time = get_cur_time();
|
unsigned long long int cur_time = get_cur_time();
|
||||||
u8 fn[PATH_MAX];
|
u8 fn[PATH_MAX];
|
||||||
@ -65,7 +67,9 @@ void write_stats_file(afl_state_t *afl, double bitmap_cvg, double stability,
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef __HAIKU__
|
||||||
if (getrusage(RUSAGE_CHILDREN, &rus)) { rus.ru_maxrss = 0; }
|
if (getrusage(RUSAGE_CHILDREN, &rus)) { rus.ru_maxrss = 0; }
|
||||||
|
#endif
|
||||||
|
|
||||||
fprintf(
|
fprintf(
|
||||||
f,
|
f,
|
||||||
@ -119,11 +123,15 @@ void write_stats_file(afl_state_t *afl, double bitmap_cvg, double stability,
|
|||||||
afl->last_path_time / 1000, afl->last_crash_time / 1000,
|
afl->last_path_time / 1000, afl->last_crash_time / 1000,
|
||||||
afl->last_hang_time / 1000, afl->fsrv.total_execs - afl->last_crash_execs,
|
afl->last_hang_time / 1000, afl->fsrv.total_execs - afl->last_crash_execs,
|
||||||
afl->fsrv.exec_tmout, afl->slowest_exec_ms,
|
afl->fsrv.exec_tmout, afl->slowest_exec_ms,
|
||||||
|
#ifndef __HAIKU__
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
(unsigned long int)(rus.ru_maxrss >> 20),
|
(unsigned long int)(rus.ru_maxrss >> 20),
|
||||||
#else
|
#else
|
||||||
(unsigned long int)(rus.ru_maxrss >> 10),
|
(unsigned long int)(rus.ru_maxrss >> 10),
|
||||||
#endif
|
#endif
|
||||||
|
#else
|
||||||
|
-1UL,
|
||||||
|
#endif
|
||||||
#ifdef HAVE_AFFINITY
|
#ifdef HAVE_AFFINITY
|
||||||
afl->cpu_aff,
|
afl->cpu_aff,
|
||||||
#else
|
#else
|
||||||
|
@ -335,7 +335,7 @@ static void edit_params(u32 argc, char **argv) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USEMMAP
|
#if defined(USEMMAP) && !defined(__HAIKU__)
|
||||||
cc_params[cc_par_cnt++] = "-lrt";
|
cc_params[cc_par_cnt++] = "-lrt";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -145,7 +145,7 @@ u8 *afl_shm_init(sharedmem_t *shm, size_t map_size,
|
|||||||
|
|
||||||
if (!non_instrumented_mode) setenv(SHM_ENV_VAR, shm->g_shm_file_path, 1);
|
if (!non_instrumented_mode) setenv(SHM_ENV_VAR, shm->g_shm_file_path, 1);
|
||||||
|
|
||||||
if (shm->map == -1 || !shm->map) PFATAL("mmap() failed");
|
if (shm->map == (void *)-1 || !shm->map) PFATAL("mmap() failed");
|
||||||
|
|
||||||
#else
|
#else
|
||||||
u8 *shm_str;
|
u8 *shm_str;
|
||||||
|
@ -56,7 +56,9 @@
|
|||||||
|
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
#ifndef USEMMAP
|
||||||
#include <sys/shm.h>
|
#include <sys/shm.h>
|
||||||
|
#endif
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/resource.h>
|
#include <sys/resource.h>
|
||||||
|
@ -54,7 +54,9 @@
|
|||||||
|
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
#ifndef USEMMAP
|
||||||
#include <sys/shm.h>
|
#include <sys/shm.h>
|
||||||
|
#endif
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/resource.h>
|
#include <sys/resource.h>
|
||||||
|
9
src/third_party/libradamsa/libradamsa.c
vendored
9
src/third_party/libradamsa/libradamsa.c
vendored
@ -2413,9 +2413,12 @@ static word prim_sys(word op, word a, word b, word c) {
|
|||||||
#endif
|
#endif
|
||||||
O_DSYNC, O_EXCL,
|
O_DSYNC, O_EXCL,
|
||||||
O_NOCTTY, O_NOFOLLOW, O_NONBLOCK, O_RSYNC, O_SYNC, O_TRUNC, O_TTY_INIT, O_ACCMODE,
|
O_NOCTTY, O_NOFOLLOW, O_NONBLOCK, O_RSYNC, O_SYNC, O_TRUNC, O_TTY_INIT, O_ACCMODE,
|
||||||
FD_CLOEXEC, F_DUPFD, F_DUPFD_CLOEXEC, F_GETFD, F_SETFD, F_GETFL, F_SETFL, F_GETOWN,
|
FD_CLOEXEC, F_DUPFD, F_DUPFD_CLOEXEC, F_GETFD, F_SETFD, F_GETFL, F_SETFL,
|
||||||
F_SETOWN, F_GETLK, F_SETLK, F_SETLKW, F_RDLCK, F_UNLCK, F_WRLCK, CLOCK_MONOTONIC,
|
F_GETLK, F_SETLK, F_SETLKW, F_RDLCK, F_UNLCK, F_WRLCK, CLOCK_MONOTONIC,
|
||||||
CLOCK_PROCESS_CPUTIME_ID, CLOCK_REALTIME, CLOCK_THREAD_CPUTIME_ID
|
CLOCK_PROCESS_CPUTIME_ID, CLOCK_REALTIME, CLOCK_THREAD_CPUTIME_ID,
|
||||||
|
#if !defined __HAIKU__
|
||||||
|
F_GETOWN, F_SETOWN
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
return onum(sysconst[immval(a) % (sizeof sysconst / W)], 0); }
|
return onum(sysconst[immval(a) % (sizeof sysconst / W)], 0); }
|
||||||
case 9: /* return process variables */
|
case 9: /* return process variables */
|
||||||
|
Reference in New Issue
Block a user