aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Carlier <devnexen@gmail.com>2020-04-07 20:05:57 +0100
committerDavid Carlier <devnexen@gmail.com>2020-04-08 04:57:01 +0100
commit91dc7776ecc52ce92b2bc985d0fa86f84bf72586 (patch)
treee6bf264dbedd886126fc6e84a29eb9446e7fac24
parent452acf3a752f3ff360a5eebc526567cd3ba9a407 (diff)
downloadafl++-91dc7776ecc52ce92b2bc985d0fa86f84bf72586.tar.gz
Android build fix proposal.
LTO flag is recognised but however broken on Android (tested with armv7 arch). Thus giving the choice not to enable it. In fortify mode, open required O_CREAT or O_TMPFILE when mode is set.
-rw-r--r--GNUmakefile2
-rw-r--r--src/afl-fuzz-extras.c2
-rw-r--r--src/afl-showmap.c3
3 files changed, 5 insertions, 2 deletions
diff --git a/GNUmakefile b/GNUmakefile
index 25928210..0cbeaa81 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -36,6 +36,7 @@ SH_PROGS = afl-plot afl-cmin afl-cmin.bash afl-whatsup afl-system-config
MANPAGES=$(foreach p, $(PROGS) $(SH_PROGS), $(p).8) afl-as.8
ASAN_OPTIONS=detect_leaks=0
+ifeq "$(findstring android, $(shell $(CC) --version 2>/dev/null))" ""
ifeq "$(shell echo 'int main() {return 0; }' | $(CC) $(CFLAGS) -Werror -x c - -flto=full -o .test 2>/dev/null && echo 1 || echo 0 ; rm -f .test )" "1"
CFLAGS_FLTO ?= -flto=full
else
@@ -47,6 +48,7 @@ else
endif
endif
endif
+endif
ifneq "$(shell uname)" "Darwin"
ifeq "$(shell echo 'int main() {return 0; }' | $(CC) $(CFLAGS) -Werror -x c - -march=native -o .test 2>/dev/null && echo 1 || echo 0 ; rm -f .test )" "1"
diff --git a/src/afl-fuzz-extras.c b/src/afl-fuzz-extras.c
index 4dd1647c..16806934 100644
--- a/src/afl-fuzz-extras.c
+++ b/src/afl-fuzz-extras.c
@@ -451,7 +451,7 @@ void load_auto(afl_state_t *afl) {
u8 *fn = alloc_printf("%s/.state/auto_extras/auto_%06u", afl->in_dir, i);
s32 fd, len;
- fd = open(fn, O_RDONLY, 0600);
+ fd = open(fn, O_RDONLY);
if (fd < 0) {
diff --git a/src/afl-showmap.c b/src/afl-showmap.c
index f8a38c36..e4463dc4 100644
--- a/src/afl-showmap.c
+++ b/src/afl-showmap.c
@@ -154,7 +154,8 @@ static u32 write_results_to_file(afl_forkserver_t *fsrv, u8 *outfile) {
if (!strncmp(outfile, "/dev/", 5)) {
- fd = open(outfile, O_WRONLY, 0600);
+ fd = open(outfile, O_WRONLY);
+
if (fd < 0) PFATAL("Unable to open '%s'", fsrv->out_file);
} else if (!strcmp(outfile, "-")) {