From 930951827fa9b4a7db6b3c42ff7976acd3ff79c2 Mon Sep 17 00:00:00 2001 From: David CARLIER Date: Mon, 30 Dec 2024 15:02:52 +0000 Subject: [PATCH] bolts limit ashmem concept to Linux/Android only. (#2795) --- libafl_bolts/src/shmem.rs | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/libafl_bolts/src/shmem.rs b/libafl_bolts/src/shmem.rs index 2144af1ab5..d3b0d8b7c6 100644 --- a/libafl_bolts/src/shmem.rs +++ b/libafl_bolts/src/shmem.rs @@ -1134,7 +1134,7 @@ pub mod unix_shmem { } /// Module containing `ashmem` shared memory support, commonly used on Android. - #[cfg(all(unix, feature = "std"))] + #[cfg(all(any(target_os = "linux", target_os = "android"), feature = "std"))] pub mod ashmem { use alloc::string::ToString; use core::{ @@ -1154,7 +1154,6 @@ pub mod unix_shmem { }; /// An ashmem based impl for linux/android - #[cfg(unix)] #[derive(Clone, Debug)] pub struct AshmemShMem { id: ShMemId, @@ -1273,7 +1272,6 @@ pub mod unix_shmem { } } - #[cfg(unix)] impl ShMem for AshmemShMem { fn id(&self) -> ShMemId { self.id @@ -1295,7 +1293,6 @@ pub mod unix_shmem { } /// [`Drop`] implementation for [`AshmemShMem`], which cleans up the mapping. - #[cfg(unix)] impl Drop for AshmemShMem { #[expect(trivial_numeric_casts)] fn drop(&mut self) { @@ -1318,13 +1315,11 @@ pub mod unix_shmem { } /// A [`ShMemProvider`] which uses ashmem to provide shared memory mappings. - #[cfg(unix)] #[derive(Clone, Debug)] pub struct AshmemShMemProvider {} unsafe impl Send for AshmemShMemProvider {} - #[cfg(unix)] impl Default for AshmemShMemProvider { fn default() -> Self { Self::new().unwrap() @@ -1332,7 +1327,6 @@ pub mod unix_shmem { } /// Implement [`ShMemProvider`] for [`AshmemShMemProvider`], for the Android `ShMem`. - #[cfg(unix)] impl ShMemProvider for AshmemShMemProvider { type ShMem = AshmemShMem;