Commit Graph

104 Commits

Author SHA1 Message Date
Gerald Combs 6ee559efd1 Fuzz: Reduce the Valgrind packet limit to 10,000.
Limit Valgrind to the first 10,000 packets in each file.

Change-Id: I27be212ddb437c643ffb413bb9d1c809dbe98a55
Reviewed-on: https://code.wireshark.org/review/29210
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2018-08-21 15:06:48 +00:00
Guy Harris c99e9d6aa4 Add COMMON_ARGS to the "Command and args" message.
Change-Id: I286b7727a7b92ecbc913f55b8e77a505df4a7d5e
Reviewed-on: https://code.wireshark.org/review/28069
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-06-06 19:36:13 +00:00
Gerald Combs a5d6ccc50d Shellcheck fixes.
Fix some issues reported by shellcheck.

Change-Id: I17e280b2845bb75982788744750fc5404df38b4d
Reviewed-on: https://code.wireshark.org/review/28045
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2018-06-06 17:48:55 +00:00
Guy Harris 4af23446b6 Send the "Command and args:" message to the right output file.
Send it to same output file that gets the output ofthetest command, so
that it shows upin the output.

(I spent entirely too much time trying to figure out why 14738 was
happening on the buildbot but not on my machine - it turns out that the
test where it was failing was the one where -V *wasn't* specified, so
the protocol tree *wasn't* being generated, so proto_tree_add_string()
*wasn't* doing some tests that should have thrown an exception.  The
output didn't make it clear that the test that was failing was the one
where the arguments to tshark were -nr, not -nVxr.)

Change-Id: I54e4450029ac56b9ac3d6eff9baf8acc849a5e4c
Reviewed-on: https://code.wireshark.org/review/28003
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-06-04 08:22:16 +00:00
Dario Lombardo 8a5385b9c9 More licenses converted to SPDX.
Change-Id: Id4f987dcdacf06622d70263f4659a4400e30dc39
Reviewed-on: https://code.wireshark.org/review/26332
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-03-07 13:35:49 +00:00
Gerald Combs 184ef02111 Fuzz-test: Handle ABRT.
Trap ABRT and try to pass it on to our runners.

Change-Id: I6e5a9fd63822c9bc84e116b3574abc4ccca448f5
Reviewed-on: https://code.wireshark.org/review/26227
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2018-03-02 18:03:48 +00:00
Gerald Combs d72a18faad Fuzz: Limit the number of packets we process with Valgrind.
Estimating the effort required to process a capture based on its size
isn't very reliable. Instead of rejecting files that are too large, just
limit Valgrind fuzzing to the first 100,000 packets in each file. This
should fix a timeout issue we're seeing on the master fuzzer.

Change-Id: I0117735341d3a183c6131f5f05dbd1d559fc4b3f
Reviewed-on: https://code.wireshark.org/review/23872
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2017-10-09 22:19:39 +00:00
Gerald Combs e8dbf386d8 Fuzz: Write memory leak info to the error log.
When we exit due to excessive memory leaks make sure we say so in the
error log.

Change-Id: I03f60271f3e4bb467fbaa5b9ac17431eed96f300
Reviewed-on: https://code.wireshark.org/review/23870
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2017-10-09 19:23:06 +00:00
Gerald Combs 288fb5e9b4 Fuzz: Fix the capinfos check (again).
Capinfos might return 1 *or* 2 for an invalid capture.

Change-Id: I1ff2ed2a5b252a77a894ad3fe10c983e9a2a1bc0
Reviewed-on: https://code.wireshark.org/review/19752
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2017-01-23 23:24:17 +00:00
Gerald Combs ddb0f7d23c Update fuzz-test to match capinfos behavior.
As of gebd3dc6, capinfos returns 2 for invalid capture files.

Change-Id: I00c1ab44c9929a9e922ac2a1ee8904632c1e460f
Reviewed-on: https://code.wireshark.org/review/19667
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2017-01-18 17:19:41 +00:00
Gerald Combs 9c20527967 fuzz-test: Fix an exit status check.
Make sure we check the exit status of the Valgrind process, not the most
recently executed command.

Change-Id: I3b6bd427383e4271b9ed38a10da6db506a511dc1
Reviewed-on: https://code.wireshark.org/review/18138
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2016-10-10 17:38:51 +00:00
Gerald Combs b725d6c9ac Add an initial "shellcheck" target.
Look for shellcheck in Autotools and CMake, and if found add a target
that checks some of our shell scripts.

Add a "source=" directive to targets that include test-common.sh so
that shellcheck will correctly process the scripts. Note that this
requires shellcheck 0.4.0 or later.

To do: Fix the issues that shellcheck found and check more scripts.

Change-Id: I441f9f59d8a3f8eec6718119c2370f2560b98f3c
Reviewed-on: https://code.wireshark.org/review/17943
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2016-09-26 23:17:02 +00:00
Gerald Combs 17546ad883 Check for ASAN when fuzzing.
Try to determine if we passed -fsanitize=address to gcc or clang and
adjust the ASAN variable fuzz-test.sh, randpkt-test.sh and
test-captures.sh accordingly.

Change-Id: I88a34828fb5875e1a74a3b180ffb3da37daac0bd
Reviewed-on: https://code.wireshark.org/review/17848
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2016-09-24 21:04:31 +00:00
Guy Harris ec0aeb983b Set the VA limit with ulimit -S, and clean up comments.
Other limits are set with -S, do that with the virtual address space
limit as well.

Change-Id: Ie427341a4c7be56d3e8d96be6c1713c56e9bad87
Reviewed-on: https://code.wireshark.org/review/17846
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-09-21 21:41:47 +00:00
Gerald Combs c2b98004df Fuzz test: Make Valgrind error detection more verbose.
When we set VG_ERR_CNT=1 print the reason.

Change-Id: Icb8f2a1e7074044521873b116fc891cc4be4b204
Reviewed-on: https://code.wireshark.org/review/17287
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2016-08-24 17:11:31 +00:00
Jeff Morriss d12561f61a Move the Valgrind size check after the capinfos check of the file.
That way if we pass a file that doesn't exist to the fuzz-test script we won't
get errors from 'ls' complaining that the file doesn't exist.

Change-Id: I33f4bd692775e6d3f990adaaa37b7530d343fe52
Reviewed-on: https://code.wireshark.org/review/15410
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-05-13 03:58:51 +00:00
Gerald Combs d877dcc1c4 Parallelize fuzz-test.sh
Run each "argument" test (e.g. "-nVxr" and "-nr") simultaneously in
the background. This should speed up our tests without reducing the
amount of fuzzing that we do.

Change-Id: I737d1dc09b31e07910d56632bec62da0f35fe222
Reviewed-on: https://code.wireshark.org/review/14432
Reviewed-by: Jaap Keuter <jaap.keuter@xs4all.nl>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2016-03-14 15:54:26 +00:00
João Valverde bf56f28e7f fuzz-test: Add missing new line
Change-Id: I68f85cdbef24289cabb5e46905356c3cc1c39ad8
Reviewed-on: https://code.wireshark.org/review/14252
Reviewed-by: João Valverde <j@v6e.pt>
2016-02-29 22:06:00 +00:00
Gerald Combs 005f44c222 fuzz-test: Move the ASan message outside our loops.
Change-Id: I109a3e222358523de8f43c887bf7551e92fce135
Reviewed-on: https://code.wireshark.org/review/13714
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-02-05 05:24:30 +00:00
Gerald Combs 29b0adac82 fuzz-test: Print the memory limit if ASan is enabled.
Update the 'ulimit -v' FAQ URL while we're here.

Change-Id: I0e1b007295bf609d7a585087b00c97eae01501c2
Reviewed-on: https://code.wireshark.org/review/13696
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-02-04 05:16:47 +00:00
Dario Lombardo 6087f2a260 fuzz-test.sh: added missing option in help.
Change-Id: I7651e18ec6e8338cddc82be90257c5f183804c7c
Reviewed-on: https://code.wireshark.org/review/10011
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-08-13 11:24:08 +00:00
Dario Lombardo 0b7d1611d0 editcap: add change offset.
This option skips some bytes when fuzzing, that prevents some headers from being changed. This focuses fuzzer to a smaller part of the packet.

Change-Id: I1db83235e93f2774a9991e3af70f633487b816fa
Reviewed-on: https://code.wireshark.org/review/9982
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-08-12 21:23:30 +00:00
Evan Huus 08e80b1653 Skip files larger than 8MB in valgrind fuzzing
Follow-up to g2eabd35 which added a 20MB limit, this lowers it quite a bit since
we're still seeing out-of-memory failures with files slightly larger than 8MB.

Based on a quick scan of the menagerie this only excludes another dozen or so
files so we won't lose much coverage.

Ping-Bug: 11395
Change-Id: I8d684bebad553408c68b125330f2878deedc3bff
Reviewed-on: https://code.wireshark.org/review/9849
Reviewed-by: Evan Huus <eapache@gmail.com>
2015-08-02 22:29:35 +00:00
Evan Huus 2eabd353ad Skip large files when fuzzing with valgrind
They run the buildbot out of memory, so just skip them, we don't want to remove
them from the menagerie entirely.

("large" here is > 20000 KB, but that could change)

Change-Id: I58dd9a981be6e6fc661ea624cc0c5258a5986a9f
Ping-Bug: 11395
Reviewed-on: https://code.wireshark.org/review/9768
Reviewed-by: Evan Huus <eapache@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-07-24 11:52:00 +00:00
Evan Huus 8f40e2cd8d tools: permit setting BIN_DIR in the environment
For out-of-tree builds you have to pass the location of your build to our tools
like the fuzz script, valgrind script etc. Modify them so that the value can be
set in the environment rather than requiring a shell script flag.

Set the environment variable in the vagrant provision step, so that the scripts
Just Work (TM) in the VM.

Change-Id: If8ce6b278176085ba6dd994137b82fc989b80124
Reviewed-on: https://code.wireshark.org/review/9168
Reviewed-by: Evan Huus <eapache@gmail.com>
2015-06-26 06:52:58 +00:00
Alexis La Goutte efd53ad5c9 Fuzz test : Add -a(SAN) option to disable ulimit when fuzzing
from https://code.google.com/p/address-sanitizer/wiki/AddressSanitizer#ulimit_-v
The ulimit -v command makes little sense with ASan-ified binaries because ASan consumes 20 terabytes of virtual memory (plus a bit).

Change-Id: I8c8c77dd51d5440fb2f9bd95f90873e59a64d409
Reviewed-on: https://code.wireshark.org/review/7204
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Reviewed-by: Evan Huus <eapache@gmail.com>
2015-03-04 01:52:21 +00:00
Evan Huus 27d1b6addf Bump the time limit for valgrind fuzzing
Some captures are still hitting the limit as a false positive.

Bug: 10122
Change-Id: I12dd26ba0f96f44799f5ae642b1f9b0487f86a8a
Reviewed-on: https://code.wireshark.org/review/3982
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-09-04 12:54:16 +00:00
Evan Huus 3a943e9254 Reduce maximum permitted leakage to 100KB
Down from 500KB. The old value only triggered once that I can recall, and the
"average" leakage I'm seeing on most captures is only a few KB now, so this
shouldn't flood us with issues (which was the original concern leaving it so
high).

Change-Id: Ie4c98696b3fb7a533a7dc4f83c7ac8c458b499c8
Reviewed-on: https://code.wireshark.org/review/2633
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-06-24 23:43:28 +00:00
Evan Huus ff466a9b92 Increase time permitted when fuzzing with valgrind.
The capture on bug 10098 times out but I don't see any culprits for bad loops or
anything - I think the capture is just too big. I'd prefer somebody else take a
look at it to verify I'm not missing anything before submitting this.

Bug:10098
Change-Id: I2cc43fd6ac9afaa345e7d31184483a9732fd6bf0
Reviewed-on: https://code.wireshark.org/review/1583
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-05-11 21:13:06 +00:00
Bill Meier 550e3153bf Fix fuzz-test.sh '-b' option so it works again; Do some other tools/*test*.sh changes
- Add -b option to randpkt-test.sh and test-captures.sh;
- Create/ue a common function to do '-x' tests on files/dirs;
- Rename exit_error function to ws_exit_error

Change-Id: I032c9d784bec1fb6b0717aaad08a061e4d935476
Reviewed-on: https://code.wireshark.org/review/872
Reviewed-by: Bill Meier <wmeier@newsguy.com>
Tested-by: Bill Meier <wmeier@newsguy.com>
2014-03-30 21:03:15 +00:00
Jeff Morriss 82e2865739 Remove $Id$ and other Subversion leftovers from the tools.
There are a few things in here which could still use attention.

Don't regenerate anything now.

Change-Id: I283c224d3523212144707fca3d6265916cb11792
Reviewed-on: https://code.wireshark.org/review/205
Reviewed-by: Jeff Morriss <jeff.morriss.ws@gmail.com>
2014-02-14 01:35:57 +00:00
Evan Huus 3cbe97de5f Give valgrind fuzzing a bit more time. Otherwise we have some large (~80MB)
captures in the menagerie which time out even under normal circumstances.

svn path=/trunk/; revision=54941
2014-01-24 15:52:28 +00:00
Evan Huus ccbaea51d8 Valgrind requires more resources than running normally. Bump limits to 1.5x
normal when fuzzing with valgrind, as otherwise half the menagerie runs out of
memory.

svn path=/trunk/; revision=51515
2013-08-25 17:23:15 +00:00
Evan Huus 0ea379e46d Be sure to forward BIN_DIR to the valgrind script, probably also needed on the
fuzz-but.

svn path=/trunk/; revision=51391
2013-08-16 13:45:00 +00:00
Evan Huus 5d8b79cff5 Try to use smarter path resolution and detection in order to work in
environments that are not the build tree (namely the fuzz-bot, but this might
make normal out-of-tree builds easier too).

svn path=/trunk/; revision=51387
2013-08-16 01:52:51 +00:00
Evan Huus f9834195ed Don't let a valgrind-output-parsing error hide the fact that it was an error of
some sort: if we don't recognize valgrind's output then something somewhere went
wrong and we should be informed.

svn path=/trunk/; revision=51300
2013-08-11 17:48:49 +00:00
Evan Huus 7d73903af6 Multiple improvements and bug-fixes for the fuzz-test script:
- fix a few pieces of bad indentation
- exit cleanly in all cases where we receive a SIGINT or other signal
- check for valgrind bugs and dissector errors with every set of arguments (-nr
  vs -nVxr etc) not just the last
- consider it an error if valgrind reports more than 500KB of leaked memory

For the last point, 500KB is hopefully a safe choice for now since we only leak
about 2KB "by default" and I have no idea what the state of most "non-default"
code is with respect to memory leaks. I would like to eventually work this
down to 0 of course :)

svn path=/trunk/; revision=50895
2013-07-25 23:28:38 +00:00
Jeff Morriss f3b4e97bcc Add (GPLv2+) license headers to these scripts, assigning the copyright to
the original author of the scripts (Gerald).

svn path=/trunk/; revision=50542
2013-07-12 21:51:34 +00:00
Jeff Morriss 470bd4455a Add a new environment variable to cause abort()s if we add too many items
to the tree (to separate this case from the generic DISSECTOR_BUG case).

Enable this environment variable when fuzz testing.

Enable the 3rd (without tree but with a read filter) check (added in r49643)
when testing capture files but not when fuzz testing--not sure if we want to
add even more to the fuzzbot's work load now (OTOH I've been running it for
a while and it hasn't buried me in bugs).

svn path=/trunk/; revision=49784
2013-06-05 14:08:40 +00:00
Jeff Morriss b49c3e7eca Oh yeah, -R is now -Y in trunk.
svn path=/trunk/; revision=49646
2013-05-31 02:03:03 +00:00
Jeff Morriss c56c403a52 As discussed in https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8728#c4 :
Running tshark with a read filter ("-R") and without building the full tree
("-V") causes it to run into some more bugs (usually loops adding more than
100000 items to the tree).  Add some (commented out for now) code to do
this...

svn path=/trunk/; revision=49643
2013-05-31 01:38:55 +00:00
Jeff Morriss 4509929f2a Exit if we can't load the test-common.sh library.
svn path=/trunk/; revision=49625
2013-05-30 00:35:46 +00:00
Evan Huus 0c671d8d4d Remove some of the extra noise added while trying to figure out why
the build-bot's valgrind pass wasn't running with/without tree. It's still
broken, but the debug output wasn't giving us any useful information.

svn path=/trunk/; revision=49464
2013-05-20 22:00:39 +00:00
Evan Huus 0a530b2a1f When fuzzing with valgrind and running without -T, run with -v so that the
argument string is non-empty. Perhaps this will fix the fuzz-bot which fails
to run with the empty argument string...

svn path=/trunk/; revision=49075
2013-04-27 14:03:45 +00:00
Gerald Combs b25fa89125 Reverse the arguments we feed to valgrind-wireshark.sh. Add debugging
output.

svn path=/trunk/; revision=48895
2013-04-17 17:23:41 +00:00
Gerald Combs 3c66ac4b83 Forward-port r47305 from trunk-1.8:
------------------------------------------------------------------------
  r47305 | gerald | 2013-01-26 12:12:52 -0800 (Sat, 26 Jan 2013) | 6 lines
  Changed paths:
     M /trunk-1.8/tools/fuzz-test.sh

  Instead of setting resource limits on the fuzz-test.sh process itself,
  set limits on the TShark subprocess. This should hopefully take care
  of the strange fuzz failures we've seen lately.

  Reduce the maximum CPU time to 5 minutes while we're at it.
  ------------------------------------------------------------------------

svn path=/trunk/; revision=47307
2013-01-26 20:36:57 +00:00
Evan Huus 5c57af2df2 When fuzz-testing with valgrind, run both with and without tree (like when
fuzz-testing without valgrind).

svn path=/trunk/; revision=46950
2013-01-05 14:27:37 +00:00
Gerald Combs 739c90f0ad Move a lot of common fuzz-test and randpkt-test code to its own file
(test-common.sh). Add build information to the error output as suggested
in http://www.wireshark.org/lists/wireshark-dev/201212/msg00037.html

svn path=/trunk/; revision=46446
2012-12-07 17:57:09 +00:00
Gerald Combs 6c92b6d86a Add an option (-P) for a minimum plugin count.
svn path=/trunk/; revision=45800
2012-10-26 16:30:48 +00:00
Evan Huus bfe304a9a4 Make the fuzz-test plugin error into a warning, since lacking plugins
doesn't seem (to me) to warrant preventing someone from fuzz-testing.

Anyone know why this was put in in the first place?

svn path=/trunk/; revision=45733
2012-10-22 23:33:48 +00:00