From 0832bb48924f162b682481bf61958c1f2835c262 Mon Sep 17 00:00:00 2001 From: Romain Malmain Date: Fri, 25 Oct 2024 22:41:53 +0200 Subject: [PATCH] fix libafl side wih new version --- contrib/plugins/lockstep.c | 21 --------------------- gdbstub/user-target.c | 4 ++-- include/libafl/exit.h | 2 -- libafl/exit.c | 1 - libafl/gdb.c | 1 + 5 files changed, 3 insertions(+), 26 deletions(-) diff --git a/contrib/plugins/lockstep.c b/contrib/plugins/lockstep.c index e13817f777..62981d4e09 100644 --- a/contrib/plugins/lockstep.c +++ b/contrib/plugins/lockstep.c @@ -34,27 +34,6 @@ #include -//// --- Begin LibAFL code --- -static inline gpointer g_memdup2_qemu(gconstpointer mem, gsize byte_size) -{ -#if GLIB_CHECK_VERSION(2, 68, 0) - return g_memdup2(mem, byte_size); -#else - gpointer new_mem; - - if (mem && byte_size != 0) { - new_mem = g_malloc(byte_size); - memcpy(new_mem, mem, byte_size); - } else { - new_mem = NULL; - } - - return new_mem; -#endif -} -#define g_memdup2(m, s) g_memdup2_qemu(m, s) -//// --- End LibAFL code --- - QEMU_PLUGIN_EXPORT int qemu_plugin_version = QEMU_PLUGIN_VERSION; /* saved so we can uninstall later */ diff --git a/gdbstub/user-target.c b/gdbstub/user-target.c index fa601443ba..67c6d96930 100644 --- a/gdbstub/user-target.c +++ b/gdbstub/user-target.c @@ -302,7 +302,7 @@ void gdb_handle_query_rcmd(GArray *params, void *user_ctx) return; } - len = strlen(get_param(params, 0)->data); + len = strlen(gdb_get_cmd_param(params, 0)->data); if (len % 2) { gdb_put_packet("E01"); return; @@ -310,7 +310,7 @@ void gdb_handle_query_rcmd(GArray *params, void *user_ctx) g_assert(gdbserver_state.mem_buf->len == 0); len = len / 2; - gdb_hextomem(gdbserver_state.mem_buf, get_param(params, 0)->data, len); + gdb_hextomem(gdbserver_state.mem_buf, gdb_get_cmd_param(params, 0)->data, len); if (libafl_qemu_gdb_exec()) { gdb_put_packet("OK"); diff --git a/include/libafl/exit.h b/include/libafl/exit.h index e305d9a35d..a9cc5c007a 100644 --- a/include/libafl/exit.h +++ b/include/libafl/exit.h @@ -1,9 +1,7 @@ #pragma once #include "qemu/osdep.h" - #include "exec/cpu-defs.h" -#include "exec/translator.h" #define EXCP_LIBAFL_EXIT 0xf4775747 diff --git a/libafl/exit.c b/libafl/exit.c index ff913f7b0d..27d3444f5a 100644 --- a/libafl/exit.c +++ b/libafl/exit.c @@ -4,7 +4,6 @@ #include "tcg/tcg-op.h" #include "tcg/tcg-temp-internal.h" #include "sysemu/runstate.h" -#include "exec/translator.h" #include "cpu.h" #include "libafl/cpu.h" diff --git a/libafl/gdb.c b/libafl/gdb.c index 9745287c46..d88660c29e 100644 --- a/libafl/gdb.c +++ b/libafl/gdb.c @@ -1,6 +1,7 @@ #include "qemu/osdep.h" #include "libafl/gdb.h" #include "gdbstub/internals.h" +#include "gdbstub/commands.h" static struct libafl_custom_gdb_cmd* libafl_qemu_gdb_cmds;