#include <glib.h> #include <errno.h> #include <unistd.h> #include <sys/syscall.h> #include "sysfuzz.h" #include "typelib.h" #include "iknowthis.h" // Delete a directory. // int rmdir(const char *path); SYSFUZZ(rmdir, SYS_rmdir, SYS_NONE, CLONE_DEFAULT, 0) { gchar *pathname; glong retcode; retcode = spawn_syscall_lwp(this, NULL, SYS_rmdir, // int typelib_get_pathname(&pathname)); // const char *pathname g_free(pathname); return retcode; }
#endif #include <glib.h> #include <asm/unistd.h> #include <errno.h> #include <unistd.h> #include <fcntl.h> #include "sysfuzz.h" #include "typelib.h" #include "iknowthis.h" // Change file timestamps with nanosecond precision. // int utimensat(int dirfd, const char *pathname, const struct timespec times[2], int flags); SYSFUZZ(utimensat, __NR_utimensat, SYS_NONE, CLONE_DEFAULT, 0) { gchar *filename; gpointer times; glong retcode; retcode = spawn_syscall_lwp(this, NULL, __NR_utimensat, // int typelib_get_resource(this, NULL, RES_FILE, RF_NONE), // int dirfd typelib_get_pathname(&filename), // const char *filename typelib_get_buffer(×, PAGE_SIZE), // const struct timespec times[2] typelib_get_integer()); // int flags typelib_clear_buffer(times); g_free(filename); return retcode; }
// guint32 handle_bytes; // int handle_type; // unsigned char f_handle[0]; // }; // Convert name to handle. // int name_to_handle(int dfd, const char *name, struct file_handle *handle, int *mnt_id, int flag); SYSFUZZ(name_to_handle_at, __NR_name_to_handle_at, SYS_NONE, CLONE_DEFAULT, 1000) { gchar *pathname; gpointer handle; gpointer mntid; glong retcode; // Execute systemcall. retcode = spawn_syscall_lwp(this, NULL, __NR_name_to_handle_at, // int typelib_get_resource(this, NULL, RES_FILE, RF_NONE), // int dirfd typelib_get_pathname(&pathname), // const char *name typelib_get_buffer(&handle, PAGE_SIZE), // struct file_handle *handle typelib_get_buffer(&mntid, PAGE_SIZE), // int *mnt_id typelib_get_integer_mask(AT_SYMLINK_FOLLOW | AT_EMPTY_PATH)); // int flags // Release string. g_free(pathname); typelib_clear_buffer(mntid); typelib_clear_buffer(handle); return retcode; }
# define _GNU_SOURCE #endif #include <glib.h> #include <asm/unistd.h> #include <errno.h> #include <unistd.h> #include <fcntl.h> #include "sysfuzz.h" #include "typelib.h" #include "iknowthis.h" // Change the root file system // int pivot_root(const char *new_root, const char *put_old); SYSFUZZ(pivot_root, __NR_pivot_root, SYS_FAIL | SYS_BORING, CLONE_DEFAULT, 0) { gchar *new_root; gchar *put_old; glong retcode; retcode = spawn_syscall_lwp(this, NULL, __NR_pivot_root, // int typelib_get_pathname(&new_root), // const char *new_root typelib_get_pathname(&put_old)); // const char *put_old g_free(new_root); g_free(put_old); return retcode; }
#include <glib.h> #include <errno.h> #include <unistd.h> #include <sys/syscall.h> #include "sysfuzz.h" #include "typelib.h" #include "iknowthis.h" // Change the name or location of a file. // int renameat(int olddirfd, const char *oldpath, int newdirfd, const char *newpath); SYSFUZZ(renameat, SYS_renameat, SYS_NONE, CLONE_DEFAULT, 0) { gchar *oldpath; gchar *newpath; glong retcode; retcode = spawn_syscall_lwp(this, NULL, SYS_renameat, // int typelib_get_resource(this, NULL, RES_FILE, RF_NONE), // int dirfd typelib_get_pathname(&oldpath), // const char *oldpath typelib_get_pathname(&newpath)); // const char *newpath g_free(oldpath); g_free(newpath); return retcode; }