Fix: symbols/bionic/lib64/libc.so is the wrong variant

The new module type bionic_mountpoint wasn't mutated by the sanitizer.
As a result, it has been taking non-sanitized symbol libraries even for
sanitized builds. Fixing the issue by making the module type to
implement the cc.Sanitizeable interface so that it can be mutated by the
sanitizer.

Bug: 124469750
Test: SANITIZE_TARGET=hwaddress m
Inspect Android-<target>.mk and check that LOCAL_SOONG_UNSTRIPPED_BINARY
for libc.mountpoint module is pointing to a hwasan variant of libc.so

Change-Id: I10c863c0dbd361463648a4b7d897a4f88a9c85cb
This commit is contained in:
Jiyong Park 2019-02-15 12:15:27 +09:00
parent 4788931135
commit 88d03200d4

View file

@ -89,6 +89,9 @@ type bionicMountpointProperties struct {
// Symlinks to the mountpoints from the system and recovery partitions
// Symlinks names will have the same suffix as the mount point
Symlinks []string
// List of sanitizer names that this APEX is enabled for
SanitizerNames []string `blueprint:"mutated"`
}
type dependencyTag struct {
@ -98,6 +101,31 @@ type dependencyTag struct {
var mountsourceTag = dependencyTag{name: "mountsource"}
func (m *bionicMountpoint) EnableSanitizer(sanitizerName string) {
if !android.InList(sanitizerName, m.properties.SanitizerNames) {
m.properties.SanitizerNames = append(m.properties.SanitizerNames, sanitizerName)
}
}
func (m *bionicMountpoint) IsSanitizerEnabled(ctx android.BaseModuleContext, sanitizerName string) bool {
if android.InList(sanitizerName, m.properties.SanitizerNames) {
return true
}
// Then follow the global setting
globalSanitizerNames := []string{}
if m.Host() {
globalSanitizerNames = ctx.Config().SanitizeHost()
} else {
arches := ctx.Config().SanitizeDeviceArch()
if len(arches) == 0 || android.InList(m.Arch().ArchType.Name, arches) {
globalSanitizerNames = ctx.Config().SanitizeDevice()
}
}
return android.InList(sanitizerName, globalSanitizerNames)
}
func (m *bionicMountpoint) DepsMutator(ctx android.BottomUpMutatorContext) {
if Bool(m.properties.Library) == Bool(m.properties.Binary) {
ctx.ModuleErrorf("either binary or library must be set to true")