Commit graph

9 commits

Author SHA1 Message Date
Ivan Lozano
aa7c980002 rust: Disable dead stripping for fuzzers.
Without `-C link-dead-code`, Rust fuzzers may fail to start fuzzing.
See the cargo-fuzz issue in the code comment for details. This patch
disables dead stripping for our fuzzers by default.

Bug: 193200135
Test: Flag emitted when building Rust fuzzers.
Test: Fuzzer runs on device.
Change-Id: I530de30e9a57db206bcbf3d2d3d371628eef8934
2021-08-02 11:11:11 -04:00
Ivan Lozano
d7586b6526 Refactor vendor snapshot to use LinkableInterface.
Refactors the vendor snapshot support to use the LinkableInterface
so that support can be extended to Rust. This CL does not add
vendor snapshot support for Rust; that is left for a follow-on CL.

Bug: 184042776
Test: m nothing
Change-Id: Id0c4970ca00053484a52677d182153cbc454c301
2021-05-12 14:01:10 -04:00
Tri Vo
505b0e8991 rust: Switch rust_fuzz to HWASan
Bug: 180495975
Test: example_rust_fuzzer
Change-Id: I26e6f15136ee2d5f4ed1167be5c1c6a14b19421a
2021-04-13 15:58:44 -07:00
Tri Vo
eed4716def Merge changes I46e851c8,I2c9eb248
* changes:
  rust: Add HWASan build support
  Export CC HWASan sanitizer type
2021-04-09 22:31:09 +00:00
Tri Vo
0a74c3e06e rust: Add HWASan build support
HWASan for static Rust executables is not supported yet.

Bug: 180495975
Test: build local test app with HWASan
Change-Id: I46e851c82a16943586ec3a789f09a58651d036e3
2021-04-09 10:59:23 -07:00
Ivan Lozano
20fcfdf489 rust: Remove stack-depth sancov
This flag causes a linkage error between rustc and our libclang_rt. We
can remove it for now and look into reintroducing it in the future.

We'd need to define 'thread_local uintptr_t __sancov_lowest_stack' to
support this. See https://reviews.llvm.org/D36839

Bug: 180495975
Test: m <fuzzer>
Change-Id: I95c9392307b5f20a0eda0fc76eb7ef79e27ae4df
2021-04-09 13:22:27 -04:00
Ivan Lozano
c044f5bce8 rust: Update libfuzzer flags for rust_fuzz
libfuzzer-sys uses different flags in the 0.4.0 update, so update the
flags for rust_fuzz modules to align.

Test: m <example_fuzzer>
Change-Id: I0a1eb140a7843fdaf5266c05a1ecf6d3964e0f5e
2021-04-02 12:43:28 -04:00
Tri Vo
7af79fb49b Remove "-C link-dead-code=y" flag
sysroot no longer builds with this flag.

LLVM ERROR: Cannot select: 0x7f7c39be9b48: v8i8 = AArch64ISD::VSLI 0x7f7c39696120, 0x7f7c39693fc8, 0x7f7c39d86528, prebuilts/rust/linux-x86/1.50.0/src/stdlibs/library/core/src/../../stdarch/crates/core_arch/src/aarch64/neon/mod.rs:2324:5
  0x7f7c39696120: v8i8,ch = CopyFromReg 0x7f7c420b1c98, Register:v8i8 %13, prebuilts/rust/linux-x86/1.50.0/src/stdlibs/library/core/src/../../stdarch/crates/core_arch/src/aarch64/neon/mod.rs:2324:5
    0x7f7c39be90e8: v8i8 = Register %13
  0x7f7c39693fc8: v8i8,ch = load<(dereferenceable load 8 from %ir.b)> 0x7f7c420b1c98, 0x7f7c39694510, undef:i64, prebuilts/rust/linux-x86/1.50.0/src/stdlibs/library/core/src/../../stdarch/crates/core_arch/src/aarch64/neon/mod.rs:2324:19
    0x7f7c39694510: i64,ch = CopyFromReg 0x7f7c420b1c98, Register:i64 %17, prebuilts/rust/linux-x86/1.50.0/src/stdlibs/library/core/src/../../stdarch/crates/core_arch/src/aarch64/neon/mod.rs:2324:19
      0x7f7c39be52d8: i64 = Register %17
    0x7f7c39bea230: i64 = undef
  0x7f7c39d86528: i32,ch = CopyFromReg 0x7f7c420b1c98, Register:i32 %18, prebuilts/rust/linux-x86/1.50.0/src/stdlibs/library/core/src/../../stdarch/crates/core_arch/src/aarch64/neon/mod.rs:2324:5
    0x7f7c39be5ea0: i32 = Register %18
In function: _RNvNtNtNtCsfOHkQPwunBC_4core9core_arch7aarch644neon9vsli_n_s8B7_
11:40:52 ninja failed with: exit status 1

Bug: 147140513
Test: build/run local rust_fuzz executable with asan+sancov.
Change-Id: I00c81f25f562bb9f18169a199eaf95ebeb7dbbe6
2021-03-17 18:00:28 -07:00
Ivan Lozano
6cd99e6ab4 Add Rust fuzzing support.
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
2021-01-25 11:11:10 -05:00