mirror of
https://gitlab.com/qemu-project/qemu
synced 2024-11-05 20:35:44 +00:00
fuzz/virtio-net: remove fork-based fuzzer
Signed-off-by: Alexander Bulekov <alxndr@bu.edu> Reviewed-by: Darren Kenny <darren.kenny@oracle.com>
This commit is contained in:
parent
5d3c73e27e
commit
5f47d07fd8
1 changed files with 5 additions and 49 deletions
|
@ -16,7 +16,6 @@
|
|||
#include "tests/qtest/libqtest.h"
|
||||
#include "tests/qtest/libqos/virtio-net.h"
|
||||
#include "fuzz.h"
|
||||
#include "fork_fuzz.h"
|
||||
#include "qos_fuzz.h"
|
||||
|
||||
|
||||
|
@ -115,36 +114,18 @@ static void virtio_net_fuzz_multi(QTestState *s,
|
|||
}
|
||||
}
|
||||
|
||||
static void virtio_net_fork_fuzz(QTestState *s,
|
||||
const unsigned char *Data, size_t Size)
|
||||
{
|
||||
if (fork() == 0) {
|
||||
virtio_net_fuzz_multi(s, Data, Size, false);
|
||||
flush_events(s);
|
||||
_Exit(0);
|
||||
} else {
|
||||
flush_events(s);
|
||||
wait(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
static void virtio_net_fork_fuzz_check_used(QTestState *s,
|
||||
static void virtio_net_fuzz_check_used(QTestState *s,
|
||||
const unsigned char *Data, size_t Size)
|
||||
{
|
||||
if (fork() == 0) {
|
||||
virtio_net_fuzz_multi(s, Data, Size, true);
|
||||
flush_events(s);
|
||||
_Exit(0);
|
||||
} else {
|
||||
flush_events(s);
|
||||
wait(NULL);
|
||||
}
|
||||
virtio_net_fuzz_multi(s, Data, Size, true);
|
||||
flush_events(s);
|
||||
fuzz_reset(s);
|
||||
}
|
||||
|
||||
static void virtio_net_pre_fuzz(QTestState *s)
|
||||
{
|
||||
qos_init_path(s);
|
||||
counter_shm_init();
|
||||
}
|
||||
|
||||
static void *virtio_net_test_setup_socket(GString *cmd_line, void *arg)
|
||||
|
@ -158,23 +139,8 @@ static void *virtio_net_test_setup_socket(GString *cmd_line, void *arg)
|
|||
return arg;
|
||||
}
|
||||
|
||||
static void *virtio_net_test_setup_user(GString *cmd_line, void *arg)
|
||||
{
|
||||
g_string_append_printf(cmd_line, " -netdev user,id=hs0 ");
|
||||
return arg;
|
||||
}
|
||||
|
||||
static void register_virtio_net_fuzz_targets(void)
|
||||
{
|
||||
fuzz_add_qos_target(&(FuzzTarget){
|
||||
.name = "virtio-net-socket",
|
||||
.description = "Fuzz the virtio-net virtual queues. Fuzz incoming "
|
||||
"traffic using the socket backend",
|
||||
.pre_fuzz = &virtio_net_pre_fuzz,
|
||||
.fuzz = virtio_net_fork_fuzz,},
|
||||
"virtio-net",
|
||||
&(QOSGraphTestOptions){.before = virtio_net_test_setup_socket}
|
||||
);
|
||||
|
||||
fuzz_add_qos_target(&(FuzzTarget){
|
||||
.name = "virtio-net-socket-check-used",
|
||||
|
@ -182,20 +148,10 @@ static void register_virtio_net_fuzz_targets(void)
|
|||
"descriptors to be used. Timeout may indicate improperly handled "
|
||||
"input",
|
||||
.pre_fuzz = &virtio_net_pre_fuzz,
|
||||
.fuzz = virtio_net_fork_fuzz_check_used,},
|
||||
.fuzz = virtio_net_fuzz_check_used,},
|
||||
"virtio-net",
|
||||
&(QOSGraphTestOptions){.before = virtio_net_test_setup_socket}
|
||||
);
|
||||
fuzz_add_qos_target(&(FuzzTarget){
|
||||
.name = "virtio-net-slirp",
|
||||
.description = "Fuzz the virtio-net virtual queues with the slirp "
|
||||
" backend. Warning: May result in network traffic emitted from the "
|
||||
" process. Run in an isolated network environment.",
|
||||
.pre_fuzz = &virtio_net_pre_fuzz,
|
||||
.fuzz = virtio_net_fork_fuzz,},
|
||||
"virtio-net",
|
||||
&(QOSGraphTestOptions){.before = virtio_net_test_setup_user}
|
||||
);
|
||||
}
|
||||
|
||||
fuzz_target_init(register_virtio_net_fuzz_targets);
|
||||
|
|
Loading…
Reference in a new issue