parent
7c9bd1157c
commit
4d45100a63
@ -236,7 +236,8 @@ pub fn merge(
|
|||||||
.scheduler_mut()
|
.scheduler_mut()
|
||||||
.on_remove(&mut state, idx, &Some(testcase))?;
|
.on_remove(&mut state, idx, &Some(testcase))?;
|
||||||
} else {
|
} else {
|
||||||
#[allow(clippy::needless_borrows_for_generic_args)] // False-positive: file_path is used just below
|
// False-positive: file_path is used just below
|
||||||
|
#[allow(clippy::needless_borrows_for_generic_args)]
|
||||||
rename(&file_path, &new_file_path)?;
|
rename(&file_path, &new_file_path)?;
|
||||||
*file_path = new_file_path;
|
*file_path = new_file_path;
|
||||||
}
|
}
|
||||||
|
@ -100,6 +100,7 @@ libafl_qemu_build = { path = "./libafl_qemu_build", version = "0.12.0" }
|
|||||||
pyo3-build-config = { version = "0.21", optional = true }
|
pyo3-build-config = { version = "0.21", optional = true }
|
||||||
rustversion = "1.0"
|
rustversion = "1.0"
|
||||||
bindgen = "0.69"
|
bindgen = "0.69"
|
||||||
|
cc = "1.0"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
name = "libafl_qemu"
|
name = "libafl_qemu"
|
||||||
|
@ -6,6 +6,13 @@ use std::{
|
|||||||
|
|
||||||
use libafl_qemu_build::maybe_generate_stub_bindings;
|
use libafl_qemu_build::maybe_generate_stub_bindings;
|
||||||
|
|
||||||
|
static LIBAFL_QEMU_RUNTIME_TEST: &str = r#"
|
||||||
|
#include <stdio.h>
|
||||||
|
#include "libafl_qemu.h"
|
||||||
|
|
||||||
|
int main() {}
|
||||||
|
"#;
|
||||||
|
|
||||||
#[allow(clippy::too_many_lines)]
|
#[allow(clippy::too_many_lines)]
|
||||||
pub fn build() {
|
pub fn build() {
|
||||||
// Note: Unique features are checked in libafl_qemu_sys
|
// Note: Unique features are checked in libafl_qemu_sys
|
||||||
@ -42,6 +49,17 @@ pub fn build() {
|
|||||||
let libafl_runtime_dir = src_dir.join("runtime");
|
let libafl_runtime_dir = src_dir.join("runtime");
|
||||||
let libafl_qemu_hdr = libafl_runtime_dir.join(libafl_qemu_hdr_name);
|
let libafl_qemu_hdr = libafl_runtime_dir.join(libafl_qemu_hdr_name);
|
||||||
|
|
||||||
|
let libafl_runtime_testfile = out_dir.join("runtime_test.c");
|
||||||
|
fs::write(&libafl_runtime_testfile, LIBAFL_QEMU_RUNTIME_TEST).expect("Could not write runtime test file");
|
||||||
|
|
||||||
|
let mut runtime_test_cc_compiler = cc::Build::new();
|
||||||
|
|
||||||
|
runtime_test_cc_compiler.cpp(false)
|
||||||
|
.include(&libafl_runtime_dir)
|
||||||
|
.file(&libafl_runtime_testfile);
|
||||||
|
|
||||||
|
runtime_test_cc_compiler.try_compile("runtime_test").unwrap();
|
||||||
|
|
||||||
let runtime_bindings_file = out_dir.join("libafl_qemu_bindings.rs");
|
let runtime_bindings_file = out_dir.join("libafl_qemu_bindings.rs");
|
||||||
let stub_runtime_bindings_file = src_dir.join("runtime/libafl_qemu_stub_bindings.rs");
|
let stub_runtime_bindings_file = src_dir.join("runtime/libafl_qemu_stub_bindings.rs");
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ typedef enum LibaflQemuEndStatus {
|
|||||||
libafl_word ret; \
|
libafl_word ret; \
|
||||||
__asm__ volatile ( \
|
__asm__ volatile ( \
|
||||||
"mov %1, %%rax\n" \
|
"mov %1, %%rax\n" \
|
||||||
".dword " XSTRINGIFY(opcode) "\n" \
|
".4byte " XSTRINGIFY(opcode) "\n" \
|
||||||
"mov %%rax, %0\n" \
|
"mov %%rax, %0\n" \
|
||||||
: "=g"(ret) \
|
: "=g"(ret) \
|
||||||
: "g"(action) \
|
: "g"(action) \
|
||||||
@ -102,7 +102,7 @@ typedef enum LibaflQemuEndStatus {
|
|||||||
__asm__ volatile ( \
|
__asm__ volatile ( \
|
||||||
"mov %1, %%rax\n" \
|
"mov %1, %%rax\n" \
|
||||||
"mov %2, %%rdi\n" \
|
"mov %2, %%rdi\n" \
|
||||||
".dword " XSTRINGIFY(opcode) "\n" \
|
".4byte " XSTRINGIFY(opcode) "\n" \
|
||||||
"mov %%rax, %0\n" \
|
"mov %%rax, %0\n" \
|
||||||
: "=g"(ret) \
|
: "=g"(ret) \
|
||||||
: "g"(action), "g"(arg1) \
|
: "g"(action), "g"(arg1) \
|
||||||
@ -118,7 +118,7 @@ typedef enum LibaflQemuEndStatus {
|
|||||||
"mov %1, %%rax\n" \
|
"mov %1, %%rax\n" \
|
||||||
"mov %2, %%rdi\n" \
|
"mov %2, %%rdi\n" \
|
||||||
"mov %3, %%rsi\n" \
|
"mov %3, %%rsi\n" \
|
||||||
".dword " XSTRINGIFY(opcode) "\n" \
|
".4byte " XSTRINGIFY(opcode) "\n" \
|
||||||
"mov %%rax, %0\n" \
|
"mov %%rax, %0\n" \
|
||||||
: "=g"(ret) \
|
: "=g"(ret) \
|
||||||
: "g"(action), "g"(arg1), "g"(arg2) \
|
: "g"(action), "g"(arg1), "g"(arg2) \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user