Moving libafl related files in dedicating folders (#60)
* Restructuration of libafl dirs. Formatting + export of maps struct and functions. * Fix wrong header path. * Fix misc path
This commit is contained in:
parent
e99b9da658
commit
50b0c90e0a
@ -715,7 +715,7 @@ static inline void cpu_handle_debug_exception(CPUState *cpu)
|
|||||||
|
|
||||||
//// --- Begin LibAFL code ---
|
//// --- Begin LibAFL code ---
|
||||||
|
|
||||||
#include "libafl_extras/exit.h"
|
#include "libafl/exit.h"
|
||||||
|
|
||||||
//// --- End LibAFL code ---
|
//// --- End LibAFL code ---
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
|
|
||||||
//// --- Begin LibAFL code ---
|
//// --- Begin LibAFL code ---
|
||||||
|
|
||||||
#include "libafl_extras/exit.h"
|
#include "libafl/exit.h"
|
||||||
|
|
||||||
#ifndef CONFIG_USER_ONLY
|
#ifndef CONFIG_USER_ONLY
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@
|
|||||||
|
|
||||||
//// --- Begin LibAFL code ---
|
//// --- Begin LibAFL code ---
|
||||||
|
|
||||||
#include "libafl_extras/hook.h"
|
#include "libafl/hook.h"
|
||||||
|
|
||||||
//// --- End LibAFL code ---
|
//// --- End LibAFL code ---
|
||||||
|
|
||||||
|
@ -114,8 +114,8 @@ static void gen_tb_end(const TranslationBlock *tb, uint32_t cflags,
|
|||||||
|
|
||||||
//// --- Begin LibAFL code ---
|
//// --- Begin LibAFL code ---
|
||||||
|
|
||||||
#include "libafl_extras/exit.h"
|
#include "libafl/exit.h"
|
||||||
#include "libafl_extras/hook.h"
|
#include "libafl/hook.h"
|
||||||
|
|
||||||
#ifndef TARGET_LONG_BITS
|
#ifndef TARGET_LONG_BITS
|
||||||
#error "TARGET_LONG_BITS not defined"
|
#error "TARGET_LONG_BITS not defined"
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
|
|
||||||
//// --- Begin LibAFL code ---
|
//// --- Begin LibAFL code ---
|
||||||
#ifdef CONFIG_SOFTMMU
|
#ifdef CONFIG_SOFTMMU
|
||||||
#include "libafl_extras/syx-snapshot/syx-snapshot.h"
|
#include "libafl/syx-snapshot/syx-snapshot.h"
|
||||||
#endif
|
#endif
|
||||||
//// --- End LibAFL code ---
|
//// --- End LibAFL code ---
|
||||||
|
|
||||||
|
@ -45,8 +45,8 @@
|
|||||||
|
|
||||||
//// --- Begin LibAFL code ---
|
//// --- Begin LibAFL code ---
|
||||||
|
|
||||||
#include "libafl_extras/exit.h"
|
#include "libafl/exit.h"
|
||||||
#include "libafl_extras/hook.h"
|
#include "libafl/hook.h"
|
||||||
|
|
||||||
static __thread GByteArray *libafl_qemu_mem_buf = NULL;
|
static __thread GByteArray *libafl_qemu_mem_buf = NULL;
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
#include "device-save.h"
|
#include "device-save.h"
|
||||||
#include "syx-cow-cache.h"
|
#include "syx-cow-cache.h"
|
||||||
#include "../syx-misc.h"
|
#include "libafl/syx-misc.h"
|
||||||
|
|
||||||
#define SYX_SNAPSHOT_COW_CACHE_DEFAULT_CHUNK_SIZE 64
|
#define SYX_SNAPSHOT_COW_CACHE_DEFAULT_CHUNK_SIZE 64
|
||||||
#define SYX_SNAPSHOT_COW_CACHE_DEFAULT_MAX_BLOCKS (1024 * 1024)
|
#define SYX_SNAPSHOT_COW_CACHE_DEFAULT_MAX_BLOCKS (1024 * 1024)
|
16
include/libafl/user.h
Normal file
16
include/libafl/user.h
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "qemu/osdep.h"
|
||||||
|
#include "qapi/error.h"
|
||||||
|
|
||||||
|
struct libafl_mapinfo {
|
||||||
|
target_ulong start;
|
||||||
|
target_ulong end;
|
||||||
|
target_ulong offset;
|
||||||
|
const char* path;
|
||||||
|
int flags;
|
||||||
|
int is_priv;
|
||||||
|
};
|
||||||
|
|
||||||
|
IntervalTreeNode * libafl_maps_first(IntervalTreeRoot * map_info);
|
||||||
|
IntervalTreeNode * libafl_maps_next(IntervalTreeNode *node, struct libafl_mapinfo* ret);
|
@ -1,4 +1,4 @@
|
|||||||
#include "exit.h"
|
#include "libafl/exit.h"
|
||||||
|
|
||||||
#include "sysemu/runstate.h"
|
#include "sysemu/runstate.h"
|
||||||
#include "cpu.h"
|
#include "cpu.h"
|
@ -4,8 +4,8 @@
|
|||||||
#include "exec/exec-all.h"
|
#include "exec/exec-all.h"
|
||||||
#include "exec/tb-flush.h"
|
#include "exec/tb-flush.h"
|
||||||
|
|
||||||
#include "hook.h"
|
#include "libafl/hook.h"
|
||||||
#include "exit.h"
|
#include "libafl/exit.h"
|
||||||
|
|
||||||
#ifndef TARGET_LONG_BITS
|
#ifndef TARGET_LONG_BITS
|
||||||
#error "TARGET_LONG_BITS not defined"
|
#error "TARGET_LONG_BITS not defined"
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
#include "exec/exec-all.h"
|
#include "exec/exec-all.h"
|
||||||
|
|
||||||
#include "jit.h"
|
#include "libafl/jit.h"
|
||||||
|
|
||||||
#ifndef TARGET_LONG_BITS
|
#ifndef TARGET_LONG_BITS
|
||||||
#error "TARGET_LONG_BITS not defined"
|
#error "TARGET_LONG_BITS not defined"
|
@ -1,7 +1,13 @@
|
|||||||
|
specific_ss.add(files(
|
||||||
|
'exit.c',
|
||||||
|
'hook.c',
|
||||||
|
'jit.c'
|
||||||
|
))
|
||||||
|
|
||||||
specific_ss.add(when: 'CONFIG_SOFTMMU', if_true: [files(
|
specific_ss.add(when: 'CONFIG_SOFTMMU', if_true: [files(
|
||||||
'syx-snapshot/device-save.c',
|
'syx-snapshot/device-save.c',
|
||||||
'syx-snapshot/syx-snapshot.c',
|
'syx-snapshot/syx-snapshot.c',
|
||||||
'syx-snapshot/syx-cow-cache.c',
|
'syx-snapshot/syx-cow-cache.c',
|
||||||
'syx-snapshot/channel-buffer-writeback.c',
|
'syx-snapshot/channel-buffer-writeback.c',
|
||||||
)])
|
)])
|
||||||
specific_ss.add(files('exit.c', 'hook.c', 'jit.c'))
|
|
@ -1,7 +1,8 @@
|
|||||||
#include "qemu/osdep.h"
|
#include "qemu/osdep.h"
|
||||||
#include "migration/qemu-file.h"
|
#include "migration/qemu-file.h"
|
||||||
#include "channel-buffer-writeback.h"
|
|
||||||
#include "../syx-misc.h"
|
#include "libafl/syx-misc.h"
|
||||||
|
#include "libafl/syx-snapshot/channel-buffer-writeback.h"
|
||||||
|
|
||||||
QIOChannelBufferWriteback* qio_channel_buffer_writeback_new(size_t capacity, uint8_t* writeback_buf, size_t writeback_buf_capacity, size_t* writeback_buf_usage) {
|
QIOChannelBufferWriteback* qio_channel_buffer_writeback_new(size_t capacity, uint8_t* writeback_buf, size_t writeback_buf_capacity, size_t* writeback_buf_usage) {
|
||||||
assert(writeback_buf != NULL);
|
assert(writeback_buf != NULL);
|
@ -1,11 +1,12 @@
|
|||||||
#include "qemu/osdep.h"
|
#include "qemu/osdep.h"
|
||||||
#include "device-save.h"
|
|
||||||
#include "migration/qemu-file.h"
|
#include "migration/qemu-file.h"
|
||||||
#include "io/channel-buffer.h"
|
#include "io/channel-buffer.h"
|
||||||
#include "channel-buffer-writeback.h"
|
|
||||||
#include "migration/vmstate.h"
|
#include "migration/vmstate.h"
|
||||||
#include "qemu/main-loop.h"
|
#include "qemu/main-loop.h"
|
||||||
#include "../syx-misc.h"
|
|
||||||
|
#include "libafl/syx-misc.h"
|
||||||
|
#include "libafl/syx-snapshot/channel-buffer-writeback.h"
|
||||||
|
#include "libafl/syx-snapshot/device-save.h"
|
||||||
|
|
||||||
#include "migration/savevm.h"
|
#include "migration/savevm.h"
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
#include "syx-cow-cache.h"
|
#include "libafl/syx-snapshot/syx-cow-cache.h"
|
||||||
|
|
||||||
#include "sysemu/block-backend.h"
|
#include "sysemu/block-backend.h"
|
||||||
|
|
@ -8,8 +8,8 @@
|
|||||||
#include "exec/ram_addr.h"
|
#include "exec/ram_addr.h"
|
||||||
#include "exec/exec-all.h"
|
#include "exec/exec-all.h"
|
||||||
|
|
||||||
#include "syx-snapshot.h"
|
#include "libafl/syx-snapshot/syx-snapshot.h"
|
||||||
#include "device-save.h"
|
#include "libafl/syx-snapshot/device-save.h"
|
||||||
|
|
||||||
#define SYX_SNAPSHOT_LIST_INIT_SIZE 4096
|
#define SYX_SNAPSHOT_LIST_INIT_SIZE 4096
|
||||||
#define SYX_SNAPSHOT_LIST_GROW_FACTOR 2
|
#define SYX_SNAPSHOT_LIST_GROW_FACTOR 2
|
@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
//// --- Begin LibAFL code ---
|
//// --- Begin LibAFL code ---
|
||||||
|
|
||||||
#include "libafl_extras/exit.h"
|
#include "libafl/exit.h"
|
||||||
|
|
||||||
//// --- End LibAFL code ---
|
//// --- End LibAFL code ---
|
||||||
|
|
||||||
|
@ -6522,7 +6522,7 @@ typedef struct {
|
|||||||
|
|
||||||
//// --- Begin LibAFL code ---
|
//// --- Begin LibAFL code ---
|
||||||
|
|
||||||
#include "libafl_extras/hook.h"
|
#include "libafl/hook.h"
|
||||||
|
|
||||||
extern __thread CPUArchState *libafl_qemu_env;
|
extern __thread CPUArchState *libafl_qemu_env;
|
||||||
|
|
||||||
@ -13672,22 +13672,16 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1,
|
|||||||
|
|
||||||
//// --- Begin LibAFL code ---
|
//// --- Begin LibAFL code ---
|
||||||
|
|
||||||
struct libafl_mapinfo {
|
#include "libafl/user.h"
|
||||||
target_ulong start, end;
|
|
||||||
target_ulong offset;
|
|
||||||
const char* path;
|
|
||||||
int flags, is_priv;
|
|
||||||
};
|
|
||||||
IntervalTreeNode * libafl_maps_first(IntervalTreeRoot * map_info);
|
|
||||||
IntervalTreeNode * libafl_maps_next(IntervalTreeNode *node, struct libafl_mapinfo* ret);
|
|
||||||
|
|
||||||
IntervalTreeNode * libafl_maps_first(IntervalTreeRoot * map_info) {
|
IntervalTreeNode * libafl_maps_first(IntervalTreeRoot * map_info) {
|
||||||
return interval_tree_iter_first(map_info, 0, -1);
|
return interval_tree_iter_first(map_info, 0, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
IntervalTreeNode * libafl_maps_next(IntervalTreeNode *node, struct libafl_mapinfo* ret) {
|
IntervalTreeNode * libafl_maps_next(IntervalTreeNode *node, struct libafl_mapinfo* ret) {
|
||||||
if (!node || !ret)
|
if (!node || !ret) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
MapInfo *e = container_of(node, MapInfo, itree);
|
MapInfo *e = container_of(node, MapInfo, itree);
|
||||||
|
|
||||||
|
@ -3256,7 +3256,7 @@ target_user_arch = {}
|
|||||||
|
|
||||||
### LibAFL extras
|
### LibAFL extras
|
||||||
|
|
||||||
subdir('libafl_extras')
|
subdir('libafl')
|
||||||
|
|
||||||
###############
|
###############
|
||||||
# Trace files #
|
# Trace files #
|
||||||
|
Loading…
x
Reference in New Issue
Block a user