Skip to content

Commit

Permalink
fix libafl side wih new version
Browse files Browse the repository at this point in the history
  • Loading branch information
rmalmain committed Oct 25, 2024
1 parent ad1628c commit 0832bb4
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 26 deletions.
21 changes: 0 additions & 21 deletions contrib/plugins/lockstep.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,27 +34,6 @@

#include <qemu-plugin.h>

//// --- 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 */
Expand Down
4 changes: 2 additions & 2 deletions gdbstub/user-target.c
Original file line number Diff line number Diff line change
Expand Up @@ -302,15 +302,15 @@ 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;
}

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");
Expand Down
2 changes: 0 additions & 2 deletions include/libafl/exit.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
#pragma once

#include "qemu/osdep.h"

#include "exec/cpu-defs.h"
#include "exec/translator.h"

#define EXCP_LIBAFL_EXIT 0xf4775747

Expand Down
1 change: 0 additions & 1 deletion libafl/exit.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions libafl/gdb.c
Original file line number Diff line number Diff line change
@@ -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;

Expand Down

0 comments on commit 0832bb4

Please sign in to comment.