Skip to content

Instantly share code, notes, and snippets.

@RKX1209
Last active March 28, 2019 04:57
Show Gist options
  • Save RKX1209/e26f136fbcfb0fbe4aeb8cd12e6b42ce to your computer and use it in GitHub Desktop.
Save RKX1209/e26f136fbcfb0fbe4aeb8cd12e6b42ce to your computer and use it in GitHub Desktop.
CERT BFF 2.8 patch
diff --git a/bff-2.8/batch.sh b/bff-2.8/batch.sh
index a7fb5ef22a..6c0af417df 100755
--- a/bff-2.8/batch.sh
+++ b/bff-2.8/batch.sh
@@ -66,7 +66,8 @@ contains() {
scriptlocation=`echo "$(cd "$(dirname "$0")"; pwd)/"`
echo Script location: $scriptlocation/bff.py
platform=`uname -a`
-PINURL=https://software.intel.com/sites/landingpage/pintool/downloads/pin-3.0-76991-gcc-linux.tar.gz
+#PINURL=https://software.intel.com/sites/landingpage/pintool/downloads/pin-3.0-76991-gcc-linux.tar.gz
+PINURL=https://software.intel.com/sites/landingpage/pintool/downloads/pin-3.2-81205-gcc-linux.tar.gz
if ( contains "$platform" "Darwin Kernel Version 11" ); then
mypython="/Library/Frameworks/Python.framework/Versions/2.7/bin/python"
else
diff --git a/bff-2.8/certfuzz/scoring/multiarmed_bandit/arms/base.py b/bff-2.8/certfuzz/scoring/multiarmed_bandit/arms/base.py
index 2fed07c3c3..47fd90477a 100644
--- a/bff-2.8/certfuzz/scoring/multiarmed_bandit/arms/base.py
+++ b/bff-2.8/certfuzz/scoring/multiarmed_bandit/arms/base.py
@@ -60,7 +60,8 @@ class BanditArmBase(object):
self.successes = 0
self.trials = 0
self.probability = None
-
+ self.successratio = {}
+
# initialize probability
self.update()
@@ -79,6 +80,7 @@ class BanditArmBase(object):
'''
self.successes += successes
self.trials += trials
+ self.successratio[successes] = self.successratio.get(successes, 0) + trials
self._update_p(successes, trials)
if self.probability is None:
logger.debug("MAB arm: %s", self)
@@ -86,7 +88,13 @@ class BanditArmBase(object):
elif not (0.0 <= self.probability <= 1.0):
logger.debug("MAB arm: %s", self)
raise BanditArmError('probability must be between 0.0 <= {:f} <= 1.0'.format(self.probability))
-
+ if self.trials <= 0:
+ return
+ with open(str(id(self)) + ".dat", "w") as fp:
+ fp.write("# {} trials\n".format(self.trials))
+ for s in list(range(self.successes + 1)):
+ if s in self.successratio:
+ fp.write("{} {}\n".format(s, float(self.successratio[s]) / float(self.trials)))
def _update_p(self, *_unused_args):
'''
Internal method, ensure that self.probability gets assigned
diff --git a/bff-2.8/configs/bff.yaml b/bff-2.8/configs/bff.yaml
index 79d4d074a8..15197c559d 100644
--- a/bff-2.8/configs/bff.yaml
+++ b/bff-2.8/configs/bff.yaml
@@ -11,7 +11,7 @@
#
##############################################################################
campaign:
- id: convert v5.2.0
+ id: LAVA-M v5.2.0
##############################################################################
@@ -31,8 +31,8 @@ campaign:
#
##############################################################################
target:
- program: ~/convert
- cmdline_template: $PROGRAM $SEEDFILE /dev/null
+ program: ~/who-lava
+ cmdline_template: $PROGRAM $SEEDFILE
##############################################################################
@@ -53,7 +53,7 @@ target:
##############################################################################
directories:
- seedfile_dir: seedfiles/examples
+ seedfile_dir: seedfiles/who
working_dir: ~/fuzzing
results_dir: results
diff --git a/bff-2.8/seedfiles/who/f1.utmp b/bff-2.8/seedfiles/who/f1.utmp
new file mode 100644
index 0000000000..b30aa294cf
Binary files /dev/null and b/bff-2.8/seedfiles/who/f1.utmp differ
diff --git a/bff-2.8/seedfiles/who/f2.utmp b/bff-2.8/seedfiles/who/f2.utmp
new file mode 100644
index 0000000000..201990c980
Binary files /dev/null and b/bff-2.8/seedfiles/who/f2.utmp differ
diff --git a/bff-2.8/seedfiles/who/f3.utmp b/bff-2.8/seedfiles/who/f3.utmp
new file mode 100644
index 0000000000..841846d9b8
Binary files /dev/null and b/bff-2.8/seedfiles/who/f3.utmp differ
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment