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

Commit 53c6c67c authored by Lukács T. Berki's avatar Lukács T. Berki Committed by Gerrit Code Review
Browse files

Merge "Make java_fuzz_host not implement Sanitizeable."

parents 478db1a8 8c77ae36
Loading
Loading
Loading
Loading
+12 −16
Original line number Diff line number Diff line
@@ -968,10 +968,9 @@ func sanitizerDepsMutator(t SanitizerType) func(android.TopDownMutatorContext) {
					return true
				})
			}
		} else if sanitizeable, ok := mctx.Module().(Sanitizeable); ok {
		} else if jniSanitizeable, ok := mctx.Module().(JniSanitizeable); ok {
			// If it's a Java module with native dependencies through jni,
			// set the sanitizer for them
			if jniSanitizeable, ok := mctx.Module().(JniSanitizeable); ok {
			if jniSanitizeable.IsSanitizerEnabledForJni(mctx, t.name()) {
				mctx.VisitDirectDeps(func(child android.Module) {
					if c, ok := child.(PlatformSanitizeable); ok &&
@@ -983,8 +982,7 @@ func sanitizerDepsMutator(t SanitizerType) func(android.TopDownMutatorContext) {
					}
				})
			}
			}

		} else if sanitizeable, ok := mctx.Module().(Sanitizeable); ok {
			// If an APEX module includes a lib which is enabled for a sanitizer T, then
			// the APEX module is also enabled for the same sanitizer type.
			mctx.VisitDirectDeps(func(child android.Module) {
@@ -1529,12 +1527,10 @@ func enableMinimalRuntime(sanitize *sanitize) bool {
	if !Bool(sanitize.Properties.Sanitize.Address) &&
		!Bool(sanitize.Properties.Sanitize.Hwaddress) &&
		!Bool(sanitize.Properties.Sanitize.Fuzzer) &&

		(Bool(sanitize.Properties.Sanitize.Integer_overflow) ||
			len(sanitize.Properties.Sanitize.Misc_undefined) > 0 ||
			Bool(sanitize.Properties.Sanitize.Undefined) ||
			Bool(sanitize.Properties.Sanitize.All_undefined)) &&

		!(Bool(sanitize.Properties.Sanitize.Diag.Integer_overflow) ||
			Bool(sanitize.Properties.Sanitize.Diag.Cfi) ||
			Bool(sanitize.Properties.Sanitize.Diag.Undefined) ||
+4 −23
Original line number Diff line number Diff line
@@ -50,37 +50,18 @@ type JavaFuzzLibrary struct {
	jniFilePaths       android.Paths
}

// IsSanitizerEnabled implemented to make JavaFuzzLibrary implement
// cc.Sanitizeable
func (j *JavaFuzzLibrary) IsSanitizerEnabled(ctx android.BaseModuleContext, sanitizerName string) bool {
	for _, s := range j.jniProperties.Sanitizers {
		if sanitizerName == s {
			return true
		}
	}
	return false
}

// IsSanitizerEnabledForJni implemented to make JavaFuzzLibrary implement
// cc.JniSanitizeable. It returns a bool for whether a cc dependency should be
// sanitized for the given sanitizer or not.
func (j *JavaFuzzLibrary) IsSanitizerEnabledForJni(ctx android.BaseModuleContext, sanitizerName string) bool {
	return j.IsSanitizerEnabled(ctx, sanitizerName)
	for _, s := range j.jniProperties.Sanitizers {
		if sanitizerName == s {
			return true
		}

// EnableSanitizer implemented to make JavaFuzzLibrary implement
// cc.Sanitizeable
func (j *JavaFuzzLibrary) EnableSanitizer(sanitizerName string) {
	}

// AddSanitizerDependencies implemented to make JavaFuzzLibrary implement
// cc.Sanitizeable
func (j *JavaFuzzLibrary) AddSanitizerDependencies(mctx android.BottomUpMutatorContext, sanitizerName string) {
	return false
}

// To verify that JavaFuzzLibrary implements cc.Sanitizeable
var _ cc.Sanitizeable = (*JavaFuzzLibrary)(nil)

func (j *JavaFuzzLibrary) DepsMutator(mctx android.BottomUpMutatorContext) {
	if len(j.jniProperties.Jni_libs) > 0 {
		if j.fuzzPackagedModule.FuzzProperties.Fuzz_config == nil {