| Crates.io | shmem_providers |
| lib.rs | shmem_providers |
| version | 0.15.4 |
| created_at | 2025-11-13 00:32:06.41642+00 |
| updated_at | 2025-11-13 00:32:06.41642+00 |
| description | Platform independent shared memory providers for Windows, Linux, Android, iOS, ... |
| homepage | |
| repository | https://github.com/AFLplusplus/LibAFL/ |
| max_upload_size | |
| id | 1930195 |
| size | 138,482 |
shmem_providers: Cross-Platform Shared Memory for High-Performance IPCshmem_providers is a crate that provides a unified, cross-platform API for creating and using shared memory. Shared memory is a key component for high-performance inter-process communication (IPC), which is essential for fuzzing with LibAFL. For example, it's used to share coverage maps, corpus inputs, or other data between the fuzzer process and the target application without expensive copies.
This crate abstracts away the platform-specific details of shared memory implementation, allowing developers to write portable code that works across Windows, Linux, macOS, Android, and other Unix-like systems.
The crate exposes two main traits:
ShMem: Represents a segment of shared memory. It behaves like a mutable byte slice (&mut [u8]), allowing direct memory manipulation. Each segment has a unique ShMemId that can be used to reopen it from another process.ShMemProvider: A factory for creating and accessing ShMem segments. It handles the OS-specific logic for allocating, mapping, and managing shared memory regions.By using the StdShMemProvider type alias, you can use the default, recommended provider for the current target platform, simplifying the creation of cross-platform tools.
shmem_providers automatically selects the best implementation for your target OS:
CreateFileMappingA and MapViewOfFile for shared memory.memfd_create where available, falling back to POSIX (shm_open and mmap) or System V IPC (shmget/shmat).shm_open and mmap. Due to kernel behavior on macOS, it often requires a server-based approach (ShMemService) to reliably manage and clean up shared memory segments between processes.ashmem subsystem, which is Android's specialized shared memory mechanism.The crate also includes advanced abstractions for complex scenarios:
ShMemService: A server-based provider for platforms that require a central process to manage shared memory lifecycles. This is particularly useful on macOS.RcShMemProvider: A reference-counted wrapper that allows a provider to be safely shared across threads and handles the necessary setup and teardown logic across fork() calls in multi-process applications.LibAFL ProjectThe LibAFL project is part of AFLplusplus and maintained by
For bugs, feel free to open issues or contact us directly. Thank you for your support. <3
Even though we will gladly assist you in finishing up your PR, try to
cfgs.)cargo nightly fmt on your code before pushingcargo clippy --all or ./clippy.shcargo build --no-default-features to check for no_std compatibility (and possibly add #[cfg(feature = "std")]) to hide parts of your code.Some parts in this list may sound hard, but don't be afraid to open a PR if you cannot fix them by yourself. We will gladly assist.