Skip to content

Commit 6d55626

Browse files
authored
libafl_qemu: update qemu to v9.1.1 (#2636)
* update qemu to v9.1.1 * adapting stuff to qemu 9.1 * fix for new qemu gen_callN and x86 decoder * remove outdated qemu configuration option
1 parent c86e116 commit 6d55626

File tree

4 files changed

+10
-8
lines changed

4 files changed

+10
-8
lines changed

fuzzers/binary_only/fuzzbench_qemu/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ libafl_qemu = { path = "../../../libafl_qemu", features = [
3131
] }
3232
libafl_targets = { path = "../../../libafl_targets", version = "0.13.2" }
3333

34+
env_logger = "0.11.5"
3435
log = { version = "0.4.22", features = ["release_max_level_info"] }
3536
clap = { version = "4.5.18", features = ["default"] }
3637
nix = { version = "0.29.0", features = ["fs"] }

fuzzers/binary_only/fuzzbench_qemu/src/fuzzer.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -171,10 +171,11 @@ fn fuzz(
171171
logfile: PathBuf,
172172
timeout: Duration,
173173
) -> Result<(), Error> {
174+
env_logger::init();
174175
env::remove_var("LD_LIBRARY_PATH");
175176

176177
let args: Vec<String> = env::args().collect();
177-
let qemu = Qemu::init(&args).unwrap();
178+
let qemu = Qemu::init(&args).expect("QEMU init failed");
178179
// let (emu, asan) = init_with_asan(&mut args, &mut env).unwrap();
179180

180181
let mut elf_buffer = Vec::new();
@@ -197,7 +198,8 @@ fn fuzz(
197198

198199
let stack_ptr: u64 = qemu.read_reg(Regs::Sp).unwrap();
199200
let mut ret_addr = [0; 8];
200-
unsafe { qemu.read_mem(stack_ptr, &mut ret_addr) };
201+
qemu.read_mem(stack_ptr, &mut ret_addr)
202+
.expect("Error while reading QEMU memory.");
201203
let ret_addr = u64::from_le_bytes(ret_addr);
202204

203205
println!("Stack pointer = {stack_ptr:#x}");
@@ -337,7 +339,7 @@ fn fuzz(
337339
}
338340

339341
unsafe {
340-
qemu.write_mem(input_addr, buf);
342+
qemu.write_mem_unchecked(input_addr, buf);
341343

342344
qemu.write_reg(Regs::Rdi, input_addr).unwrap();
343345
qemu.write_reg(Regs::Rsi, len as GuestReg).unwrap();
@@ -397,7 +399,7 @@ fn fuzz(
397399
println!("Failed to load initial corpus at {:?}", &seed_dir);
398400
process::exit(0);
399401
});
400-
println!("We imported {} inputs from disk.", state.corpus().count());
402+
println!("We imported {} input(s) from disk.", state.corpus().count());
401403
}
402404

403405
let tracing = ShadowTracingStage::new(&mut executor);

libafl_qemu/libafl_qemu_build/src/bindings.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ const WRAPPER_HEADER: &str = r#"
8080
#include "tcg/tcg.h"
8181
#include "tcg/tcg-op.h"
8282
#include "tcg/tcg-internal.h"
83-
#include "exec/helper-head.h"
8483
8584
#include "qemu/plugin-memory.h"
8685

libafl_qemu/libafl_qemu_build/src/build.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use crate::cargo_add_rpath;
1111

1212
pub const QEMU_URL: &str = "https://github.com/AFLplusplus/qemu-libafl-bridge";
1313
pub const QEMU_DIRNAME: &str = "qemu-libafl-bridge";
14-
pub const QEMU_REVISION: &str = "c3c9c2128566ff325aa1a2bdcedde717f7d86e2c";
14+
pub const QEMU_REVISION: &str = "b01a0bc334cf11bfc5e8f121d9520ef7f47dbcd1";
1515

1616
#[allow(clippy::module_name_repetitions)]
1717
pub struct BuildResult {
@@ -158,7 +158,7 @@ fn configure_qemu(
158158
.arg("--disable-linux-aio")
159159
.arg("--disable-linux-io-uring")
160160
.arg("--disable-linux-user")
161-
.arg("--disable-live-block-migration")
161+
// .arg("--disable-live-block-migration")
162162
.arg("--disable-lzfse")
163163
.arg("--disable-lzo")
164164
.arg("--disable-l2tpv3")
@@ -174,7 +174,7 @@ fn configure_qemu(
174174
.arg("--disable-pa")
175175
.arg("--disable-parallels")
176176
.arg("--disable-png")
177-
.arg("--disable-pvrdma")
177+
// .arg("--disable-pvrdma")
178178
.arg("--disable-qcow1")
179179
.arg("--disable-qed")
180180
.arg("--disable-qga-vss")

0 commit comments

Comments
 (0)