Fix python bindings (#3164)

* fix python bindings when compiling for ARM Qemu user

* apply partial precommit.sh
This commit is contained in:
jma 2025-04-17 13:07:16 +02:00 committed by GitHub
parent 8b194bdd40
commit e443d68a39
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 19 additions and 12 deletions

View File

@ -4,6 +4,7 @@ use capstone::arch::BuildsCapstone;
use enum_map::{EnumMap, enum_map}; use enum_map::{EnumMap, enum_map};
use num_enum::{IntoPrimitive, TryFromPrimitive}; use num_enum::{IntoPrimitive, TryFromPrimitive};
#[cfg(feature = "python")] #[cfg(feature = "python")]
#[allow(unused)]
use pyo3::prelude::*; use pyo3::prelude::*;
pub use strum_macros::EnumIter; pub use strum_macros::EnumIter;
pub use syscall_numbers::arm::*; pub use syscall_numbers::arm::*;

View File

@ -494,14 +494,14 @@ pub mod pybind {
extern "C" fn py_syscall_hook_wrapper( extern "C" fn py_syscall_hook_wrapper(
_data: u64, _data: u64,
sys_num: i32, sys_num: i32,
a0: u64, a0: GuestAddr,
a1: u64, a1: GuestAddr,
a2: u64, a2: GuestAddr,
a3: u64, a3: GuestAddr,
a4: u64, a4: GuestAddr,
a5: u64, a5: GuestAddr,
a6: u64, a6: GuestAddr,
a7: u64, a7: GuestAddr,
) -> hooks::SyscallHookResult { ) -> hooks::SyscallHookResult {
unsafe { (&raw const PY_SYSCALL_HOOK).read() }.map_or_else( unsafe { (&raw const PY_SYSCALL_HOOK).read() }.map_or_else(
|| hooks::SyscallHookResult::Run, || hooks::SyscallHookResult::Run,

View File

@ -5,10 +5,10 @@ use alloc::{
vec::Vec, vec::Vec,
}; };
use core::{cell::RefCell, marker::PhantomData, ops::Deref}; use core::{cell::RefCell, marker::PhantomData, ops::Deref};
use libafl::corpus::CorpusId;
use libafl::{ use libafl::{
Error, Error,
corpus::Corpus, corpus::{Corpus, CorpusId},
inputs::{BytesInput, HasMutatorBytes, ResizableMutator}, inputs::{BytesInput, HasMutatorBytes, ResizableMutator},
mutators::{ mutators::{
ComposedByMutations, MutationId, MutationResult, Mutator, MutatorsTuple, ScheduledMutator, ComposedByMutations, MutationId, MutationResult, Mutator, MutatorsTuple, ScheduledMutator,
@ -304,7 +304,10 @@ where
} }
#[inline] #[inline]
fn post_exec(&mut self, state: &mut S, new_corpus_id: Option<CorpusId>) -> Result<(), Error> { fn post_exec(&mut self, state: &mut S, new_corpus_id: Option<CorpusId>) -> Result<(), Error> {
self.mutator.deref().borrow_mut().post_exec(state, new_corpus_id) self.mutator
.deref()
.borrow_mut()
.post_exec(state, new_corpus_id)
} }
} }
@ -387,7 +390,10 @@ where
} }
#[inline] #[inline]
fn post_exec(&mut self, state: &mut S, new_corpus_id: Option<CorpusId>) -> Result<(), Error> { fn post_exec(&mut self, state: &mut S, new_corpus_id: Option<CorpusId>) -> Result<(), Error> {
self.mutator.deref().borrow_mut().post_exec(state, new_corpus_id) self.mutator
.deref()
.borrow_mut()
.post_exec(state, new_corpus_id)
} }
} }