[COMMITTED PATCH] Demangler fuzzer

2014-08-13 Thread Gary Benson
Ian Lance Taylor wrote: > On Tue, Aug 12, 2014 at 10:11 AM, Gary Benson wrote: > > Ian Lance Taylor wrote: > > > I think that by default the program should stop. That will make > > > it possible to eventually run as part of "make check". Give it > > > some number of iterations that stops it in a

Re: [PATCH] Demangler fuzzer

2014-08-12 Thread Ian Lance Taylor
On Tue, Aug 12, 2014 at 10:11 AM, Gary Benson wrote: > Ian Lance Taylor wrote: >> >> I think that by default the program should stop. That will make it >> possible to eventually run as part of "make check". Give it some >> number of iterations that stops it in a second or so. You can still >> h

Re: [PATCH] Demangler fuzzer

2014-08-12 Thread Gary Benson
Ian Lance Taylor wrote: > On Tue, Aug 12, 2014 at 2:02 AM, Gary Benson wrote: > > +#include > > Include demangle.h with "". Ok. > > +int > > +main (int argc, char *argv[]) > > +{ > > + char symbol[2 + MAXLEN + 1] = "_Z"; > > + int seed = -1, seed_set = 0; > > + int count = 0, maxcount = -1;

Re: [PATCH] Demangler fuzzer

2014-08-12 Thread Ian Lance Taylor
On Tue, Aug 12, 2014 at 2:02 AM, Gary Benson wrote: > +#include Include demangle.h with "". > +int > +main (int argc, char *argv[]) > +{ > + char symbol[2 + MAXLEN + 1] = "_Z"; > + int seed = -1, seed_set = 0; > + int count = 0, maxcount = -1; I think that by default the program should sto

Re: [PATCH] Demangler fuzzer

2014-08-12 Thread Gary Benson
Jakub Jelinek wrote: > On Tue, Aug 12, 2014 at 10:02:40AM +0100, Gary Benson wrote: > > I've removed the timeout code. Users can limit the run by setting a > > maximum number of iterations. That's more consistent for testing > > anyway: 500 iterations is 500 iterations wherever you run it

Re: [PATCH] Demangler fuzzer

2014-08-12 Thread Jakub Jelinek
On Tue, Aug 12, 2014 at 10:02:40AM +0100, Gary Benson wrote: > I've removed the timeout code. Users can limit the run by setting a > maximum number of iterations. That's more consistent for testing > anyway: 500 iterations is 500 iterations wherever you run it. > > How about this one? L

Re: [PATCH] Demangler fuzzer

2014-08-12 Thread Gary Benson
Jakub Jelinek wrote: > On Mon, Aug 11, 2014 at 05:04:20PM +0100, Gary Benson wrote: > > + case 's': > > + seed = atoi (optarg); > > + break; > > + > > + case 't': > > + timeout = atoi (optarg); > > + break; > > + > > + case 'm': > > + maxcount = atoi (optarg); > > + br

Re: [PATCH] Demangler fuzzer

2014-08-11 Thread Mike Stump
On Aug 11, 2014, at 10:57 AM, Jakub Jelinek wrote: > >> + if (timeout != -1) >> +{ >> + signal (SIGALRM, alarm_handler); >> + alarm (timeout); >> +} > > Not sure how much portable signal/alarm is. So probably should be guarded > by the existence of signal.h, SIGALRM being def

Re: [PATCH] Demangler fuzzer

2014-08-11 Thread Jakub Jelinek
On Mon, Aug 11, 2014 at 05:04:20PM +0100, Gary Benson wrote: > + case 's': > + seed = atoi (optarg); > + break; > + > + case 't': > + timeout = atoi (optarg); > + break; > + > + case 'm': > + maxcount = atoi (optarg); > + break; > + } > +} > +

Re: [PATCH] Demangler fuzzer

2014-08-11 Thread Andi Kleen
Looks good. -Andi

Re: [PATCH] Demangler fuzzer

2014-08-11 Thread Gary Benson
David Malcolm wrote: > On Mon, 2014-08-11 at 08:06 -0700, Andi Kleen wrote: > > Gary Benson writes: > > > srand(time(NULL)); > > > > That's really bad, can never be reproduced. If you use a random > > seed like this you need to at least print it. > > How about taking the random seed and the num

Re: [PATCH] Demangler fuzzer

2014-08-11 Thread David Malcolm
On Mon, 2014-08-11 at 08:06 -0700, Andi Kleen wrote: > Gary Benson writes: > > >srand(time(NULL)); > > That's really bad, can never be reproduced. If you use a random seed > like this you need to at least print it. How about taking the random seed and the number of iterations as command-line a

Re: [PATCH] Demangler fuzzer

2014-08-11 Thread Andi Kleen
Gary Benson writes: >srand(time(NULL)); That's really bad, can never be reproduced. If you use a random seed like this you need to at least print it. -Andi -- a...@linux.intel.com -- Speaking for myself only

Re: [PATCH] Demangler fuzzer

2014-08-11 Thread Gary Benson
Jakub Jelinek wrote: > On Mon, Aug 11, 2014 at 10:27:03AM +0100, Gary Benson wrote: > > This patch adds a simple fuzzer for the libiberty C++ demangler. > > You can run it like this: > > > > make -C /path/to/build/libiberty/testsuite fuzz-demangler > > > > It will run until it dumps core (usual

Re: [PATCH] Demangler fuzzer

2014-08-11 Thread Jakub Jelinek
On Mon, Aug 11, 2014 at 10:27:03AM +0100, Gary Benson wrote: > This patch adds a simple fuzzer for the libiberty C++ demangler. > You can run it like this: > > make -C /path/to/build/libiberty/testsuite fuzz-demangler > > It will run until it dumps core (usually only a few seconds). > > Is thi

[PATCH] Demangler fuzzer

2014-08-11 Thread Gary Benson
Hi all, This patch adds a simple fuzzer for the libiberty C++ demangler. You can run it like this: make -C /path/to/build/libiberty/testsuite fuzz-demangler It will run until it dumps core (usually only a few seconds). Is this ok to commit? Thanks, Gary -- 2014-08-11 Gary Benson