summaryrefslogtreecommitdiff
path: root/rust/fuzz.go
AgeCommit message (Collapse)Author
2024-12-17Merge "rust: Alias rust_ffi_rlib to rust_library_rlib" into main Maciej Żenczykowski
2024-12-16Remove an unused PackageFuzzModule arg Spandan Das
Test: m nothing --no-skip-soong-tests Change-Id: I9b1311e5e424b29ff93d4a3271e882008bed302a
2024-12-13rust: Alias rust_ffi_rlib to rust_library_rlib Ivan Lozano
With the new transition mutators, the distinctions between rust_ffi_rlib and rust_library_rlib are not necessary. This CL removes the remaining distinctions to allow an unusual use case where a rust_library and a rust_ffi_rlib would otherwise be created from the same source. This would allow defining a single rust_library_rlib that works for both rust modules and cc modules. One key change is that rust_ffi_rlibs only produced an rlib-std variant previously, and now produce dylib-std variants as well.This surfaced an issue where a libstd linkage mismatch would cause rustc to throw a consufing missing crate error. We instead add logic to catch this in Soong and provide a more useful error message. Bug: 383552450 Test: m rust Test: m blueprint_tests Change-Id: I611ca46934059735d06229952cfd8e0ab7050486
2023-12-28fuzz packaging: implement system/vendor split Steven Moreland
This wasn't needed when fuzzers had their own lib directories, but because the lib directories were combined, this caused interactions because system and vendor libraries were mixed in the same folder, sometimes overriding each other. Comments are left with some details about future issues. Bug has a series of recommendations to prevent issue again. The main goal of this patch is to get the fuzzers working, not fix every issue here. Bug: 307611931 Test: run vendor fuzzer and check lsof: android.hardwar 22719 root txt REG 254,94 4350056 3455 /data/fuzz/x86_64/android.hardware.drm-service.<name>.aidl_fuzzer/vendor/android.hardware.drm-service.<name>.aidl_fuzzer android.hardwar 22719 root mem REG 254,94 4350056 3455 /data/fuzz/x86_64/android.hardware.drm-service.<name>.aidl_fuzzer/vendor/android.hardware.drm-service.<name>.aidl_fuzzer android.hardwar 22719 root mem REG 254,94 1047232 3464 /data/fuzz/x86_64/lib/vendor/libbase.so android.hardwar 22719 root mem REG 254,94 4027304 3460 /data/fuzz/x86_64/lib/vendor/libcrypto.so android.hardwar 22719 root mem REG 254,94 4021632 3467 /data/fuzz/x86_64/lib/vendor/libbinder.so android.hardwar 22719 root mem REG 254,94 329408 3466 /data/fuzz/x86_64/lib/vendor/libcutils.so android.hardwar 22719 root mem REG 254,94 508968 3463 /data/fuzz/x86_64/lib/vendor/libutils.so android.hardwar 22719 root mem REG 254,94 592944 3465 /data/fuzz/x86_64/lib/vendor/libclang_rt.ubsan_standalone-x86_64-android.so android.hardwar 22719 root mem REG 254,94 2328616 3462 /data/fuzz/x86_64/lib/vendor/libc++.so and run a system fuzzer servicemanager_ 27878 root txt REG 254,94 609736 67408 /data/fuzz/x86_64/servicemanager_fuzzer/servicemanager_fuzzer servicemanager_ 27878 root mem REG 254,94 609736 67408 /data/fuzz/x86_64/servicemanager_fuzzer/servicemanager_fuzzer servicemanager_ 27878 root mem REG 254,94 4390560 4074 /data/fuzz/x86_64/lib/libvintf.so servicemanager_ 27878 root mem REG 254,94 13872 4077 /data/fuzz/x86_64/lib/libvndksupport.so servicemanager_ 27878 root mem REG 254,94 13872 4077 /data/fuzz/x86_64/lib/libvndksupport.so servicemanager_ 27878 root mem REG 254,94 13872 4077 /data/fuzz/x86_64/lib/libvndksupport.so servicemanager_ 27878 root mem REG 254,94 11584 4086 /data/fuzz/x86_64/lib/libdl.so and run a system fuzzer servicemanager_ 27878 root txt REG 254,94 609736 67408 /data/fuzz/x86_64/servicemanager_fuzzer/servicemanager_fuzzer servicemanager_ 27878 root mem REG 254,94 609736 67408 /data/fuzz/x86_64/servicemanager_fuzzer/servicemanager_fuzzer servicemanager_ 27878 root mem REG 254,94 4390560 4074 /data/fuzz/x86_64/lib/libvintf.so servicemanager_ 27878 root mem REG 254,94 13872 4077 /data/fuzz/x86_64/lib/libvndksupport.so servicemanager_ 27878 root mem REG 254,94 13872 4077 /data/fuzz/x86_64/lib/libvndksupport.so servicemanager_ 27878 root mem REG 254,94 13872 4077 /data/fuzz/x86_64/lib/libvndksupport.so servicemanager_ 27878 root mem REG 254,94 11584 4086 /data/fuzz/x86_64/lib/libdl.so Change-Id: I91a51d2f1cb537cfaae8379998078188f2b10a98
2023-11-30Move test data installation to Soong Colin Cross
To generate module-info.json in Soong for b/309006256 Soong needs to know the test data paths. Moving test data installation into Soong will also help later for test suite packaging. Add ModuleContext.InstallTestData that installs the files listed in a []DataPath alongside the test. The files will also be passed to Make to allow it to continue packaging them into the test suites for now. Update the module types that are producing LOCAL_TEST_DATA entries in their Android.mk files to go through InstallTestData instead. Bug: 311428265 Test: atest --host toybox-gtests --test-timeout=120000 Change-Id: Ia8b964f86e584ea464667fd86a48d754d118bead
2023-08-25rust: Rust sanitized snapshots variations Ivan Lozano
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-10rust: Add support for host fuzzers. Ivan Lozano
Adds support for host-based Rust fuzzers. Bug: 282897366 Test: SANITZE_HOST="address" m <host_fuzzer> Test: run fuzzer Change-Id: Ibb951f651ef12e763778ebbf12e66769a7113920
2023-05-09Support removing suffix for device specific prebuilt during build Hamzeh Zawawy
Some device specific prebuilts have a suffix that varies depending on the lunch target. The resulting install dependency binary has the suffix. The fuzzer build expects the presubmit binary without the suffix. This change is to drop the suffix. Test: make haiku Change-Id: I8eadd84bf5797659b17bc428dca47b7c3f382aff
2023-02-06Copy Rust fuzzer dependencies to /data. Ivan Lozano
Fix an issue where rust_fuzz modules were not correctly packaging and copying their dependencies. This is done by extending the CC fuzz packager to simply handle both Rust and CC modules, ensuring this doesn't get out of sync again. Fuzzer related functions are added to the Linkable interface to facilitate this. There was a bug where the Make definitions for Rust fuzzers were not being created as well, and that is addressed here. Bug: 249551848 Test: m android_log_fuzzer #check $OUT/data/fuzz/arm64/libs Change-Id: I9b41153e0cf08ab510476b75003c3a3baccc3858
2022-10-20Output shared dependendencies of JNI libs for Java fuzzers Muhammad Haseeb Ahmad
Test: m example_java_jni_fuzzer Bug: 252846698 Change-Id: Ib583de335482350bfe293f9c3d021a595edd4f44
2022-10-04Move fuzzer's CollectAllSharedDependencies into GenerateAndroidBuildActions Colin Cross
Make rust and cc fuzzers collect their shared libraries once in GenerateAndroidBuildActions and store it for later use by the packaging singleton. Also use android.OutputFileForModule to get the paths. Together this will fix fuzzers that depend on architecture specific prebuilt shared libraries that are missing a prebuilt for an architecture when building with AllowMissingDependencies. Bug: 250918230 Test: lunch aosp_riscv64-userdebug && m ALLOW_MISSING_DEPENDENCIES=true nothing Change-Id: I154a6f3a767c883e9fe7067003615db73ee78e2d
2022-07-12Adding support for building AFLpp Cory Barker
Test: Build AFL fuzzers locally and ran them Change-Id: Ie4fbd258c87663cf81d7d64d575b3da1d5febc17
2021-11-12Merge changes I26198187,Ia904d07b Ivan Lozano
* changes: rust: Support MTE memtag_heap sanitizer rust: Support global sanitizers
2021-11-09rust: Refactor stripped output file path Ivan Lozano
Rust installed files reside in "$MODULE_OUT/stripped/" when they are stripped, otherwise they reside in "$MODULE_OUT". However, other parts of Soong assume that installed files are always in $MODULE_OUT (cc_modules place *unstripped* files in $MODULE_OUT/unstripped). This notably causes problems when adding Rust modules as test data in AndroidMkDataPaths. When Rust modules are parsed by AndroidMkDataPaths, if they are stripped then they incorrectly get installed as test data with the path: <install_root>/<relative_install_path>/stripped/file. This CL refactors how we handle Rust stripped output such that the installed file always resides in $MODULE_OUT. Bug: 171710847 Test: Installed files now always reside in $MODULE_OUT Change-Id: I53a6ff57a0a5a55cd95ea78ae592ce22abfa20c9
2021-11-03rust: Support global sanitizers Ivan Lozano
This CL adds Rust support for the SANITIZE_TARGET options. This CL includes a couple small fixes to related to HWASAN, ASAN, ensuring that the Never sanitize property is respected. Notably, additional llvm-args are passed to ensure that HWASAN-ified Rust/C interop works correctly. Bug: 170672854 Bug: 204915322 Test: SANITIZE_TARGET globally applies hwasan to Rust targets Change-Id: Ia904d07b4618f72cdc95c51f88961905c240ac53
2021-10-14rust: Package shared libraries with fuzzer zips Ivan Lozano
Rust fuzzers were not packaging up their CC shared dependencies. This would lead to fuzzers using the shared libraries included on system, which may not be sanitized, leading to incorrect behavior. This refactors the relevant code from CC and calls it from the Rust build logic. Bug: 202282599 Test: output rust fuzzer zip file includes shared dependencies. Change-Id: I92196eb0141733797a67eae24f8e9aedea94c3bc
2021-08-11Moving common fuzzing code to fuzz package hamzeh
Test: make haiku and make haiku-rust Change-Id: Ife80cc10672f51bd6afbae7061cc9373a2a15e7d
2021-07-16Refactoring fuzz packaging code hamzeh
Rust and cc fuzz packaging have common. This change is to put this common methods and fields into fuzz_common. Test: make haiku and make haiku-rust ran locally and verify corpus, dict and config are packaged along with the executable. Change-Id: I04bf535cd2597ed8b2bd3d8e6ea8c28f38bdc18b
2021-05-01Add support for packaging rust fuzzers hamzeh
Test: make haiku-rust Change-Id: Idd4d836d11e0ae615b59c6648d49348449589787
2021-04-13rust: Switch rust_fuzz to HWASan Tri Vo
Bug: 180495975 Test: example_rust_fuzzer Change-Id: I26e6f15136ee2d5f4ed1167be5c1c6a14b19421a
2021-04-12rust_fuzzer: add toolchain libraries if non-empty Liz Kammer
Test: bp2build Test: m nothing Fixes: 185163319 Change-Id: Id8b8e5b21b71f949fa8fa27f8c8cc4aba00c1f7d
2021-02-04bp2build: convert paths/module refs to Bazel label Liz Kammer
This currently expands all globs, still need to support converting glob syntax. Test: go build_conversion_test Test: GENERATE_BAZEL_FILES=true m nothing Test: m nothing Bug: 165114590 Change-Id: If7b26e8e663d17566fad9614ca87a8da1f095284
2021-01-25Add Rust fuzzing support. Ivan Lozano
Add a rust_fuzz module which builds a libfuzzer binary that enabes asan+sancov. This relies on the libfuzzer-sys crate. Bug: 147140513 Test: Local rust_fuzz example builds, fuzzes with asan+sancov. Change-Id: I57db3b8d25869791824ccfab768d13b0bb9d42fa