Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b9b3e790 authored by Mitch Phillips's avatar Mitch Phillips
Browse files

Disable FORTIFY for fuzzer builds.

Disables FORTIFY for fuzz target builds. We generally build with a
sanitizer and want the sanitizer to handle the bugs and provide us with
a nice stack trace.

Bug: 140187921
Test: m example_fuzzer && $ANDROID_HOST_OUT/fuzz/example_fuzzer (note
that you get a proper ASan report instead of a fortify crash)

Change-Id: I15a117b26c401a03785fb44c0f796588f366bc55
parent 21738f60
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -475,6 +475,12 @@ func (sanitize *sanitize) flags(ctx ModuleContext, flags Flags) Flags {
		// TODO(b/133876586): Experimental PM breaks sanitizer coverage.
		_, flags.CFlags = removeFromList("-fexperimental-new-pass-manager", flags.CFlags)
		flags.CFlags = append(flags.CFlags, "-fno-experimental-new-pass-manager")

		// Disable fortify for fuzzing builds. Generally, we'll be building with
		// UBSan or ASan here and the fortify checks pollute the stack traces.
		_, flags.CFlags = removeFromList("-D_FORTIFY_SOURCE=1", flags.CFlags)
		_, flags.CFlags = removeFromList("-D_FORTIFY_SOURCE=2", flags.CFlags)
		flags.CFlags = append(flags.CFlags, "-U_FORTIFY_SOURCE")
	}

	if Bool(sanitize.Properties.Sanitize.Cfi) {