cc_fuzz targets depend on fuzz_interceptors for HWASan builds
This allows us fuzzers to get coverage feedback and mutate more intelligently based on feedback from strcmp, memcpy, and similar functions. Bug: 208297094 Test: make and run 'example_fuzzer', build 'haiku' Change-Id: Ic51c207f8644cda885fb3f453cc583e2ee1e8c1d
This commit is contained in:
@@ -244,4 +244,8 @@ func LibFuzzerRuntimeLibrary(t Toolchain) string {
|
||||
return LibclangRuntimeLibrary(t, "fuzzer")
|
||||
}
|
||||
|
||||
func LibFuzzerRuntimeInterceptors(t Toolchain) string {
|
||||
return LibclangRuntimeLibrary(t, "fuzzer_interceptors")
|
||||
}
|
||||
|
||||
var inList = android.InList
|
||||
|
@@ -126,6 +126,14 @@ func (fuzzBin *fuzzBinary) linkerDeps(ctx DepsContext, deps Deps) Deps {
|
||||
deps.HeaderLibs = append(deps.HeaderLibs, "libafl_headers")
|
||||
} else {
|
||||
deps.StaticLibs = append(deps.StaticLibs, config.LibFuzzerRuntimeLibrary(ctx.toolchain()))
|
||||
// Fuzzers built with HWASAN should use the interceptors for better
|
||||
// mutation based on signals in strcmp, memcpy, etc. This is only needed for
|
||||
// fuzz targets, not generic HWASAN-ified binaries or libraries.
|
||||
if module, ok := ctx.Module().(*Module); ok {
|
||||
if module.IsSanitizerEnabled(Hwasan) {
|
||||
deps.StaticLibs = append(deps.StaticLibs, config.LibFuzzerRuntimeInterceptors(ctx.toolchain()))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
deps = fuzzBin.binaryDecorator.linkerDeps(ctx, deps)
|
||||
|
Reference in New Issue
Block a user