-
Notifications
You must be signed in to change notification settings - Fork 38
Syx snapshot fixes and tuning #112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
7462199
12ddfc3
fdb2844
5ea6158
ee8ec01
5b0a3cc
596b0a1
80791c9
8d8f145
6c4e904
d2936b1
99f3ff6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
|
||
#include "qemu/osdep.h" | ||
|
||
#include "qapi/error.h" | ||
#include "qapi/qmp/qdict.h" | ||
#include "qemu/option.h" | ||
#include "qemu/main-loop.h" | ||
#include "block/qdict.h" | ||
#include "libafl/system.h" | ||
|
||
|
||
|
||
#define NOT_DONE 0x7fffffff | ||
|
||
static void blk_rw_done(void *opaque, int ret) | ||
{ | ||
*(int *)opaque = ret; | ||
} | ||
|
||
int libafl_blk_write(BlockBackend *blk, void *buf, int64_t offset, int64_t sz) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why do we need this? i don't see it used anywhere else in your pr. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah yes you are right, it is not related directly to SYX. I placed this in This is only low-level api yet, I can remove it of course. |
||
{ | ||
void *pattern_buf = NULL; | ||
QEMUIOVector qiov; | ||
int async_ret = NOT_DONE; | ||
|
||
qemu_iovec_init(&qiov, 1); | ||
qemu_iovec_add(&qiov, buf, sz); | ||
|
||
blk_aio_pwritev(blk, offset, &qiov, 0, blk_rw_done, &async_ret); | ||
while (async_ret == NOT_DONE) { | ||
main_loop_wait(false); | ||
} | ||
|
||
//printf("async_ret: %d\n", async_ret); | ||
//g_assert(async_ret == 0); | ||
|
||
g_free(pattern_buf); | ||
qemu_iovec_destroy(&qiov); | ||
return async_ret; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why move this to higher-level functions?
i start to think we should not keep this call in probe, there are many places where memory gets probed for write but it in fact never written to.
it's only a matter of optimization though, nothing too problematic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The probes are used by guest helpers. Even though not every probe may lead to an actual write, we have no way to get this feedback as of now. This is how the QEMU TCG is set up.
A rule of thumb for me was the following:
Whenever QEMU uses
notdirty_write
, we want to make a backup of the page (syx_snapshot_dirty_list_add_hostaddr
). Because these are mostly the same features.But we cannot use
notdirty_write
, it misseshostaddr
, so I came up with this.