google / google/honggfuzz

no coverage info on Android(build target with -fsanitize=address)

Open
#389 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
3.4k
Forks
539
PR merge metrics
No merged PRs in 30d

Description

I got same situation as https://github.com/google/honggfuzz/issues/342

I try to add `-fsanitize-coverage=trace-pc-guard,trace-cmp,trace-div,indirect-calls`, but I got many warnings:
```
WARNING: found 1 unrecognized flag(s):
detect_odr_violation
```
I checked [google's doc](https://developer.android.com/ndk/guides/asan) :
in `Application.mk` :
```
APP_STL := c++_shared # Or system, or none.
APP_CFLAGS := -fsanitize=address -fno-omit-frame-pointer
APP_LDFLAGS := -fsanitize=address
```

For each module in your `Android.mk`:
```
LOCAL_ARM_MODE := arm
```

---

so I modified my demo as follow:

```
LOCAL_PATH:= $(call my-dir)

include $(CLEAR_VARS)
LOCAL_PATH = .
LOCAL_MODULE := hfuzz
LOCAL_EXPORT_C_INCLUDES := $HOME/honggfuzz/includes
LOCAL_SRC_FILES := /home/user/honggfuzz/libs/arm64-v8a/libhfuzz.a
LOCAL_ARM_MODE := arm
include $(PREBUILT_STATIC_LIBRARY)

include $(CLEAR_VARS)
LOCAL_PATH = .
LOCAL_MODULE := hfuzzcommon
LOCAL_EXPORT_C_INCLUDES := $HOME/honggfuzz/includes
LOCAL_SRC_FILES := /home/user/honggfuzz/obj/local/arm64-v8a/libcommon.a
LOCAL_ARM_MODE := arm
include $(PREBUILT_STATIC_LIBRARY)

include $(CLEAR_VARS)
LOCAL_STATIC_LIBRARIES := hfuzz hfuzzcommon
LOCAL_SRC_FILES := fuzz_test.c
LOCAL_MODULE := fuzz_test
LOCAL_ARM_MODE := arm

include $(BUILD_EXECUTABLE)
```

```
cat Application.mk
APP_BUILD_SCRIPT := ./Android.mk
APP_STL := c++_shared # Or system, or none.
APP_CFLAGS := -fsanitize=address -fno-omit-frame-pointer
APP_LDFLAGS := -fsanitize=address
```

After `ndk-build`, I test it on my pixel2 :

![image](https://user-images.githubusercontent.com/58254711/114140897-72094200-9943-11eb-9e39-3fc897778b60.png)
It seems ASAN works fine.

But when I try to fuzzing `fuzz_test` with honggfuzz, I find I cannot get any coverage infomation :

```
./honggfuzz -i in -o out -z -- fuzz_test ___FILE___

```

![image](https://user-images.githubusercontent.com/58254711/114141059-ac72df00-9943-11eb-8954-9192e68c66cf.png)

What I did wrong? Could you suggest something, please?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.