Revert "Updated the way we build AFL++ fuzz binaries"
Revert submission 2164482-Build AFL from Command line option
Reason for revert: Unit test fails on MAC builds
Reverted Changes:
Ia7a822462:Updated the way we build AFL++ fuzz binaries
I994bde63b:Updated the way we build AFL++ fuzz binaries
Ie863853b4:Updated the way we build AFL++ fuzz binaries
I577d6ae7b:Updated the way we build AFL++ fuzz binaries
Ic4fd34f8d:Updated the way we build AFL++ fuzz binaries
Change-Id: Ic2cda7733d206d7ed178f1db5e38268bc915e57b
diff --git a/fuzz/fuzz_common.go b/fuzz/fuzz_common.go
index 7f7c601..1a87b30 100644
--- a/fuzz/fuzz_common.go
+++ b/fuzz/fuzz_common.go
@@ -27,21 +27,13 @@
"android/soong/android"
)
-type Lang string
+type FuzzType string
const (
- Cc Lang = "cc"
- Rust Lang = "rust"
- Java Lang = "java"
-)
-
-type Framework string
-
-const (
- AFL Framework = "afl"
- LibFuzzer Framework = "libfuzzer"
- Jazzer Framework = "jazzer"
- UnknownFramework Framework = "unknownframework"
+ Cc FuzzType = ""
+ Rust FuzzType = "rust"
+ Java FuzzType = "java"
+ AFL FuzzType = "AFL"
)
var BoolDefault = proptools.BoolDefault
@@ -56,6 +48,7 @@
Packages android.Paths
FuzzTargets map[string]bool
SharedLibInstallStrings []string
+ FuzzType FuzzType
}
type FileToZip struct {
@@ -153,12 +146,6 @@
IsJni *bool `json:"is_jni,omitempty"`
}
-type FuzzFrameworks struct {
- Afl *bool
- Libfuzzer *bool
- Jazzer *bool
-}
-
type FuzzProperties struct {
// Optional list of seed files to be installed to the fuzz target's output
// directory.
@@ -168,10 +155,6 @@
Data []string `android:"path"`
// Optional dictionary to be installed to the fuzz target's output directory.
Dictionary *string `android:"path"`
- // Define the fuzzing frameworks this fuzz target can be built for. If
- // empty then the fuzz target will be available to be built for all fuzz
- // frameworks available
- Fuzzing_frameworks *FuzzFrameworks
// Config for running the target on fuzzing infrastructure.
Fuzz_config *FuzzConfig
}
@@ -186,49 +169,6 @@
DataIntermediateDir android.Path
}
-func GetFramework(ctx android.LoadHookContext, lang Lang) Framework {
- framework := ctx.Config().Getenv("FUZZ_FRAMEWORK")
-
- if lang == Cc {
- switch strings.ToLower(framework) {
- case "":
- return LibFuzzer
- case "libfuzzer":
- return LibFuzzer
- case "afl":
- return AFL
- }
- } else if lang == Rust {
- return LibFuzzer
- } else if lang == Java {
- return Jazzer
- }
-
- ctx.ModuleErrorf(fmt.Sprintf("%s is not a valid fuzzing framework for %s", framework, lang))
- return UnknownFramework
-}
-
-func IsValidFrameworkForModule(targetFramework Framework, lang Lang, moduleFrameworks *FuzzFrameworks) bool {
- if targetFramework == UnknownFramework {
- return false
- }
-
- if moduleFrameworks == nil {
- return true
- }
-
- switch targetFramework {
- case LibFuzzer:
- return proptools.BoolDefault(moduleFrameworks.Libfuzzer, true)
- case AFL:
- return proptools.BoolDefault(moduleFrameworks.Afl, true)
- case Jazzer:
- return proptools.BoolDefault(moduleFrameworks.Jazzer, true)
- default:
- panic("%s is not supported as a fuzz framework")
- }
-}
-
func IsValid(fuzzModule FuzzModule) bool {
// Discard ramdisk + vendor_ramdisk + recovery modules, they're duplicates of
// fuzz targets we're going to package anyway.
@@ -327,7 +267,7 @@
return string(b)
}
-func (s *FuzzPackager) CreateFuzzPackage(ctx android.SingletonContext, archDirs map[ArchOs][]FileToZip, fuzzType Lang, pctx android.PackageContext) {
+func (s *FuzzPackager) CreateFuzzPackage(ctx android.SingletonContext, archDirs map[ArchOs][]FileToZip, fuzzType FuzzType, pctx android.PackageContext) {
var archOsList []ArchOs
for archOs := range archDirs {
archOsList = append(archOsList, archOs)
@@ -346,7 +286,9 @@
if fuzzType == Java {
zipFileName = "fuzz-java-" + hostOrTarget + "-" + arch + ".zip"
}
-
+ if fuzzType == AFL {
+ zipFileName = "fuzz-afl-" + hostOrTarget + "-" + arch + ".zip"
+ }
outputFile := android.PathForOutput(ctx, zipFileName)
s.Packages = append(s.Packages, outputFile)