Commit graph

391 commits

Author SHA1 Message Date
Zi Wang
05ae2e9d35 [conflict] Merge "PrebuildEtcModule no longer implements OutputFiles method" into main am: 3125b75d5d
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3123797

Change-Id: I9acefd1def06cefc153514c766489b341fa86b2e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
Ignore-AOSP-First: to resolve merge conflict
2024-06-11 18:18:14 +00:00
mrziwang
e2346b87d9 PrebuildEtcModule no longer implements OutputFiles method
In the context of incremental soong, the output files
inter-module-communication will be through OutputFilesProvider.
The OutputFileProducer interface will be deprecated.

These module types are included in this change:
linker_config
llndk_libraries_txt
sanitizer_libraries_txt
java_sdk_library_xml
vndksp_libraries_txt
vndkcore_libraries_txt
vndkprivate_libraries_txt
vndkpublic_libraries_txt

Test: CI
Bug: 339477385
Change-Id: I35575bbad137df5ff8001db9a61ba5b3d13eaa6d
2024-06-10 15:17:07 -07:00
Kiyoung Kim
9f26fcf88c Remove VNDK related code from Soong
As VNDK definition is fully removed from Android.bp, VNDK related code
can be removed from Soong. This change removes VNDK related code except
VNDK prebuilt which is required to build former versions of VNDK APEX
with prebuilts.

Bug: 330100430
Test: AOSP CF build succeeded
Ignore-AOSP-First: Resolve Conflict
Change-Id: Id9c8993343221c8464c97296bde0ff40b14b9b0b
2024-06-05 01:22:58 +00:00
Kiyoung Kim
0d8908c2e4 Move sanitizer.libraries.txt logic into Soong
Currently sanitizer.libraries.txt module is defined from Makefile, while
all logics to create the list of modules is implmented within the Soong.
This change moves sanitizer.libraries.txt module definition into Soong,
so it can be generated without sharing list of modules over Make
variable.

Bug: 339131599
Test: AOSP CF build succeeded, with same list of modules in
/system/etc/sanitizer.libraries.txt

Change-Id: I987684877aa8dae221a03227d784f2a8ca4f5cc4
2024-05-23 17:50:46 +09:00
Cole Faust
3f01580c04 Merge "Make the enabled property configurable" into main 2024-05-07 17:49:10 +00:00
Ivan Lozano
5fea568440 Merge "cc: Remove unneeded ubsan library linkage on host" into main 2024-05-06 13:00:20 +00:00
Ivan Lozano
2a2d509a32 cc: Remove unneeded ubsan library linkage on host
The sanitizer runtime logic was rewritten in aosp/2438959 to simplify
static sanitizer library selection. However, enabling ubsan diagnostics
for host tests would result in incorrectly adding an unnecessary
libclang_rt.asan.so dependency.

This check should have been removed as well -- the library dep
determination for c.sanitize.Properties.UbsanRuntimeDep is now handled
higher up in the logic.

(Some formatting fixes are included as well)

Bug: 323237381
Test: UBSanitized Host test with diagnostics runs correctly.
Change-Id: I97bd01344b7b676fccb9f250c0f801b8bc212a1a
2024-05-03 12:20:40 -04:00
Florian Mayer
37d17209b2 Merge "Make memtag_stack a variant" into main 2024-05-03 00:20:37 +00:00
Cole Faust
a963b94cde Make the enabled property configurable
This allows using select statements with it.

Bug: 323382414
Test: m nothing --no-skip-soong-tests
Change-Id: I6f3efaaa3d82505e38a91ee4ba0e18e404360191
Merged-In: If355d24506e3f117d27b21442a6c02bca3402dc7
2024-05-02 15:41:24 -07:00
Florian Mayer
39b536260a Merge "Pass -mllvm flags for memtag-stack correctly to linker" into main 2024-05-01 17:29:31 +00:00
Florian Mayer
99addb1802 remove hwasan-use-after-scope=1 which is default now
This is part of Android LLVM toolchain:

https://cs.android.com/android/platform/superproject/main/+/main:prebuilts/clang/host/linux-x86/clang-r510928/BUILD_INFO;l=79

477610d4d0/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp (135)

Change-Id: I2812fac89584a8324126d15525b6ee78f5494a50
2024-05-01 00:56:22 +00:00
Florian Mayer
ab97e28bf6 Pass -mllvm flags for memtag-stack correctly to linker
Bug: 309446520
Change-Id: I08519db0323a754c66acaa0ace5c41d962809ac6
2024-05-01 00:36:06 +00:00
Florian Mayer
5ccc4218d5 Make memtag_stack a variant
Otherwise we cannot disable memtag_stack on first stage init, because it
statically links in a lot of libraries.

This was benign, but if we want to add a stack history buffer, we do not
want to emit these instructions for first stage init.

Bug: 309446520
Change-Id: Ifbdcbe5ba06eb46970bc1e9b64a26c1ca59ba5f2
2024-04-30 10:53:33 -07:00
Aditya Kumar
c63c4306c0 Merge "Add deps to blocklist path" into main 2024-04-09 23:49:13 +00:00
Cole Faust
8982b1c49e Remove "exported" ninja variables
There was infrastructure to export ninja variables to bazel. Now that
the bazel migration is cancelled, we don't need it anymore.

Bug: 315353489
Test: m nothing
Change-Id: I298cc2ac7ebd004557be3b30d75f7357cab0b7a0
2024-04-09 09:42:37 -07:00
Kiyoung Kim
37693d0a27 Deprecate Snapshot build
Existing snapshot code will no longer work from VNDK deprecation, but it
can give confusion to users if we keep code for the snapshot - and it
adds complexity on existing code while it is not in use. This change
removes all snapshot definition except host snapshot and its usage.

Bug: 330100430
Bug: 332986564
Test: AOSP CF build succeeded
Change-Id: Ieb6fa43d5e38315c662ce997bc305b744b367c24
2024-04-05 01:56:56 +00:00
AdityaK
6e6f52281e Add deps to blocklist path
Change-Id: Ib4e17c497035b071f7c61d9158c58b5c03d919ae
2024-04-03 14:54:24 -07:00
Colin Cross
ff694a8c88 Convert Provider to generic providers API
Convert all of the callers of Provider/HasProvider to use the type-safe
android.ModuleProvider API.

Bug: 316410648
Test: builds

Change-Id: I73479de1625fa2865b6c73444cd477e50d56dc5a
2023-12-14 16:12:21 -08:00
Colin Cross
8ff105860d Remove ConvertWithBp2build implementations
Remove the ConvertWithBp2build implementations from all the module
types, along with the related code.

Bug: 315353489
Test: m blueprint_tests
Change-Id: I212672286686a318893bc7348ddd5a5ec51e77a7
2023-12-08 13:51:05 -08:00
Elliott Hughes
3bba0e4bfe Have the sanitizers trap rather than abort.
abort() seems friendlier, but in practice it puts a couple of irrelevant
libc.so frames on the top of the stack trace and clobbers all the
registers that might have helped remotely debug a sanitizer failure.
Let's switch to trapping directly in the sanitized code instead.

Bug: http://b/298741930
Test: treehugger
Change-Id: I6c971920c8506f97133749aaddd73b8cea6a12bc
2023-10-05 14:51:28 -07: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
Sami Tolvanen
ed78fc8553 Reapply "Enable CFI for riscv64"
This reverts commit 49dcf79550.

The previous init crash was caused by the kernel defaulting to Sv57 and
the CFI shadow implementation in bionic assuming a 48-bit virtual
address space. With 5-level paging disabled in cuttlefish, we can again
enable CFI.

Bug: 293884796
Link: https://github.com/google/android-riscv64/issues/45
Test: cuttlefish boots
Change-Id: Ibcc02cf7ca6e396fd58674c648abf9f84daa260e
2023-09-18 13:41:29 -07:00
Treehugger Robot
f3d52683a9 Merge "soong: HWASan exclude path support" into main 2023-09-06 01:14:12 +00:00
Ivan Lozano
5467a39984 rust: Rust sanitized snapshots variations
This adds support for correctly handling Rust sanitized snapshots,
ensuring they only have one variation.

The presence of multiple variations were causing build failures
when a rust_fuzz module for host was defined and a snapshot
build was requested.

This also sets -Z link-native-libraries=no on host modules
(in addition to device modules) to avoid emitting extra linkage
flags due to link attributes.

Bug: 282897366
Test: SOONG_SDK_SNAPSHOT_USE_SRCJAR=true m
Change-Id: Idf980c29145f11c530ad635a4eb5b01a1730ac24
2023-08-25 12:54:56 -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
Tomislav Novak
f734f00898 soong: HWASan exclude path support
Adds the ability to centrally disable HWASan for multiple modules when
building with SANITIZE_TARGET=hwaddress. Soong version of the patchset.

HWASan takes precedence over CFI and several other sanitizers that it's
incompatible with[1], which can be problematic for modules that require
those sanitizers (e.g. those that depend on vendor prebuilts where only
sanitized variants are provided). This patch adds an easy way to disable
HWASan for such modules while still keeping it globally enabled.

Test: build with HWASAN_EXCLUDE_PATHS set and verify with readelf that
      relevant modules have no references to __hwasan symbols

[1] bb31ca1168/core/config_sanitizers.mk (236)

Change-Id: I5824f71f2a400c64cde29e2c7afdd167d851d337
2023-08-22 18:15:14 +00:00
Trevor Radcliffe
24e0b13b9c Merge "Export no sanitize link runtime flag" into main 2023-08-03 20:54:39 +00:00
Trevor Radcliffe
0555acc1f7 Merge "Export Minimal Runtime Flags" into main 2023-08-03 20:39:22 +00:00
Trevor Radcliffe
da64d91d2e Export no sanitize link runtime flag
Bug: 294219797
Test: Unit tests
Change-Id: Id4bbf78e9ba3893fb857b85e6b7261b11404ebf0
2023-08-02 20:24:29 +00:00
Trevor Radcliffe
3876c5a143 Export Minimal Runtime Flags
Bug: 294219797
Test: Unit Tests
Change-Id: Ia6a617378ccecb01bda4951d223b6c99d6c75060
2023-08-02 15:41:50 +00:00
Florian Mayer
f50eda3b9b Reland "[hwasan] remove workaround for fixed toolchain issue"
This reverts commit e72ee14006.

Bug: 293532332
Reason for revert: Test failure fixed in https://r.android.com/2681595

Change-Id: Id40079133e50492a6e2f3e2794012695562c39f6
2023-07-28 21:22:34 +00:00
Mark White
e72ee14006 Revert "[hwasan] remove workaround for fixed toolchain issue"
This reverts commit 07ca220182.

Reason for revert: b/293532332 - bionic unit tests failing

Change-Id: I11412df55d7131ff0bb36dee7258b75a12024100
2023-07-28 13:54:57 +00:00
Florian Mayer
07ca220182 [hwasan] remove workaround for fixed toolchain issue
these two upstream commits fixed the issues in global-isel and fast-isel:

* global-isel: https://reviews.llvm.org/D82615
* fast-isel: https://reviews.llvm.org/D138615

Currently used clang r498229 (defined build/soong/cc/config/global.go)
is based on upstream commit 14f0776550b5a49e1c42f49a00213f7f3fa047bf
which includes these two changes.

Bug: 293297826
Test: build oriole_hwasan and boot
Change-Id: I65fabdf0b5edd248b4bf4e138a999f8142370cd5
2023-07-26 21:17:56 +00:00
AdityaK
111d68053b Enable scs for riscv64
https://github.com/google/android-riscv64/issues/106

Bug: b/277909695

Change-Id: I2ea0d41fd9dc43b3fefb748d10694917034ab586
2023-07-17 22:43:44 +00:00
Mitch Phillips
03d510404c Merge "[MTE] Add memtag_globals as a sanitizer target." 2023-06-26 05:50:11 +00:00
Florian Mayer
c3adf443e7 Merge "Reland "Re-enable stack frame size errors"" 2023-06-22 20:55:48 +00:00
Mitch Phillips
92d19fa306 [MTE] Add memtag_globals as a sanitizer target.
MTE globals needs four pieces:
 1. (done) clang/llvm to produce objfiles with MTE globals metadata
 2. (in flight, https://reviews.llvm.org/D152921) lld to process the metadata in the objfiles, and produce information in each DSO describing the global variables that need to be tagged (alongside some other stuff).
 3. (this patch) android to handle the new sanitizer
 4. (not yet sent) bionic's libc/linker to interpret the information in each DSO, and tag the global variables.

Because #2 will take some time to come through the toolchain rolls, and #3 and #4 can be landed asynchronously, we can land this ahead of time. Should make my life easier by preventing constant rebases.

Bug: N/A
Test: Build {libc, libm, libc++, libm, and libnetd} in internal master
with these patches and an experimental compiler with the lld support.
Also, `SANITIZE_TARGET=memtag_globals m` here with in-tree compiler
without lld support.

Change-Id: Ie7882d474d4d776232de3a3d571a82274df14bf0
2023-06-22 17:04:40 +00:00
Treehugger Robot
f44ac9efc1 Merge changes I6ddb47d7,I3df3d304
* changes:
  [hwasan] Increase BB to explore for reachability
  [hwasan] Also pass use-after-scope flag in LTO
2023-06-21 21:14:52 +00:00
Florian Mayer
c746619feb [hwasan] Increase BB to explore for reachability
We pass mcpu=cortex-a55 for our build, which increases BB to the point
where the LLVM default of 32 is not enough. This caused worse coverage
for use-after-scope detection, and increased stack usage.

Test: build oriole_hwasan
Bug: 229654778
Change-Id: I6ddb47d7224a9c6ddbf2641c043e3430d330c5a9
2023-06-16 17:34:59 -07:00
Florian Mayer
a998446d3e [hwasan] Also pass use-after-scope flag in LTO
Change-Id: I3df3d3047fd5aaa93e6c4b68885d39e20b12ccdb
2023-06-16 17:34:57 -07:00
Florian Mayer
2bddccd837 Reland "Re-enable stack frame size errors"
This reverts commit 25cd981362.

Reason for revert: b/274474681 is fixed.

Bug: 229654778
Change-Id: I4b975ced02ffe0d5a432a3033f05bb61868bec45
2023-06-16 22:34:41 +00:00
Trevor Radcliffe
ded095ce45 Bp2build Sanitizer Blocklist
Bug: 286894426
Test: Unit tests
Change-Id: I382e028410a185a5017dba1fc47c83ad5b2432cf
2023-06-13 20:46:27 +00:00
Trevor Radcliffe
f1836e4728 Add CFI flags to Compile Action
Bug: 261733820
Test: Unit Tests
Change-Id: I7c7cb8ab07da2c66df5d69e1e4af3337e3b24e6d
2023-06-05 18:09:21 +00:00
Colin Cross
390fc746d0 Disable sanitizers that use runtimes for linux_musl arm64
We don't built clang sanitizer runtimes for host arm64 yet,
disable sanitizer that need them when building for linux_musl arm64.

Test: builds
Change-Id: Id4fcb7f9743ac30121157b2294eb60216eaff7b3
2023-05-17 21:59:32 +00:00
Aditya Kumar
1281b99495 Disable LTO and CFI for riscv64
This reverts commit 24870216e9.

Reason for revert: b/282584808

Change-Id: I3808121b4437fdd01db5d305d8f0377e6ad7bd9e
2023-05-16 03:55:41 +00:00
Aditya Kumar
24870216e9 Revert "Disable LTO and CFI for riscv64"
This reverts commit ecf4e664e0.

Reason for revert: Not needed as emultated tls is now globally disabled https://android-review.git.corp.google.com/c/platform/build/soong/+/2431153

Change-Id: Idc3de2771afbbe2d5976f3c7974b3ffd15441b13
2023-05-12 18:46:42 +00:00
Hang Lu
a98aab98c4 Enable HWASan for multiple modules in one place(Soong)
Environment variables HWASAN_INCLUDE_PATHS and
PRODUCT_HWASAN_INCLUDE_PATHS can be used to enable HWASan for multiple
modules, by just adding the module directory to the env variable.

Bug: b/271948407
Test: Set specific module directory to above env variable and check the
assembly codes of output elf files after building, finding hwasan
related symbols inside.

Change-Id: Ic49b515830c4469ca5fa94f547b26c0fb602fc54
2023-04-19 22:59:54 +00:00
Florian Mayer
7de9aa1a7b Merge "Add handling for libc_hwasan to Soong" 2023-04-14 23:27:57 +00:00
Elliott Hughes
7d57090bb3 Merge "Temporarily disable shadow call stack for riscv64." 2023-04-13 01:47:42 +00:00
Elliott Hughes
5beb42fe22 Temporarily disable shadow call stack for riscv64.
We're trying to switch from x18 to gp for shadow call stack, ideally
without breaking anything, so let's disable shadow call stack while we
rearrange things behind the scenes...

Bug: http://b/277909695
Test: treehugger
Change-Id: Ic1a6bceaf0ab20dc66e1903747ebb668232a253a
2023-04-12 13:11:29 -07:00