Closed alwinber closed 1 year ago
Is the current main branch still affected? I merged an update of the helpers calls in the last few days. Btw, the diff between the commit w/o and w/ the bug is https://github.com/AFLplusplus/qemu-libafl-bridge/compare/f6a2e732e8e225ebb8d1a9399561af7330af31b3..0dc52ed6f3915f727aaec8648706760f278f0571 and the instruction hooks were not touched, so probably a bug introduced with the merge from upstream
Yes, i took the current main branch at eae6f04, which has QEMU_REVISION = 3a774d.
for future reference: TCGHelperInfo for the libafl_hook strict was partially not initialized and it worked till a specific commit of QEMU because the code was just writing to it, while it checks the values and so it was keeping the dirty memory from malloc. Specifically, the assert was triggered because info->nr_in was trash (85 in my debugger).
Describe the bug The instruction hook in QEMU systemmode causes a failed assertion in QEMU.
To Reproduce Steps to reproduce the behavior (in LibAFL):
example.elf
.arm-linux-gnueabi-nm ./example/example.elf | grep main
[derive(Debug,Default)]
pub struct QemuInsHelper {}
impl
QemuHelperfor QemuInsHelper where S: UsesInput + HasMetadata, { fn firstexec(&self, hooks: &QemuHooks<' , QT, S>)
where
QT: QemuHelperTuple, { hooks.instruction(0x0000012a, exec_ins_hook::<QT, S>, false) // some valid address } }pub fn exec_ins_hook<QT, S>( hooks: &mut QemuHooks<', QT, S>, _state: Option<&mut S>, _pc: u32, ) where S: UsesInput, QT: QemuHelperTuple
, {}Expected behavior Hooks should be executed without crashing.
Screen output/Screenshots
Additional context I bisected the issue in the LibAFl repo and found 59bf11 (between 0.9.0 and 0.10.0) to be the last fully working revision, after which a different error from the current one prevented me from further analysis.