Commit graph

372 commits

Author SHA1 Message Date
Colin Cross
23ae82a2b2 Support sanitizing a single device arch
Allow specifying one or more architectures to sanitize for.  Defaults to
sanitizing all architectures.  Allows reducing the cost of sanitization
by only sanitizing half of the platform.

Bug: 29498013
Test: No change to build.ninja files with m -j SANITIZE_TARGET=address
Test: m -j SANITIZE_TARGET=address SANITIZE_TARGET_ARCH=arm
Test: nm -D $OUT/system/bin/app_process64 | grep asan, no asan symbols found
Change-Id: I972cccc2f19443895d47b44bd8104105f93ffb7d
2016-11-02 15:18:19 -07:00
Evgenii Stepanov
1e405e160a [soong] Enable LOCAL_SANITIZE:=cfi and add LOCAL_SANITIZE_DIAG.
LOCAL_SANITIZE_DIAG works for ubsan, too.

Bug: 22033465
Test: build a test target with cfi and diag { cfi } properties.

Change-Id: I9cd8e8df9b330430b321709d7f05b4da0294e771
2016-10-31 15:29:08 -07:00
Colin Cross
46974e2457 Don't pass -Wl,--no-undefined to host targets
Host builds were compiling without -Wl,--no-undefined because of an ASAN
issue.  Pass -Wl,--no-undefined for host builds unless sanitzers are
enabled.  Also fix LOCAL_ALLOW_UNDEFINED_SYMBOLS on darwin, where
disallowing undefined symbols is the default.

Test: m -j host
Test: m -j SANITIZE_HOST=address host
Bug: 32305815
Change-Id: Ia4bb305a50b1c1048b119f75726d52f82e21438c
2016-10-21 18:20:23 +00:00
Dan Willemsen
78ffeea24e Fix gofmt problems and add gofmt to preupload checks
Test: gofmt -d .
Test: <bad change>, repo upload
Change-Id: I5ca0676461616f166a842d307c600dc50a50ec48
2016-10-20 18:48:20 -07:00
Dan Willemsen
cbceaab39c Export asan configuration to make
Test: Ninja files for ASAN'd aosp_flounder-eng identical
Change-Id: Ib29cac0bc391dadd9ff27992c7b356415182767f
2016-10-13 23:46:10 +00:00
Colin Cross
b0f28957ae Support mixed ASAN and non-ASAN host builds
Host builds may build binaries that must have ASAN disabled.  Convert
host ASAN to use variants.  Since there is only one install location for
shared libraries, don't install the non-ASAN variant at all for now.

Test: mmma -j art SANITIZE_HOST=address
Change-Id: Iacefecac93df44823316624b4c540c24f643fb80
2016-09-19 16:50:35 -07:00
Colin Cross
9461040154 Fix installation path for asan libraries
Check c.sanitize.inData() when deciding on install paths.
Don't set inData() for sanitized binaries.

Bug: 30773053
Change-Id: I24be75ccc1b25ae53f7f0a98d1632b30735d0931
2016-08-29 13:50:24 -07:00
Evgenii Stepanov
af36db1178 Add ubsan_standalone library name to the toolchain.
and export the library name to make. Refactor the code a bit to avoid repeating the library name
multiple times.

Bug: 22033465
Test: Ran external/clang/build.py for aosp-llvm

Change-Id: I25eb3858eb92e1dd493b09524d559802551b2547
2016-08-15 17:05:04 -07:00
Colin Cross
91169fe8ea Fix coverage sanitizer builds
Disable coverage for static binaries where address sanitizer is
disabled, and disable coverage in the mutator when disabling address
sanitizer.

Bug: 29188876
Change-Id: Ia1a21878c3f34cd295a6dec49608c412eb09e7b1
2016-08-11 16:54:01 -07:00
Colin Cross
b916a38233 Refactor cc modules to use decorators instead of inheritance
For example , instead of trying to have libraryLinker inherit from
baseLinker and libraryCompiler inherit from baseCompiler, create a
single decorator object that wraps both baseLinker and baseCompiler.

Test: Builds, no unexpected changes to build.ninja
Change-Id: I2468adaea8466c203a240259ba5694b8b1df7a52
2016-08-05 10:25:09 -07:00
Colin Cross
b98c8b0595 Move toolchain and global variables into separate package
Move all of the configuration into a cc/config package

Change-Id: If56fc7242062ed1ce3cb297f78a1e0ef7537373c
2016-08-01 13:37:01 -07:00
Colin Cross
3c344ef29e Disable asan for static binaries
build/core/executable.mk has an extra check to disable asan for static
binaries, do the same in soong.

Bug: 30191800
Change-Id: Ia78063264f3280eb889ba9e45c45dd66e4c64a96
2016-07-18 16:14:12 -07:00
Colin Cross
263abbd5e9 Support global and local sanitizers
Mixing undefined and address sanitizers requires updating cflags.
Matches makefile change Ifee350da4877008fb061bc7f6c700e7fade405bc

Bug: 30163657
Change-Id: Iea4364b912b496400581a475bc79bd9b9c4dd76d
2016-07-15 13:12:58 -07:00
Evgenii Stepanov
fcfe56d194 Target sanitize properties can disable the global sanitizer.
With this change, sanitize: { address: false } disables
SANITIZE_TARGET=address for one target.

Also rename SafeStack to Safestack, because the former can not be
used as a target property.

Bug: 27729263
2016-07-07 10:54:42 -07:00
Evgenii Stepanov
05bafd3784 Revert "Target sanitize properties can disable the global sanitizer."
This reverts commit bb02886451.

Breaks SANITIZE_HOST=address

Change-Id: I9791a034e32a83d567b8739a7ec7b61890cb1b97
2016-07-07 17:38:41 +00:00
Evgenii Stepanov
bb02886451 Target sanitize properties can disable the global sanitizer.
With this change, sanitize: { address: false } disables
SANITIZE_TARGET=address for one target.

Also rename SafeStack to Safestack, because the former can not be
used as a target property.

Bug: 27729263
Change-Id: I20f55c0e62b2fdd191ba66c0f661a039109bd78f
2016-07-06 16:38:58 -07:00
Colin Cross
b36ab1a1a0 Fix sanitize host builds
Host builds don't have a separate place to install asan modules, so only
create a single variant for them.

Change-Id: I81f7090debd7935db778f8600d8cbc86dd53b1cb
2016-05-25 12:35:53 -07:00
Colin Cross
bc6fb16b26 Support sanitizer variants inside make builds
Create both sanitized and unsanitized variants inside make builds with
sanitizers enabled.  Only export the sanitized version to make, and
always install the sanitized version in /data to match the make build.

Change-Id: I5a17bcbddc7a9d871c929c84d3c116228ef3258f
2016-05-24 17:14:15 -07:00
Colin Cross
635c3b0157 Rename common to android
Rename the "common" package to "android", because common is too
generic.  Also removes all android.Android naming stutter.

Ran:
gomvpkg -from 'android/soong/common' -to 'android/soong/android'
gorename -from '"android/soong/android".AndroidModuleContext' -to 'ModuleContext'
gorename -from '"android/soong/android".AndroidBaseContext' -to 'BaseContext'
gorename -from '"android/soong/android".AndroidModuleBase' -to 'ModuleBase'
gorename -from '"android/soong/android".AndroidBottomUpMutatorContext' -to 'BottomUpMutatorContext'
gorename -from '"android/soong/android".AndroidTopDownMutatorContext' -to 'TopDownMutatorContext'
gorename -from '"android/soong/android".AndroidModule' -to 'Module'

Change-Id: I3b23590b8ce7c8a1ea1139411d84a53163288da7
2016-05-18 15:37:25 -07:00
Evgenii Stepanov
0a8a0d09d1 Support SANITIZE_TARGET=safe-stack in soong.
Change-Id: I570a7033ece82c5e76815dc1b81622b481930de4
2016-05-12 13:54:53 -07:00
Colin Cross
30d5f514dd Support sanitizer builds inside make
Make expects libraries built with address sanitizer to be installed into
/data, and can't handle multiple variants of modules.

Change-Id: Ice575ff6f0788a88f296e7b3ee521a2b9771f55f
2016-05-03 18:02:42 -07:00
Colin Cross
16b2349190 Add support for sanitizer property
Add a new feature to cc modules that adds the cflags and libraries
necessary to implement AddressSanitizer, ThreadSanitizer, and
UndefinedBehaviorSanitizer.

Change-Id: Ibe5ffadc7ece56080a2521f2c7c00da9ef712584
2016-04-21 16:42:08 -07:00