We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ShMem
You can recreate #1748 with the impl DerefMut<Target = [u8]> for MmapShMem.
impl DerefMut<Target = [u8]>
MmapShMem
// cargo init // cargo add --no-default-features --features=std --git https://github.com/AFLplusplus/LibAFL libafl_bolts // cargo run use std::ops::{DerefMut as _}; use libafl_bolts::shmem::{ShMemProvider as _}; pub fn main() { let mut prov = libafl_bolts::shmem::MmapShMemProvider::default(); let mut shmem1 = unsafe { prov.new_on_shmem::<u8>(0).unwrap_unchecked() }; let mut shmem2 = unsafe { prov.clone_ref(&shmem1).unwrap_unchecked() }; let r1 = &mut shmem1.deref_mut()[0]; let r2 = &mut shmem2.deref_mut()[0]; go(r1, r2); } pub fn go(r1: &mut u8, r2: &mut u8) { mut_r1(r1); mut_r2(r2); if *r1 == 1 { println!("r1 = {r1}"); } } pub fn mut_r1(r1: &mut u8) { *r1 = 1; } pub fn mut_r2(r2: &mut u8) { *r2 = 32; }
Prints
r1 = 32
The text was updated successfully, but these errors were encountered:
Unfortunately, this DerefMut instance provides as_slice_mut, which appears to be the predominant way of accessing shared memory throughout the codebase: https://github.com/search?q=repo%3AAFLplusplus%2FLibAFL+%2Fshmem.as_slice_mut%2F&type=code
DerefMut
as_slice_mut
Sorry, something went wrong.
Looking through the codebas, this PR introduced DerefMut here.. b024846
Maybe we can undo parts of it?
No branches or pull requests
You can recreate #1748 with the
impl DerefMut<Target = [u8]>
forMmapShMem
.Prints
The text was updated successfully, but these errors were encountered: