Skip to content

Instantly share code, notes, and snippets.

@edmcman
edmcman / gentrace.patch
Created November 27, 2012 18:25
BAP gentrace patch
===================================================================
--- gentrace.cpp (revision 6904)
+++ gentrace.cpp (working copy)
@@ -478,6 +478,17 @@
return 32;
break;
+ case REG_MM0:
+ case REG_MM1:
+ case REG_MM2:
@edmcman
edmcman / gist:4156198
Created November 27, 2012 18:49
BAP Information gentrace patch
===================================================================
--- libasmir/src/traces/pin_taint.cpp (revision 6904)
+++ libasmir/src/traces/pin_taint.cpp (working copy)
@@ -779,16 +779,19 @@
if (bytes == STATUS_SUCCESS) {
WINDOWS::PIO_STATUS_BLOCK psb = reinterpret_cast<WINDOWS::PIO_STATUS_BLOCK> (args[4]);
assert(psb);
- assert(psb->Information);
- length = psb->Information;
- addr = args[5];
@edmcman
edmcman / vsa-print.patch
Created February 20, 2013 03:00
Patch to add -vsa option to iltrans.ml
Index: utils/iltrans.ml
===================================================================
--- utils/iltrans.ml (revision 7125)
+++ utils/iltrans.ml (working copy)
@@ -103,6 +103,15 @@
let ast_coalesce = Coalesce.coalesce_ast
let ssa_coalesce = Coalesce.coalesce_ssa
+let vsa_print g =
+ let g = Hacks.ssa_remove_indirect g in
@edmcman
edmcman / vsa.ml
Created February 24, 2013 04:43
BAP vsa.ml file
(** Value-Set Analysis / Value-Set Arithmetic
See Gogul Balakrishnan's thesis at
http://pages.cs.wisc.edu/~bgogul/Research/Thesis/thesis.html
TODO:
* Alternate memstore implementation
* Add a real interface; automatically call simplify_cond
* Big int support
* Idea: Use copy propagation information to maintain equivalence
@edmcman
edmcman / gist:5084373
Last active December 14, 2015 12:08
Build klee and llvm from source
#!/bin/bash
# Build Klee on Ubuntu 12.04 LTS
set -e
set -x
sudo apt-get -y install g++ curl dejagnu subversion bison flex
test -e /usr/lib/i686-pc-linux-gnu/4.2.1 || sudo ln -s /usr/lib/i386-linux-gnu /usr/lib/i686-pc-linux-gnu/4.2.1
rm -rf work
mkdir work
@edmcman
edmcman / gist:5192454
Last active December 15, 2015 03:09
Coding styles
match x with
| 1 ->
(match y with
| 1 -> Foo
| 2 -> Bar)
| 2 ->
match x with
| 1 ->
(match y with
@edmcman
edmcman / gist:5310790
Last active December 15, 2015 19:19
Fix BAP's make top
--- Makefile.in (revision 7331)
+++ Makefile.in (revision 7332)
@@ -143,7 +143,7 @@
export OCAMLMKLIB_FLAGS = $(LDFLAGS)
export PPFLAGS = $(SOLVER_PPFLAGS) @LLVM_PPFLAGS@
export INCDIRS = $(BIGINT) $(BATT) $(OUNIT) $(PCRE) $(OCAMLGRAPH) $(OBJSIZE) $(LIBTRACE) $(LIBTRACE)/piqi
-export LIBS =
+export LIBS = zarith batteries objsize oUnit graph pcre libtrace
export RESULTDEPS = $(LIBASMIR)/src/libasmir.a $(VEX_DIR)/libvex.a $(LIBTRACE)/libtrace.cmxa
export LIBDIRS = $(LIBASMIR)/src $(VEX_DIR)
@edmcman
edmcman / stmt.proto
Created May 22, 2013 12:55
BAP stmt proto file
message program {
repeated stmt elem = 1;
}
message stmt {
optional move move = 1;
optional jmp jmp = 2;
optional cjmp cjmp = 3;
optional label_stmt label_stmt = 4;
@edmcman
edmcman / llvm.diff
Created June 10, 2013 19:37
BAP LLVM patch
Index: ocaml/llvm_codegen.ml
===================================================================
--- ocaml/llvm_codegen.ml (revision 7607)
+++ ocaml/llvm_codegen.ml (revision 7608)
@@ -25,7 +25,7 @@
vars: llvalue VH.t;
letvars: llvalue VH.t;
mutable allocbb: llbasicblock option
- }
+}
@edmcman
edmcman / cfg.diff
Created June 14, 2013 14:41
BAP CFG to AST patch
Index: ocaml/cfg_ast.ml
===================================================================
--- ocaml/cfg_ast.ml (revision 7629)
+++ ocaml/cfg_ast.ml (working copy)
@@ -13,7 +13,7 @@
module C = Cfg.AST
-module D = Debug.Make(struct let name = "CFG_AST" and default=`NoDebug end)
+module D = Debug.Make(struct let name = "Cfg_ast" and default=`NoDebug end)