#!/usr/bin/env bash # -*- coding: utf-8 -*- # # dissector_fuzz.sh -- fuzz test netsniff-ng's dissector and pcap io methods # with shitty pcap example files from the Wireshark archive # # Copyright (C) 2012 Daniel Borkmann # Copyright (C) 2012 Stefan Seering # # Note: build and *install* the toolkit first before running this script! # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 as # published by the Free Software Foundation. set -u if [ ${BASH_VERSINFO} -lt 3 ] ; then echo 'Error: Your bash need to be version 3 or newer. Exiting.' exit 1 # operators like =~ produce errors silently in old bash versions, so exit here fi archive='ftp://wireshark.org/automated/captures/' show_output='' # empty string evaluates to false run_through='' # empty string evaluates to false count_cores=0 count_files=0 netsniff_ng_opts='' if [ $# -gt 0 ] ; then if [ "$1" = '-h' -o "$1" = '--help' -o "$1" = '--usage' ] ; then echo 'Usage: dissector_fuzz [-s (show netsniff-ng output, default: no)] [-r (keep running on errors, default: no)] [netsniff-ng long-args]' exit 0 fi for opt in $@ ; do if [ "${opt}" = '-s' ] ; then show_output='true' elif [ "${opt}" = '-r' ] ; then run_through='true' else netsniff_ng_opts="${netsniff_ng_opts} ${opt}"; fi done fi mkdir -p fuzzing cd fuzzing wget -r -Nc -np -nd -A.pcap "$archive" |& grep -E "%|^--" ulimit -c unlimited rm -f core for file in *.pcap do echo "Testing file $file ..." if [ $show_output ]; then netsniff-ng --in "$file" "${netsniff_ng_opts}" else netsniff-ng --in "$file" "${netsniff_ng_opts}" > /dev/null fi if [ -e core ]; then echo "Fuck, core dumped on $file!" let count_cores=count_cores+1 if [ $run_through ]; then rm core else exit fi fi done if which cowsay > /dev/null ; then echo_cmd='cowsay' else echo_cmd='echo' fi ${echo_cmd} 'Your fuckup Score' echo " * tested pcaps: $count_files" echo " * core dumps: $count_cores" ='/cgit.cgi/linux/net-next.git/diff/?h=nds-private-remove&id=8ef0b5383110977d81746cd0b09c3877d51c3a67'>diff
diff options
context:
space:
mode:
authorVaibhav Hiremath <hiremath_vaibhav@projectara.com>2016-08-03 17:15:38 +0530
committerGreg Kroah-Hartman <gregkh@google.com>2016-08-03 15:43:51 +0200
commit8ef0b5383110977d81746cd0b09c3877d51c3a67 (patch)
treee401faaa6f7119157efc52da52ffb2eb0a59d09d
parent60793c9be9a140e2102a0f64a38d34e9b28a1357 (diff)
greybus: arche-platform: Reset SVC & APB only if turned off by SUSPEND_PREPARE
There is possible race condition in arche platform driver for maintaining of ->state field, when shared with timesync driver. Assume device booted fine, all connected modules have been enumerated correctly. As part of suspend-resume operation we have pm_notifier callback, where we turn off SVC & APB and coldboot on resume. In the process of resume, all modules gets enumerated again, and timesync driver does come into picture everytime. So when timesync driver requests arche-platform to change the state to TIMESYNC and in the middle of sync operation, if suspend gets triggered, then execution lands into arche-platform->pm_notifier callback, leading to race condition in the driver, where it checks for (state != ACTIVE) in PM_SUSPEND_PREPARE and returns, but in PM_POST_SUSPEND it just simply coldboots SVC & APB, which would inbalance all resources (including IRQ). So we need a add check in PM_POST_SUSPEND, to make sure that, we only coldboot devices if they are in to off state, i.e. if (state != OFF) then return. Testing Done: Done regressive suspend/resume testing on EVT2 platform. Note that, I some time hit issue. Signed-off-by: Vaibhav Hiremath <vaibhav.hiremath@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>