LibAFL
LibAFL copied to clipboard
Compiler Error with `HasInstrumentationFilter` Trait Implementation for `QemuEdgeCoverageHelper`
I'm encountering a compiler error when calling the update_filter method from the HasInstrumentationFilter trait on an instance of QemuEdgeCoverageHelper. The error message suggests that the compiler can't infer the type for the S type parameter in the HasInstrumentationFilter trait implementation for QemuEdgeCoverageHelper.
Here's the relevant code:
hooks
.match_helper_mut::<QemuEdgeCoverageHelper>()
.unwrap()
.update_filter(
QemuInstrumentationAddressRangeFilter::AllowList(ranges.clone()),
&emu,
);
The HasInstrumentationFilter trait is defined like this:
pub trait HasInstrumentationFilter<F, S>
where
F: IsFilter,
{
fn filter(&self) -> &F;
fn filter_mut(&mut self) -> &mut F;
fn update_filter(&mut self, filter: F, emu: &Qemu) {
*self.filter_mut() = filter;
emu.flush_jit();
}
}
And QemuEdgeCoverageHelper is defined without any generic parameters.
The S type parameter is not used in the update_filter method or in the QemuEdgeCoverageHelper struct. I'm not sure why it's part of the HasInstrumentationFilter trait's definition or how to specify a type for S when calling update_filter.
Any help or guidance on how to resolve this issue would be greatly appreciated.
Current workaround: I created a temporary HasQemuInstrumentationFilter trait defined as follows:
pub trait HasQemuInstrumentationFilter<F>
where
F: IsFilter
{
fn filter(&self) -> &F;
fn filter_mut(&mut self) -> &mut F;
fn update_filter(&mut self, filter: F, emu: &Qemu) {
*self.filter_mut() = filter;
emu.flush_jit();
}
}
And I'm using it only for the Helper(s) I need to update the filters for.
This is fixed too?
Yes!
On Sat, 8 Jun 2024, 02:29 tokatoka, @.***> wrote:
This is fixed too?
— Reply to this email directly, view it on GitHub https://github.com/AFLplusplus/LibAFL/issues/2037#issuecomment-2155692664, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABGW4SJ7LSBLBOVZNJSXR7DZGI66NAVCNFSM6AAAAABGARACGGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNJVGY4TENRWGQ . You are receiving this because you authored the thread.Message ID: @.***>