[PATCH 0/2] Add additional plugin API functions to read and write memory and registers

Rowan Hart posted 2 patches 1 year ago
Failed in applying to current master (apply log)
There is a newer version of this series
gdbstub/gdbstub.c          |   2 +-
include/exec/gdbstub.h     |  14 +++++
include/qemu/qemu-plugin.h | 116 +++++++++++++++++++++++++++++++++----
plugins/api.c              |  66 ++++++++++++++++++++-
4 files changed, 183 insertions(+), 15 deletions(-)
[PATCH 0/2] Add additional plugin API functions to read and write memory and registers
Posted by Rowan Hart 1 year ago
This patch set follows a previous patch which added the
qemu_plugin_read_memory_vaddr function and adds a set of similar
functions to read and write registers, virtual memory, and
physical memory.

The use case I have in mind is for use of QEMU for program analysis and
testing. For example, a fuzzer which uses QEMU for emulation might wish to
inject test data into a program at runtime using qemu_plugin_write_memory_vaddr
(and likewise if testing an operating system or bare metal application using
qemu_plugin_write_memory_hwaddr). It may also wish to read the initial contents
of memory using qemu_plugin_read_memory_vaddr/hwaddr.

Similarly, a testing framework may wish to fake register values, perhaps to
simulate a device failure, perhaps by using qemu_plugin_write_register to set a
register value to an error code.

I think all this functionality works together to make QEMU
plugins more powerful and versatile, hopefully removing barriers
to using upstream QEMU for these tasks which have historically
required maintaining a QEMU fork downstream (like QEMUAFL
https://github.com/AFLplusplus/qemuafl), which is tedious, error
prone, and results in users missing out on enhancements to QEMU.

novafacing (2):
  Expose gdb_write_register function to consumers of gdbstub
  Add plugin API functions for register R/W, hwaddr R/W, vaddr W

 gdbstub/gdbstub.c          |   2 +-
 include/exec/gdbstub.h     |  14 +++++
 include/qemu/qemu-plugin.h | 116 +++++++++++++++++++++++++++++++++----
 plugins/api.c              |  66 ++++++++++++++++++++-
 4 files changed, 183 insertions(+), 15 deletions(-)

-- 
2.46.1