From 6b8e38ac1f2e7a5dd22cea54fe6ed4d1648b23aa Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Thu, 25 Jan 2007 13:28:40 +0000 Subject: [PATCH] * Version 0.6. * Updated NEWS and ChangeLog. --- ChangeLog | 334 +++++++++++++++++++++++++++++++++++++++++++++++++++ NEWS | 7 ++ configure.ac | 4 +- src/zzuf.c | 72 ++++++----- 4 files changed, 385 insertions(+), 32 deletions(-) diff --git a/ChangeLog b/ChangeLog index e6735a3..ce6187a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,337 @@ +------------------------------------------------------------------------ +r243 | sam | 2007-01-25 13:15:47 +0100 (Thu, 25 Jan 2007) | 2 lines +Changed paths: + M /trunk/doc/zzuf.1 + + * Added a networking example using socat. + +------------------------------------------------------------------------ +r242 | sam | 2007-01-25 12:59:33 +0100 (Thu, 25 Jan 2007) | 2 lines +Changed paths: + M /trunk/src/opts.h + M /trunk/src/zzuf.c + + * Oops, fix in-tree preloading! + +------------------------------------------------------------------------ +r241 | sam | 2007-01-25 12:47:44 +0100 (Thu, 25 Jan 2007) | 2 lines +Changed paths: + M /trunk/src/zzuf.c + + * Put opts->bytes handling in the right place. + +------------------------------------------------------------------------ +r240 | sam | 2007-01-25 12:40:27 +0100 (Thu, 25 Jan 2007) | 2 lines +Changed paths: + M /trunk/doc/zzuf.1 + M /trunk/src/fuzz.c + M /trunk/src/fuzz.h + M /trunk/src/libzzuf.c + M /trunk/src/opts.c + M /trunk/src/opts.h + M /trunk/src/zzuf.c + + * Implemented -b/--bytes to restrict fuzzing to specific offsets. + +------------------------------------------------------------------------ +r239 | sam | 2007-01-25 03:16:00 +0100 (Thu, 25 Jan 2007) | 2 lines +Changed paths: + M /trunk/src/zzuf.c + + * Fixed ifdef typo. + +------------------------------------------------------------------------ +r238 | sam | 2007-01-25 02:10:10 +0100 (Thu, 25 Jan 2007) | 2 lines +Changed paths: + M /trunk/TODO + + * Updated TODO list. + +------------------------------------------------------------------------ +r237 | sam | 2007-01-24 16:06:17 +0100 (Wed, 24 Jan 2007) | 2 lines +Changed paths: + M /trunk/build-win32 + M /trunk/configure.ac + M /trunk/src/Makefile.am + M /trunk/src/opts.h + M /trunk/src/timer.c + M /trunk/src/zzuf.c + + * Added DLL injection to the Win32 port attempt. + +------------------------------------------------------------------------ +r236 | sam | 2007-01-23 16:38:18 +0100 (Tue, 23 Jan 2007) | 2 lines +Changed paths: + A /trunk/build-win32 + M /trunk/configure.ac + M /trunk/src/Makefile.am + M /trunk/src/lib-load.h + M /trunk/src/libzzuf.c + M /trunk/src/libzzuf.h + A /trunk/src/sys.c + A /trunk/src/sys.h + M /trunk/src/zzuf.c + + * Added DLL initialisation code for Win32. + +------------------------------------------------------------------------ +r235 | sam | 2007-01-23 13:16:50 +0100 (Tue, 23 Jan 2007) | 2 lines +Changed paths: + M /trunk/src/fd.c + + * Fix minor memory leak. + +------------------------------------------------------------------------ +r234 | sam | 2007-01-23 09:45:47 +0100 (Tue, 23 Jan 2007) | 3 lines +Changed paths: + M /trunk/src/lib-fd.c + M /trunk/src/lib-load.h + M /trunk/src/lib-mem.c + M /trunk/src/lib-signal.c + M /trunk/src/lib-stream.c + M /trunk/src/zzuf.c + + * Put either ORIG() or NEW(() around functions, because the naming scheme is + likely to change for the Win32 port. + +------------------------------------------------------------------------ +r233 | sam | 2007-01-18 22:04:34 +0100 (Thu, 18 Jan 2007) | 2 lines +Changed paths: + M /trunk/doc/zzuf.1 + M /trunk/src/zzuf.c + + * Minor documentation updates. + +------------------------------------------------------------------------ +r232 | sam | 2007-01-18 19:45:58 +0100 (Thu, 18 Jan 2007) | 2 lines +Changed paths: + M /trunk/src/fd.c + M /trunk/src/lib-stream.c + + * Minor improvement in the locking mechanism. + +------------------------------------------------------------------------ +r231 | sam | 2007-01-18 13:32:31 +0100 (Thu, 18 Jan 2007) | 2 lines +Changed paths: + M /trunk/configure.ac + M /trunk/src/lib-fd.c + + * Check recv() return type: int on Linux, ssize_t on OS X. + +------------------------------------------------------------------------ +r230 | sam | 2007-01-18 01:21:07 +0100 (Thu, 18 Jan 2007) | 3 lines +Changed paths: + M /trunk/configure.ac + M /trunk/src/fd.c + M /trunk/src/lib-fd.c + M /trunk/src/lib-load.h + M /trunk/src/lib-mem.c + M /trunk/src/lib-signal.c + M /trunk/src/lib-stream.c + M /trunk/src/libzzuf.c + M /trunk/src/zzuf.c + + * Added enough autoconf checks and #ifdefs so that libzzuf builds on Win32. + zzuf itself doesn't build yet, though. + +------------------------------------------------------------------------ +r229 | sam | 2007-01-17 22:52:44 +0100 (Wed, 17 Jan 2007) | 3 lines +Changed paths: + M /trunk/src/fd.c + M /trunk/src/fd.h + M /trunk/src/lib-fd.c + M /trunk/src/lib-mem.c + M /trunk/src/lib-stream.c + M /trunk/src/libzzuf.c + + * Replaced _zz_disabled with a less stinky API. Still not thread safe, does + not recover very well from errors, but why care? + +------------------------------------------------------------------------ +r228 | sam | 2007-01-17 22:12:27 +0100 (Wed, 17 Jan 2007) | 3 lines +Changed paths: + M /trunk/doc/zzuf.1 + M /trunk/src/fuzz.c + M /trunk/src/fuzz.h + M /trunk/src/lib-fd.c + + * Added aio_read() and aio_return(). They don’t work well yet, I’ll need + to fix the _zz_disabled mess first. + +------------------------------------------------------------------------ +r227 | sam | 2007-01-17 20:48:23 +0100 (Wed, 17 Jan 2007) | 2 lines +Changed paths: + M /trunk/src/Makefile.am + A /trunk/src/opts.c + A /trunk/src/opts.h + M /trunk/src/zzuf.c + + * Reorganised code, got rid of global variables. + +------------------------------------------------------------------------ +r226 | sam | 2007-01-17 18:14:22 +0100 (Wed, 17 Jan 2007) | 3 lines +Changed paths: + M /trunk/AUTHORS + M /trunk/doc/zzuf.1 + M /trunk/src/lib-fd.c + + * recvmsg() support by Rémi Denis-Courmont. + * Minor code reorganisation. + +------------------------------------------------------------------------ +r225 | sam | 2007-01-17 17:32:45 +0100 (Wed, 17 Jan 2007) | 3 lines +Changed paths: + M /trunk/src/lib-fd.c + + * Improved recvfrom() debug information. + * Implemented recv(). + +------------------------------------------------------------------------ +r224 | sam | 2007-01-17 17:26:40 +0100 (Wed, 17 Jan 2007) | 2 lines +Changed paths: + M /trunk/src/debug.c + + * Add %x to the format string parameters supported by debug(). + +------------------------------------------------------------------------ +r223 | sam | 2007-01-17 16:31:40 +0100 (Wed, 17 Jan 2007) | 2 lines +Changed paths: + M /trunk/src/debug.c + M /trunk/src/lib-stream.c + + * Improved %c usage in our custom fprintf() implementation. + +------------------------------------------------------------------------ +r222 | sam | 2007-01-17 16:21:09 +0100 (Wed, 17 Jan 2007) | 2 lines +Changed paths: + M /trunk/src/lib-fd.c + M /trunk/src/lib-load.h + M /trunk/src/lib-mem.c + M /trunk/src/lib-signal.c + M /trunk/src/lib-stream.c + + * Use __func__ wherever possible. + +------------------------------------------------------------------------ +r221 | sam | 2007-01-17 16:07:35 +0100 (Wed, 17 Jan 2007) | 2 lines +Changed paths: + M /trunk/AUTHORS + M /trunk/doc/zzuf.1 + M /trunk/src/lib-fd.c + + * recvfrom() support from Dominik Kuhlen. + +------------------------------------------------------------------------ +r220 | sam | 2007-01-17 16:02:05 +0100 (Wed, 17 Jan 2007) | 2 lines +Changed paths: + M /trunk/src/debug.c + + * Print "NULL" instead of "(nil)" when printing null pointers. + +------------------------------------------------------------------------ +r219 | sam | 2007-01-17 15:35:12 +0100 (Wed, 17 Jan 2007) | 2 lines +Changed paths: + M /trunk/src/fd.c + M /trunk/test/testsuite.sh + + * Allow -r 0.0 again. Fixed the testsuite accordingly. + +------------------------------------------------------------------------ +r218 | sam | 2007-01-17 14:46:38 +0100 (Wed, 17 Jan 2007) | 2 lines +Changed paths: + M /trunk/src/Makefile.am + A /trunk/src/lib-fd.c (from /trunk/src/load-fd.c:214) + A /trunk/src/lib-load.h (from /trunk/src/load.h:214) + A /trunk/src/lib-mem.c (from /trunk/src/load-mem.c:214) + A /trunk/src/lib-signal.c (from /trunk/src/load-signal.c:214) + A /trunk/src/lib-stream.c (from /trunk/src/load-stream.c:214) + D /trunk/src/load-fd.c + D /trunk/src/load-mem.c + D /trunk/src/load-signal.c + D /trunk/src/load-stream.c + D /trunk/src/load.h + + * Moved files around. + +------------------------------------------------------------------------ +r217 | sam | 2007-01-17 14:42:18 +0100 (Wed, 17 Jan 2007) | 2 lines +Changed paths: + M /trunk/doc/zzuf.1 + + * Suggest jot instead of seq in the examples. + +------------------------------------------------------------------------ +r216 | sam | 2007-01-17 08:22:10 +0100 (Wed, 17 Jan 2007) | 2 lines +Changed paths: + M /trunk/src/zzuf.c + + * Fix a longopt parsing crash, thanks to Matti Hämäläinen. + +------------------------------------------------------------------------ +r215 | sam | 2007-01-17 08:21:40 +0100 (Wed, 17 Jan 2007) | 2 lines +Changed paths: + M /trunk/doc/zzuf.1 + M /trunk/src/zzuf.c + + * Fix testsuite by printing MD5 hashes to stdout. + +------------------------------------------------------------------------ +r214 | sam | 2007-01-16 15:36:33 +0100 (Tue, 16 Jan 2007) | 3 lines +Changed paths: + M /trunk/src/libzzuf.c + M /trunk/src/load-fd.c + M /trunk/src/load-mem.c + M /trunk/src/load-signal.c + M /trunk/src/load-stream.c + M /trunk/src/load.h + + * Got rid of the *_load() functions. Now each diverted function is supposed + to check that the *_orig() functions it calls are properly loaded. + +------------------------------------------------------------------------ +r213 | sam | 2007-01-16 15:21:28 +0100 (Tue, 16 Jan 2007) | 2 lines +Changed paths: + M /trunk/AUTHORS + M /trunk/doc/zzuf.1 + M /trunk/src/load-fd.c + + * pread() implementation, thanks to Clément Stenac. + +------------------------------------------------------------------------ +r212 | sam | 2007-01-16 15:06:57 +0100 (Tue, 16 Jan 2007) | 2 lines +Changed paths: + M /trunk/src/load-fd.c + + * Don't do the offset sanity check on non-seekable devices. + +------------------------------------------------------------------------ +r211 | sam | 2007-01-16 14:54:34 +0100 (Tue, 16 Jan 2007) | 2 lines +Changed paths: + M /trunk/AUTHORS + M /trunk/doc/zzuf.1 + M /trunk/src/load-fd.c + + * readv() implementation, thanks to Rémi Denis-Courmont. + +------------------------------------------------------------------------ +r210 | sam | 2007-01-15 14:28:19 +0100 (Mon, 15 Jan 2007) | 3 lines +Changed paths: + M /trunk/doc/zzuf.1 + + * Use seq instead of awk in the example, to make shorter code. I know it + won't work on BSD systems, but should I care? + +------------------------------------------------------------------------ +r209 | sam | 2007-01-15 00:56:39 +0100 (Mon, 15 Jan 2007) | 3 lines +Changed paths: + M /trunk/ChangeLog + M /trunk/NEWS + M /trunk/TODO + M /trunk/configure.ac + + * Version 0.5. + * Updated NEWS and ChangeLog. + ------------------------------------------------------------------------ r208 | sam | 2007-01-15 00:42:34 +0100 (Mon, 15 Jan 2007) | 2 lines Changed paths: diff --git a/NEWS b/NEWS index 2b54935..a2f17ff 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,12 @@ $Id$ +Changes from 0.5 to 0.6 + + * allow to fuzz only parts of the input + * support for readv(), pread(), recv(), recvfrom(), recvmsg() + * support for asynchronous IO + * minor fixes for crashes and memory leaks + Changes from 0.4 to 0.5 * ratio range support diff --git a/configure.ac b/configure.ac index 8a0e16e..71fcdae 100644 --- a/configure.ac +++ b/configure.ac @@ -1,13 +1,13 @@ # $Id: configure.ac 98 2006-09-22 16:27:37Z sam $ -AC_INIT(zzuf, 0.5) +AC_INIT(zzuf, 0.6) AC_PREREQ(2.50) AC_CONFIG_SRCDIR(src/zzuf.c) AC_CONFIG_AUX_DIR(autotools) AC_CANONICAL_SYSTEM -AM_INIT_AUTOMAKE(zzuf, 0.5) +AM_INIT_AUTOMAKE(zzuf, 0.6) AM_CONFIG_HEADER(config.h) AM_PROG_CC_C_O diff --git a/src/zzuf.c b/src/zzuf.c index 92a250e..d443928 100644 --- a/src/zzuf.c +++ b/src/zzuf.c @@ -82,6 +82,7 @@ static char const *sig2str(int); static int dll_inject(void *, void *); static void *get_entry(char const *); #endif +static void finfo(FILE *, struct opts *); #if defined HAVE_REGEX_H static char *merge_regex(char *, char *); static char *merge_file(char *, char *); @@ -424,12 +425,12 @@ static void loop_stdin(struct opts *opts) if(opts->md5) { _zz_md5_fini(md5sum, ctx); - fprintf(stdout, "zzuf[s=%i,r=%g]: %.02x%.02x%.02x%.02x%.02x" - "%.02x%.02x%.02x%.02x%.02x%.02x%.02x%.02x%.02x%.02x%.02x\n", - opts->seed, opts->minratio, md5sum[0], md5sum[1], md5sum[2], - md5sum[3], md5sum[4], md5sum[5], md5sum[6], md5sum[7], - md5sum[8], md5sum[9], md5sum[10], md5sum[11], md5sum[12], - md5sum[13], md5sum[14], md5sum[15]); + finfo(stdout, opts); + fprintf(stdout, "%.02x%.02x%.02x%.02x%.02x%.02x%.02x%.02x%.02x%.02x" + "%.02x%.02x%.02x%.02x%.02x%.02x\n", md5sum[0], md5sum[1], + md5sum[2], md5sum[3], md5sum[4], md5sum[5], md5sum[6], + md5sum[7], md5sum[8], md5sum[9], md5sum[10], md5sum[11], + md5sum[12], md5sum[13], md5sum[14], md5sum[15]); fflush(stdout); } @@ -437,6 +438,15 @@ static void loop_stdin(struct opts *opts) _zz_fd_fini(); } +static void finfo(FILE *fp, struct opts *opts) +{ + if(opts->minratio == opts->maxratio) + fprintf(fp, "zzuf[s=%i,r=%g]: ", opts->seed, opts->minratio); + else + fprintf(fp, "zzuf[s=%i,r=%g:%g]: ", opts->seed, + opts->minratio, opts->maxratio); +} + #if defined HAVE_REGEX_H static char *merge_file(char *regex, char *file) { @@ -601,9 +611,10 @@ static void spawn_children(struct opts *opts) opts->child[i].ctx = _zz_md5_init(); if(opts->verbose) - fprintf(stderr, "zzuf[s=%i,r=%g]: launched %s\n", - opts->child[i].seed, opts->child[i].ratio, - opts->newargv[0]); + { + finfo(stderr, opts); + fprintf(stderr, "launched %s\n", opts->newargv[0]); + } opts->lastlaunch = now; opts->nchild++; @@ -628,9 +639,10 @@ static void clean_children(struct opts *opts) && opts->child[i].bytes > opts->maxbytes) { if(opts->verbose) - fprintf(stderr, "zzuf[s=%i,r=%g]: " - "data output exceeded, sending SIGTERM\n", - opts->child[i].seed, opts->child[i].ratio); + { + finfo(stderr, opts); + fprintf(stderr, "data output exceeded, sending SIGTERM\n"); + } kill(opts->child[i].pid, SIGTERM); opts->child[i].date = now; opts->child[i].status = STATUS_SIGTERM; @@ -641,9 +653,10 @@ static void clean_children(struct opts *opts) && now > opts->child[i].date + opts->maxtime) { if(opts->verbose) - fprintf(stderr, "zzuf[s=%i,r=%g]: " - "running time exceeded, sending SIGTERM\n", - opts->child[i].seed, opts->child[i].ratio); + { + finfo(stderr, opts); + fprintf(stderr, "running time exceeded, sending SIGTERM\n"); + } kill(opts->child[i].pid, SIGTERM); opts->child[i].date = now; opts->child[i].status = STATUS_SIGTERM; @@ -657,9 +670,10 @@ static void clean_children(struct opts *opts) && now > opts->child[i].date + 2000000) { if(opts->verbose) - fprintf(stderr, "zzuf[s=%i,r=%g]: " - "not responding, sending SIGKILL\n", - opts->child[i].seed, opts->child[i].ratio); + { + finfo(stderr, opts); + fprintf(stderr, "not responding, sending SIGKILL\n"); + } kill(opts->child[i].pid, SIGKILL); opts->child[i].status = STATUS_SIGKILL; } @@ -687,17 +701,16 @@ static void clean_children(struct opts *opts) if(opts->checkexit && WIFEXITED(status) && WEXITSTATUS(status)) { - fprintf(stderr, "zzuf[s=%i,r=%g]: exit %i\n", - opts->child[i].seed, opts->child[i].ratio, - WEXITSTATUS(status)); + finfo(stderr, opts); + fprintf(stderr, "exit %i\n", WEXITSTATUS(status)); opts->crashes++; } else if(WIFSIGNALED(status) && !(WTERMSIG(status) == SIGTERM && opts->child[i].status == STATUS_SIGTERM)) { - fprintf(stderr, "zzuf[s=%i,r=%g]: signal %i%s%s\n", - opts->child[i].seed, opts->child[i].ratio, + finfo(stderr, opts); + fprintf(stderr, "signal %i%s%s\n", WTERMSIG(status), sig2str(WTERMSIG(status)), (WTERMSIG(status) == SIGKILL && opts->maxmem >= 0) ? " (memory exceeded?)" : ""); @@ -712,13 +725,12 @@ static void clean_children(struct opts *opts) if(opts->md5) { _zz_md5_fini(md5sum, opts->child[i].ctx); - fprintf(stdout, "zzuf[s=%i,r=%g]: %.02x%.02x%.02x%.02x%.02x%.02x" - "%.02x%.02x%.02x%.02x%.02x%.02x%.02x%.02x%.02x%.02x\n", - opts->child[i].seed, opts->child[i].ratio, - md5sum[0], md5sum[1], md5sum[2], md5sum[3], md5sum[4], - md5sum[5], md5sum[6], md5sum[7], md5sum[8], md5sum[9], - md5sum[10], md5sum[11], md5sum[12], md5sum[13], - md5sum[14], md5sum[15]); + finfo(stdout, opts); + fprintf(stdout, "%.02x%.02x%.02x%.02x%.02x%.02x%.02x%.02x%.02x" + "%.02x%.02x%.02x%.02x%.02x%.02x%.02x\n", md5sum[0], + md5sum[1], md5sum[2], md5sum[3], md5sum[4], md5sum[5], + md5sum[6], md5sum[7], md5sum[8], md5sum[9], md5sum[10], + md5sum[11], md5sum[12], md5sum[13], md5sum[14], md5sum[15]); fflush(stdout); } opts->child[i].status = STATUS_FREE;