From 88eb0d16a7ad5c3ce2b8be9726314efc4043485c Mon Sep 17 00:00:00 2001 From: Simon Chopin Date: Mon, 17 Aug 2026 10:34:52 +0200 Subject: [PATCH 1/3] android: fix collapsible_if Clippy warnings --- src/linux/android.rs | 25 +++++++++---------- .../process_inspection/process_reader.rs | 11 ++++---- 2 files changed, 17 insertions(+), 19 deletions(-) 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/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 From f7cd82dad70e79f9676ded0638821e762a81c9bb Mon Sep 17 00:00:00 2001 From: Simon Chopin Date: Mon, 17 Aug 2026 10:32:42 +0200 Subject: [PATCH 2/3] ci: add a clippy run at the end of the Android tests --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) 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 From ae86e23fe164eedf29fcda570ba42f2b8e87f330 Mon Sep 17 00:00:00 2001 From: Chris Martin Date: Thu, 17 Jul 2025 10:58:23 -0400 Subject: [PATCH 3/3] Increase SIGSTOP timeout on Android This should hopefully reduce the number of intermittent failures due to slow emulator/hardware. --- src/linux/minidump_writer/mod.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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;