aboutsummaryrefslogtreecommitdiff
path: root/apps/test
diff options
context:
space:
mode:
authorMarvin Borner2021-04-27 23:00:23 +0200
committerMarvin Borner2021-04-27 23:00:23 +0200
commit977e62973abda3dd9fe5cb3462fc87d273ba63e3 (patch)
tree23896e7964d745892f2d72eff68469fa5b871273 /apps/test
parente9d82dd950cb23e79c3425a636a5ddc95b65f904 (diff)
Improved fuzzer
"Improved"? I guess...
Diffstat (limited to 'apps/test')
-rw-r--r--apps/test/fuzz.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/apps/test/fuzz.c b/apps/test/fuzz.c
index c871038..150a5ba 100644
--- a/apps/test/fuzz.c
+++ b/apps/test/fuzz.c
@@ -7,6 +7,7 @@
#include <rand.h>
#include <sys.h>
+// TODO: Make syscall fuzzer actually useful
#define FUZZ_COUNT 1000
static res syscall(enum sys num, int d1, int d2, int d3, int d4, int d5)
@@ -19,17 +20,17 @@ static res syscall(enum sys num, int d1, int d2, int d3, int d4, int d5)
return a;
}
-static u8 deadly_call(enum sys num)
+static u8 sys_bad_call(enum sys num)
{
- return num == SYS_EXIT;
+ return num == SYS_EXIT || num == SYS_EXEC;
}
-static enum sys random_call(void)
+static enum sys sys_random_call(void)
{
u32 num;
do {
num = rand_range(SYS_MIN, SYS_MAX);
- } while (deadly_call(num));
+ } while (sys_bad_call(num));
return num;
}
@@ -37,14 +38,14 @@ void fuzz(void)
{
u32 cnt = FUZZ_COUNT;
while (cnt) {
- enum sys num = random_call();
+ enum sys num = sys_random_call();
u32 d1 = rand();
u32 d2 = rand();
u32 d3 = rand();
u32 d4 = rand();
u32 d5 = rand();
- log("%d\n", syscall(num, d1, d2, d3, d4, d5));
+ log("%d: %d\n", num, syscall(num, d1, d2, d3, d4, d5));
cnt--;
}