Commit graph

26 commits

Author SHA1 Message Date
Colin Cross
5a37718c95 Convert ModuleProvder to generic providers API
Convert all of the callers of ModuleProvider/ModuleHasProvider to use the
type-safe android.SingletonModuleProvider API.

Bug: 316410648
Test: builds
Change-Id: I6f11638546b64749e451cebbf33140248dc1d193
2023-12-14 16:12:22 -08:00
Colin Cross
3c0a83d19f Use generics for providers API
Using generics for the providers API allows a type to be associated
with a ProviderKey, resulting in a type-safe API without that doesn't
require runtime type assertions by every caller.

Unfortunately, Go does not allow generic types in methods, only in
functions [1].  This prevents a type-safe API on ModuleContext, and
requires moving the API to be functions that take a ModuleContext as
a parameter.

This CL creates the new API, but doesn't convert all of the callers.

[1] https://go.googlesource.com/proposal/+/refs/heads/master/design/43651-type-parameters.md#no-parameterized-methods)

Bug: 316410648
Test: builds
Change-Id: I3e30d68b966b730efd968166a38a25cc144bd6de
2023-12-14 16:12:20 -08:00
Liz Kammer
ba23cb6436 Fix for ndk having sanitizers
Test: go test soong tests
Test: verify no NeuralNetworksTest_random_graph sdk variants in
    build.ninja when aosp_x86 is lunched
Bug: 302093869
Change-Id: I6429aa75518cca6974abcf7330236a6a07135ea1
2023-09-26 17:06:33 -04:00
Colin Cross
0df8153267 Fix adding manual ubsan runtime to static glibc binaries
Sanitized glibc binaries get their runtime added by clang, not by
Soong, but unsanitized glibc binaries with sanitized dependencies
need their runtime added manually by Soong.  Fix adding a static
runtime dependency to static glibc binaries.

Fixes: 297250415
Test: TestUbsan
Change-Id: I4913326604f9efebd8ecd4aad2f109fad8b6a80c
2023-08-23 22:39:58 -07:00
Trevor Radcliffe
bc65f63abc New test for propagation of CFI
Bug: 261733820
Test: It is a test

Change-Id: I3aedbdc14c4f5c41a706962894b6c686dbb1a70c
2023-04-13 14:46:40 +00:00
Colin Cross
b781d23575 Use static asan runtime for musl
Use static asan runtimes for musl binaries to match glibc binaries.
The static asan runtime also requires libclang_rt.asan_cxx.a.  Unlike
most other runtimes the asan runtimes need to expose the symbols
from the runtime to allow intercepting calls to malloc, new etc.

Test: m USE_HOST_MUSL=true aidl_unittests && out/host/linux-x86/testcases/aidl_unittests/x86_64/aidl_unittests
Test: sanitize_test.go
Change-Id: I93da03b1c447fbb01f37262e7a465f165c2d5a18
2023-03-22 12:58:39 -07:00
Colin Cross
5dc62c9456 Add sanitizer tests for musl
Add tests that verify sanitizer behaviors for musl.

Test: sanitize_test.go
Change-Id: I1f0a51cc103ac14d1738cb223e216ee0e32d8550
2023-03-22 12:58:38 -07:00
Treehugger Robot
463c15de15 Merge "Make more cc tests parallel" 2022-12-20 19:38:58 +00:00
Trevor Radcliffe
3a69f93987 Merge "Add test that shared libs don't propagate ubsan rt" 2022-12-06 21:29:03 +00:00
Liz Kammer
7c5d1591bc Make more cc tests parallel
Test: go test soong cc tests
Change-Id: I5ade33b1579ae46571728e051471147e627a7d38
2022-12-05 13:43:29 -05:00
Liz Kammer
2a109bc820 Disable misc ubsan Soong test on mac
Test: run on mac build
Change-Id: I869775ce76fd619557bf6833f99c5b924bcc5a8e
2022-12-02 09:36:01 -05:00
Liz Kammer
92c725994f Extend sanitize_test.go
Test: go test soong cc tests
Change-Id: I63fe74fb837e25f63074fb918a573f8b421562f1
2022-11-22 11:46:34 -05:00
Liz Kammer
fd8a49fb9d Limit propagating san config of shared to fuzzer
Prior to refactoring the sanitizers to use transition mutators, only
fuzzer sanitizer propagated configuration to shared dependencies
https://android-review.googlesource.com/c/platform/build/soong/+/2123434/9/cc/sanitize.go#b1365
However, this expanded to include TSAN in the refactoring
https://android-review.googlesource.com/c/platform/build/soong/+/2123434/9/cc/sanitize.go#1068.

Fortunately, TSAN is never enabled via Android.bp files in AOSP, so
there was no regression, but we should restore to the prevous state.

Test: go tests
Change-Id: I1a5ad8d033f7a9b4f7578393a2eac7c9362ab6f7
2022-11-22 11:46:32 -05:00
Trevor Radcliffe
9981555be7 Add test that shared libs don't propagate ubsan rt
Bug: 253428057
Test: Run unit tests
Change-Id: I76903d646c848b01c27c13e2a4e9f12976c796f8
2022-11-14 22:05:43 +00:00
Liz Kammer
ecc659cc14 Add test for static lib that specifies san
Test: golang tests
Change-Id: Ifd54f3e36f7091e16efbc2fc147b6a3a116ab01c
2022-11-08 17:25:39 -05:00
Florian Mayer
d8434a4f3d Revert "Revert "[soong] Add memtag-stack sanitizer, switch to li..."
Revert submission 2201105-revert-2096883-memtag-stack-IGUQFVKYTS

Reason for revert: Reland with fix
Reverted Changes:
I0dac2a6a6:Revert "memtag_stack tests."
I3967151d9:Revert "[soong] Add memtag-stack sanitizer, switch...

Change-Id: Ib827fb8d48192f9e2accc97931e272f713d6cbd0
2022-08-31 15:20:25 -07:00
Florian Mayer
00ab5cfd5e Revert "[soong] Add memtag-stack sanitizer, switch to linker-gen..."
Revert submission 2096883-memtag-stack

Reason for revert: b/244454542
Reverted Changes:
I7fee03d90:memtag_stack tests.
I52d2318c8:[soong] Add memtag-stack sanitizer, switch to link...

Change-Id: I3967151d98514fa07f66804aa8ff403df3962fa3
2022-08-31 18:30:18 +00:00
Evgenii Stepanov
807573d135 [soong] Add memtag-stack sanitizer, switch to linker-generated notes.
This change depends on the following toolchain commit:
https://reviews.llvm.org/D118948

Bug: b/174878242
Test: sanitize_test.go
Test: fvp_mini with SANITIZE_TARGET=memtag_heap,memtag_stack

Change-Id: I52d2318c8e4e06d6da5b74c45226144b880f1577
2022-08-30 21:37:03 +00:00
Colin Cross
3e5e778969 Reland: Fix -Wl,--exclude-libs for clang runtime libraries
The sanitize code was assuming that the names of the clang runtime
library modules were the same as their static library output files,
but that's not true after I39e2cf8ae14edf8510276dab38011afaef85822c.
Use the dependency to get the name of the library to pass to
-Wl,--exclude-libs.

This relands If6ca7838800c76f90105fb02d39e8a68cec96314 with a fix
for skipping tests that don't work on mac.
   
Bug: 235624976
Test: TestUbsan
Change-Id: I32894d10d24473ad48b6afc5663f91fa48a6a0ba
2022-06-17 22:48:22 +00:00
Colin Cross
567d98346c Revert "Fix -Wl,--exclude-libs for clang runtime libraries"
This reverts commit 59de280a48.

Reason for revert: Broke mac tests
Bug: 235624976

Change-Id: I358bb14ec565f106483378f4798e3fc88c491f8f
2022-06-17 22:15:00 +00:00
Colin Cross
59de280a48 Fix -Wl,--exclude-libs for clang runtime libraries
THe sanitize code was assuming that the names of the clang runtime
library modules were the same as their static library output files,
but that's not true after I39e2cf8ae14edf8510276dab38011afaef85822c.
Use the dependency to get the name of the library to pass to
-Wl,--exclude-libs.

Bug: 235624976
Test: TestUbsan
Change-Id: If6ca7838800c76f90105fb02d39e8a68cec96314
2022-06-13 15:55:06 -07:00
Colin Cross
4c4c1be915 Use single module for clang runtime libraries
The clang prebuilts now provide a single module with per-architecture
variants instead of a module per architecture.

Bug: 220019988
Test: m checkbuild
Change-Id: I39e2cf8ae14edf8510276dab38011afaef85822c
Merged-In: I39e2cf8ae14edf8510276dab38011afaef85822c
2022-03-07 14:56:32 -08:00
Liz Kammer
7b920b4057 Update memtag code behavior to match comment.
Test: go test soong tests
Change-Id: I630c06f01c90256b1990c37b9236e8967a5fa316
2021-07-08 11:19:15 -04:00
Liz Kammer
d56ddb5482 Reorganize memtag tests for clarity.
Test: go test soong tests
Change-Id: Id861a62bd0ff2b6a5a4354fbda939e9ebb13a2a5
2021-07-08 11:19:15 -04:00
Liz Kammer
bb8d84f01b Move notememtag tests to sanitize_test.go
Test: go test soong tests
Change-Id: I177fcfd787c3aa8185f94dfcc971d9a0c56f9438
2021-06-25 13:37:18 -04:00
Colin Cross
af98f58242 Don't propagate ASAN through shared library dependencies
Propagating enabling ASAN through shared library dependencies
doesn't make much sense, because only the non-ASAN variant is exposed
to Make, leading to an non-installed dependency.

Bug: 186487510
Test: TestAsan
Change-Id: I7d3f20f2d10beac09c66c6b6dcb7a34a513ff3b8
2021-05-13 18:02:57 -07:00