From 7929bba2186dfc96ff7dde3928b9353526e36199 Mon Sep 17 00:00:00 2001 From: Ivan Lozano Date: Wed, 12 Dec 2018 09:36:31 -0800 Subject: [PATCH] Add option to avoid recovering with diagnostics. Add a no_recover option that allows specifying which sanitizers in diagnostics modes shouldn't recover. This can help debugging as we test enabling sanitizers in new libraries since it'll cause tombstones to be generated along with the diagnostics information. Bug: 80195448 Bug: 110791537 Test: Compiled test module with this flag, checked compiler command. Test: Test module crashed, tombstone contained diagnostics information. Change-Id: Ie938923ef95716c2d49d6cd719ee223ad62755c6 --- cc/sanitize.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cc/sanitize.go b/cc/sanitize.go index 37d0a49d9..5db6bdfae 100644 --- a/cc/sanitize.go +++ b/cc/sanitize.go @@ -128,6 +128,7 @@ type SanitizeProperties struct { Cfi *bool `android:"arch_variant"` Integer_overflow *bool `android:"arch_variant"` Misc_undefined []string `android:"arch_variant"` + No_recover []string } // value to pass to -fsanitize-recover= @@ -565,6 +566,11 @@ func (sanitize *sanitize) flags(ctx ModuleContext, flags Flags) Flags { strings.Join(sanitize.Properties.Sanitize.Recover, ",")) } + if sanitize.Properties.Sanitize.Diag.No_recover != nil { + flags.CFlags = append(flags.CFlags, "-fno-sanitize-recover="+ + strings.Join(sanitize.Properties.Sanitize.Diag.No_recover, ",")) + } + // Link a runtime library if needed. runtimeLibrary := "" if Bool(sanitize.Properties.Sanitize.Address) {