Fix cfg clippy for libafl_qemu (#2397)

* optional final comma

* fix systemmode
This commit is contained in:
Romain Malmain 2024-07-16 00:37:54 +02:00 committed by GitHub
parent 9d5be4ede1
commit e8de3591bf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 11 additions and 4 deletions

View File

@ -5,7 +5,7 @@ macro_rules! assert_unique_feature {
() => {};
($first:tt $(,$rest:tt)*) => {
$(
#[cfg(all(not(any(doc, feature = "clippy")), feature = $first, feature = $rest))]
#[cfg(all(not(doc), feature = $first, feature = $rest))]
compile_error!(concat!("features \"", $first, "\" and \"", $rest, "\" cannot be used together"));
)*
assert_unique_feature!($($rest),*);

View File

@ -164,7 +164,7 @@ macro_rules! export_rust_runtime_fn {
// special case for build_integer_from_buffer cuz the next one just doesn't work!!!!!!!
(pub fn build_integer_from_buffer(
buffer: *mut ::std::os::raw::c_void,
num_bits: ::std::os::raw::c_uint,) -> RSymExpr,$c_name:ident; $rt_cb:path) => {
num_bits: ::std::os::raw::c_uint$(,)?) -> RSymExpr,$c_name:ident; $rt_cb:path) => {
#[allow(clippy::missing_safety_doc)]
#[no_mangle]
pub unsafe extern "C" fn _rsym_build_integer_from_buffer(buffer: *mut ::std::os::raw::c_void, num_bits: ::std::os::raw::c_uint) {

View File

@ -17,7 +17,6 @@ rustdoc-args = ["--cfg", "docsrs"]
[features]
default = ["fork", "build_libgasan", "build_libqasan", "serdeany_autoreg", "injections"]
clippy = [] # special feature for clippy, don't use in normal projects§
document-features = ["dep:document-features"]
paranoid_debug = ["libafl_qemu_sys/paranoid_debug"] # Will perform as many checks as possible. The target will be greatly slowed down.
@ -62,6 +61,10 @@ slirp = [ "systemmode", "libafl_qemu_sys/slirp" ] # build qemu with host libslir
# Requires the binary's build.rs to call `build_libafl_qemu`
shared = [ "libafl_qemu_sys/shared" ]
#! ## Internal features, don't use in normal projects
## clippy workaround
clippy = ["libafl_qemu_sys/clippy"]
[dependencies]
libafl = { path = "../libafl", version = "0.13.1", default-features = false, features = ["std", "derive", "regex"] }
libafl_bolts = { path = "../libafl_bolts", version = "0.13.1", default-features = false, features = ["std", "derive"] }

View File

@ -118,7 +118,7 @@ pub unsafe fn inproc_qemu_timeout_handler<'a, E, EM, OF, Z>(
EM: EventFirer<State = E::State> + EventRestarter<State = E::State>,
OF: Feedback<E::State>,
E::State: HasSolutions + HasCorpus + HasExecutions,
Z: HasObjective<Objective = OF, State = E::State>,
Z: HasObjective<Objective = OF, State = E::State> + ExecutionProcessor + HasScheduler,
{
if BREAK_ON_TMOUT {
qemu_system_debug_request();

View File

@ -82,8 +82,12 @@ create_hook_id!(Block, libafl_qemu_remove_block_hook, true);
create_hook_id!(Read, libafl_qemu_remove_read_hook, true);
create_hook_id!(Write, libafl_qemu_remove_write_hook, true);
create_hook_id!(Cmp, libafl_qemu_remove_cmp_hook, true);
#[cfg(emulation_mode = "usermode")]
create_hook_id!(PreSyscall, libafl_qemu_remove_pre_syscall_hook, false);
#[cfg(emulation_mode = "usermode")]
create_hook_id!(PostSyscall, libafl_qemu_remove_post_syscall_hook, false);
#[cfg(emulation_mode = "usermode")]
create_hook_id!(NewThread, libafl_qemu_remove_new_thread_hook, false);
#[derive(Debug)]