diff options
author | Jiyong Park <jiyong@google.com> | 2019-02-15 12:15:27 +0900 |
---|---|---|
committer | Jiyong Park <jiyong@google.com> | 2019-02-15 12:15:27 +0900 |
commit | 88d03200d46dceabf60472a85ac4242bc4501d3d (patch) | |
tree | c47565ed27e0002c0a35c6f3f2e4b4cde09cc7e6 /build | |
parent | 4788931135cc9d87c57d927fd202ebb3d84993a4 (diff) | |
download | bionic-88d03200d46dceabf60472a85ac4242bc4501d3d.tar.gz |
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
Diffstat (limited to 'build')
-rw-r--r-- | build/bionic.go | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/build/bionic.go b/build/bionic.go index 93c24944f..54ad10bfb 100644 --- a/build/bionic.go +++ b/build/bionic.go @@ -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") |