Merge pull request #41 from rmalmain/fast_block_snapshot

Added missing LibAFL markers.
This commit is contained in:
Romain Malmain 2023-12-19 17:52:13 +01:00 committed by GitHub
commit a3b627495f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 0 deletions

View File

@ -27,7 +27,10 @@
#include "qemu/option.h"
#include "trace.h"
#include "migration/misc.h"
//// --- Begin LibAFL code ---
#include "libafl_extras/syx-snapshot/syx-snapshot.h"
//// --- End LibAFL code ---
/* Number of coroutines to reserve per attached device model */
#define COROUTINE_POOL_RESERVATION 64
@ -714,10 +717,12 @@ bool monitor_add_blk(BlockBackend *blk, const char *name, Error **errp)
error_setg(errp, "Invalid device name");
return false;
}
//// --- Begin LibAFL code ---
if (blk_by_name(name)) {
error_setg(errp, "Device with id '%s' already exists", name);
return false;
}
//// --- End LibAFL code ---
if (blk_by_name_hash(g_str_hash(name))) {
error_setg(errp, "Device with name hash '%x' already exists", g_str_hash(name));
return false;
@ -766,11 +771,13 @@ const char *blk_name(const BlockBackend *blk)
return blk->name ?: "";
}
//// --- Begin LibAFL code ---
guint blk_name_hash(const BlockBackend* blk)
{
IO_CODE();
return blk->name_hash;
}
//// --- End LibAFL code ---
/*
* Return the BlockBackend with name @name if it exists, else null.
@ -1660,12 +1667,16 @@ static void coroutine_fn blk_aio_read_entry(void *opaque)
assert(qiov->size == acb->bytes);
//// --- Begin LibAFL code ---
if (!syx_snapshot_cow_cache_read_entry(rwco->blk, rwco->offset, acb->bytes, qiov, 0, rwco->flags)) {
//// --- End LibAFL code ---
rwco->ret = blk_co_do_preadv_part(rwco->blk, rwco->offset, acb->bytes, qiov,
0, rwco->flags);
//// --- Begin LibAFL code ---
} else {
rwco->ret = 0;
}
//// --- End LibAFL code ---
blk_aio_complete(acb);
}

View File

@ -48,7 +48,9 @@ void coroutine_fn no_co_wrapper blk_co_unref(BlockBackend *blk);
void blk_remove_all_bs(void);
BlockBackend *blk_by_name(const char *name);
//// --- Begin LibAFL code ---
BlockBackend *blk_by_name_hash(guint name_hash);
//// --- End LibAFL code ---
BlockBackend *blk_next(BlockBackend *blk);
BlockBackend *blk_all_next(BlockBackend *blk);
bool monitor_add_blk(BlockBackend *blk, const char *name, Error **errp);

View File

@ -24,7 +24,9 @@
*/
const char *blk_name(const BlockBackend *blk);
//// --- Begin LibAFL code ---
guint blk_name_hash(const BlockBackend* blk);
//// --- End LibAFL code ---
BlockDriverState *blk_bs(BlockBackend *blk);