ref: 0dacfe5d0727717f4664bfda558e81a46639aad0
parent: 450caa3adbf3369cb82aec4add3ffa2acb9cca65
author: seh <seh@localhost>
date: Sat Nov 10 12:24:38 EST 2018
add in type bookkeeping
--- a/fuzz.h
+++ b/fuzz.h
@@ -7,6 +7,7 @@
// Number of calls in enum calls
#define NCALLS 66
+#define NTYPES 4
/*
For full list of syscalls:
@@ -87,6 +88,25 @@
sc_sysname, // sysname(void);
sc_werrstr // werrstr(char*, ...);
};
+
+// Enum to track types of inputs
+typedef int type;
+enum type {
+t_int,
+t_long,
+t_DirS,
+t_charS
+};
+
+// Structure to track an instance of a given type
+typedef struct t_type t_type;
+struct t_type {
+ void *var; // Variable to track
+ type t; // Type of the variable to cast to
+};
+
+// Type names table -- in input.c
+extern char *typenames[NTYPES];
// User space system call names table -- NCALLS length -- in input.c
extern char *callnames[NCALLS];
--- a/input.c
+++ b/input.c
@@ -88,6 +88,18 @@
}
}
+
+// Syncs the disk in hjfs
+void
+hjsync()
+{
+ // open file and write to sync disk
+ int hjfs = open("/srv/hjfs.cmd", OWRITE);
+ fprint(hjfs, "sync\n");
+ close(hjfs);
+}
+
+
// Init callnames here, is extern in fuzz.h
char *callnames[NCALLS]= {
"_exits",
@@ -158,13 +170,10 @@
"werrstr"
};
-
-// Syncs the disk in hjfs
-void
-hjsync()
-{
- // open file and write to sync disk
- int hjfs = open("/srv/hjfs.cmd", OWRITE);
- fprint(hjfs, "sync\n");
- close(hjfs);
-}
+// Init callnames here, is extern in fuzz.h
+char *typenames[NTYPES]= {
+"int",
+"long",
+"Dir*",
+"char*"
+};
--- a/main.c
+++ b/main.c
@@ -32,8 +32,6 @@
default:
usage();
}ARGEND
-
- logfd = open("./fuzz.log", OWRITE);
// Initialize the table of all system calls
initsctable();
@@ -49,6 +47,8 @@
exits("Encountered invalid syscall");
}
}
+
+ logfd = open("./fuzz.log", OWRITE);
// Operate for the desired number of rounds, -1 is infinite
for(i = 0; i < nrounds || nrounds < 0; i++){