diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 862ad8d7..3b410280 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -140,6 +140,7 @@ jobs: cargo run --target x86_64-linux-android --bin test -- nop # Build and run tests cargo test --target x86_64-linux-android + cargo clippy --all-features --all-targets --target x86_64-linux-android -- -D warnings deny-check: runs-on: ubuntu-24.04 diff --git a/src/linux/android.rs b/src/linux/android.rs index 2d9e70d5..4743c276 100644 --- a/src/linux/android.rs +++ b/src/linux/android.rs @@ -148,19 +148,18 @@ pub fn late_process_mappings( .ok() .and_then(|x| elf_header::Header::parse(&x).ok()); - if let Some(ehdr) = ehdr_opt { - if ehdr.e_type == elf_header::ET_DYN { - // Compute the effective load bias for this mapped library, and update - // the mapping to hold that rather than |start_addr|, at the same time - // adjusting |size| to account for the change in |start_addr|. Where - // the library does not contain Android packed relocations, - // GetEffectiveLoadBias() returns |start_addr| and the mapping entry - // is not changed. - let load_bias = - get_effective_load_bias(process_inspector, &ehdr, map.start_address); - map.size += map.start_address - load_bias; - map.start_address = load_bias; - } + if let Some(ehdr) = ehdr_opt + && ehdr.e_type == elf_header::ET_DYN + { + // Compute the effective load bias for this mapped library, and update + // the mapping to hold that rather than |start_addr|, at the same time + // adjusting |size| to account for the change in |start_addr|. Where + // the library does not contain Android packed relocations, + // GetEffectiveLoadBias() returns |start_addr| and the mapping entry + // is not changed. + let load_bias = get_effective_load_bias(process_inspector, &ehdr, map.start_address); + map.size += map.start_address - load_bias; + map.start_address = load_bias; } } Ok(()) diff --git a/src/linux/minidump_writer/mod.rs b/src/linux/minidump_writer/mod.rs index e66ede2a..ca7f4b29 100644 --- a/src/linux/minidump_writer/mod.rs +++ b/src/linux/minidump_writer/mod.rs @@ -52,7 +52,13 @@ pub mod thread_names_stream; /// The default timeout after a `SIGSTOP` after which minidump writing proceeds /// regardless of the process state -pub const STOP_TIMEOUT: Duration = Duration::from_millis(100); +pub const STOP_TIMEOUT: Duration = if cfg!(target_os = "android") { + // For whatever reason, Android can be terribly slow for stopping processes + // This often leads to our tests failing intermittently + Duration::from_secs(5) +} else { + Duration::from_millis(100) +}; #[cfg(target_pointer_width = "32")] pub const AT_SYSINFO_EHDR: u32 = 33; diff --git a/src/linux/process_inspection/process_reader.rs b/src/linux/process_inspection/process_reader.rs index a9f6a856..ee44339e 100644 --- a/src/linux/process_inspection/process_reader.rs +++ b/src/linux/process_inspection/process_reader.rs @@ -46,12 +46,11 @@ impl<'a> ProcessReader<'a> { // For now, only check the SO_NAME of Android APKS, because libraries may be mapped // directly from within an APK. See bug 1982902. #[cfg(target_os = "android")] - if name.ends_with(".apk") { - if let Ok(so_name) = crate::module_reader::read_soname_from_module(&mmem) { - if so_name == name { - return Some(mmem); - } - } + if name.ends_with(".apk") + && let Ok(so_name) = crate::module_reader::read_soname_from_module(&mmem) + && so_name == name + { + return Some(mmem); } None