FRET-LibAFL/libafl_qemu/runtime/libafl_qemu_defs.h
Romain Malmain c944a70056
Linux kernel fuzzing example (#2496)
* linux kernel (x509_cert) and process fuzzing example

* rework filters

* update to latest qemu

* working for process and kernel fuzzing

* new i2s mutator for binary only fuzzers

* refactoring modules with new filtering interface

* add state as parameter of harness

* hide unused global in usermode

* Script for stub bindings generation

* do not try to check whether it is worth generating the bindings, always
  generate when the env variable is on.

* add taplo to fmt_all.sh

* Moved fuzzers (again) in a target-centric way.

* fix rust 2024 warnings.

* new libafl_qemu harness structure.

* rename qemu_systemmode into qemu_baremetal

* fix qemu baremetal makefile

* fix formatter

---------

Co-authored-by: Toka <tokazerkje@outlook.com>
2024-09-26 14:29:33 +02:00

38 lines
1.1 KiB
C

#ifndef LIBAFL_QEMU_DEFS
#define LIBAFL_QEMU_DEFS
#define LIBAFL_STRINGIFY(s) #s
#define XSTRINGIFY(s) LIBAFL_STRINGIFY(s)
#if __STDC_VERSION__ >= 201112L
#define STATIC_CHECKS \
_Static_assert(sizeof(void *) <= sizeof(libafl_word), \
"pointer type should not be larger and libafl_word");
#else
#define STATIC_CHECKS
#endif
#define LIBAFL_SYNC_EXIT_OPCODE 0x66f23a0f
#define LIBAFL_BACKDOOR_OPCODE 0x44f23a0f
#define LIBAFL_QEMU_TEST_VALUE 0xcafebabe
#define LIBAFL_QEMU_HDR_VERSION_NUMBER 0111 // TODO: find a nice way to set it.
typedef enum LibaflQemuCommand {
LIBAFL_QEMU_COMMAND_START_VIRT = 0,
LIBAFL_QEMU_COMMAND_START_PHYS = 1,
LIBAFL_QEMU_COMMAND_INPUT_VIRT = 2,
LIBAFL_QEMU_COMMAND_INPUT_PHYS = 3,
LIBAFL_QEMU_COMMAND_END = 4,
LIBAFL_QEMU_COMMAND_SAVE = 5,
LIBAFL_QEMU_COMMAND_LOAD = 6,
LIBAFL_QEMU_COMMAND_VERSION = 7,
LIBAFL_QEMU_COMMAND_VADDR_FILTER_ALLOW = 8,
LIBAFL_QEMU_COMMAND_INTERNAL_ERROR = 9,
LIBAFL_QEMU_COMMAND_LQPRINTF = 10,
LIBAFL_QEMU_COMMAND_TEST = 11,
} LibaflExit;
#endif