diff --git a/README.md b/README.md index 99b82c5a..111dc6d5 100644 --- a/README.md +++ b/README.md @@ -83,6 +83,14 @@ $ probe dump That's a huge [work in progress](https://github.com/charmoniumQ/PROBE/pulls). +We're starting out with just "analysis" of the provenance. Does this input file influence that output file in the PROBEd process? Run + + +``` bash +nix shell nixpkgs#graphviz github:charmoniumQ/PROBE#probe-py-manual \ + --command sh -c 'python -m probe_py.manual.cli process-graph | tee /dev/stderr | dot -Tpng -ooutput.png /dev/stdin' +``` + ## Developing PROBE 1. Follow the previous step to install Nix. diff --git a/output.png b/output.png new file mode 100644 index 00000000..ab90c424 Binary files /dev/null and b/output.png differ diff --git a/probe_src/libprobe/Makefile b/probe_src/libprobe/Makefile index 8662124c..68b4daeb 100644 --- a/probe_src/libprobe/Makefile +++ b/probe_src/libprobe/Makefile @@ -1,5 +1,5 @@ SOURCE_VERSION ?= $(shell git rev-parse --short HEAD) -CFLAGS ?= -DSOURCE_VERSION=\"$(SOURCE_VERSION)\" -Wno-cast-function-type -Wno-array-parameter -ffreestanding -Wl,--as-needed -Wall -Wextra -pthread -fPIC -nostdlib -shared $(NIX_CFLAGS_COMPILE) +CFLAGS ?= -DSOURCE_VERSION=\"$(SOURCE_VERSION)\" -Wno-cast-function-type -Wno-array-parameter -ffreestanding -Wl,--as-needed -ldl -Wall -Wextra -pthread -fPIC -nostdlib -shared $(NIX_CFLAGS_COMPILE) DBGCFLAGS ?= -Og -g OPTCFLAGS ?= -O3 -DNDEBUG diff --git a/probe_src/libprobe/include/libprobe/prov_ops.h b/probe_src/libprobe/include/libprobe/prov_ops.h index da3ea6a1..9e0764a5 100644 --- a/probe_src/libprobe/include/libprobe/prov_ops.h +++ b/probe_src/libprobe/include/libprobe/prov_ops.h @@ -1,25 +1,3 @@ -#ifdef PYCPARSER -#define _BITS_BYTESWAP_H -#define __attribute__(x) -#define __bswap_64(x) -#define __restrict -#define __inline -#define __extension__ -#define BORROWED -#define OWNED -#define _GNU_SOURCE -#define __asm__(x) -#define __signed__ signed -#include -#include -#include -#include -#include -#include -#include -#include -#endif - struct Path { int32_t dirfd_minus_at_fdcwd; const char* path; /* path valid if non-null */ diff --git a/probe_src/probe_frontend/lib/build.rs b/probe_src/probe_frontend/lib/build.rs index 1c1b6923..c4dd6ca8 100644 --- a/probe_src/probe_frontend/lib/build.rs +++ b/probe_src/probe_frontend/lib/build.rs @@ -162,6 +162,12 @@ fn main() { .into_string() .unwrap(), ) + .clang_args( + env::var("CFLAGS") + .unwrwap_or("".to_owned()) + .split(':') + .filter(|string| !string.is_empty()) + ) // .header_contents("sizeof", " // const size_t OP_SIZE = sizeof(struct Op); // ") diff --git a/test.dot b/test.dot new file mode 100644 index 00000000..ef6bcde5 --- /dev/null +++ b/test.dot @@ -0,0 +1,64 @@ +strict digraph { +"(911755, 0, 911755, 0)" [label="911755.0.911755.0\nInitExecEpochOp"]; +"(911755, 0, 911755, 1)" [label="911755.0.911755.1\nInitThreadOp"]; +"(911755, 0, 911755, 2)" [label="911755.0.911755.2\nOpenOp\n. (fd=7)"]; +"(911755, 0, 911755, 3)" [label="911755.0.911755.3\nReaddirOp"]; +"(911755, 0, 911755, 4)" [label="911755.0.911755.4\nReaddirOp"]; +"(911755, 0, 911755, 5)" [label="911755.0.911755.5\nReaddirOp"]; +"(911755, 0, 911755, 6)" [label="911755.0.911755.6\nReaddirOp"]; +"(911755, 0, 911755, 7)" [label="911755.0.911755.7\nReaddirOp"]; +"(911755, 0, 911755, 8)" [label="911755.0.911755.8\nReaddirOp"]; +"(911755, 0, 911755, 9)" [label="911755.0.911755.9\nReaddirOp"]; +"(911755, 0, 911755, 10)" [label="911755.0.911755.10\nReaddirOp"]; +"(911755, 0, 911755, 11)" [label="911755.0.911755.11\nReaddirOp"]; +"(911755, 0, 911755, 12)" [label="911755.0.911755.12\nReaddirOp"]; +"(911755, 0, 911755, 13)" [label="911755.0.911755.13\nReaddirOp"]; +"(911755, 0, 911755, 14)" [label="911755.0.911755.14\nReaddirOp"]; +"(911755, 0, 911755, 15)" [label="911755.0.911755.15\nReaddirOp"]; +"(911755, 0, 911755, 16)" [label="911755.0.911755.16\nReaddirOp"]; +"(911755, 0, 911755, 17)" [label="911755.0.911755.17\nReaddirOp"]; +"(911755, 0, 911755, 18)" [label="911755.0.911755.18\nReaddirOp"]; +"(911755, 0, 911755, 19)" [label="911755.0.911755.19\nReaddirOp"]; +"(911755, 0, 911755, 20)" [label="911755.0.911755.20\nReaddirOp"]; +"(911755, 0, 911755, 21)" [label="911755.0.911755.21\nReaddirOp"]; +"(911755, 0, 911755, 22)" [label="911755.0.911755.22\nReaddirOp"]; +"(911755, 0, 911755, 23)" [label="911755.0.911755.23\nReaddirOp"]; +"(911755, 0, 911755, 24)" [label="911755.0.911755.24\nReaddirOp"]; +"(911755, 0, 911755, 25)" [label="911755.0.911755.25\nReaddirOp"]; +"(911755, 0, 911755, 26)" [label="911755.0.911755.26\nReaddirOp"]; +"(911755, 0, 911755, 27)" [label="911755.0.911755.27\nReaddirOp"]; +"(911755, 0, 911755, 28)" [label="911755.0.911755.28\nCloseOp\n7"]; +"(911755, 0, 911755, 29)" [label="911755.0.911755.29\nCloseOp\n1"]; +"(911755, 0, 911755, 30)" [label="911755.0.911755.30\nCloseOp\n2"]; +"(911755, 0, 911755, 0)" -> "(911755, 0, 911755, 1)" [color=green]; +"(911755, 0, 911755, 1)" -> "(911755, 0, 911755, 2)" [color=green]; +"(911755, 0, 911755, 2)" -> "(911755, 0, 911755, 3)" [color=green]; +"(911755, 0, 911755, 3)" -> "(911755, 0, 911755, 4)" [color=green]; +"(911755, 0, 911755, 4)" -> "(911755, 0, 911755, 5)" [color=green]; +"(911755, 0, 911755, 5)" -> "(911755, 0, 911755, 6)" [color=green]; +"(911755, 0, 911755, 6)" -> "(911755, 0, 911755, 7)" [color=green]; +"(911755, 0, 911755, 7)" -> "(911755, 0, 911755, 8)" [color=green]; +"(911755, 0, 911755, 8)" -> "(911755, 0, 911755, 9)" [color=green]; +"(911755, 0, 911755, 9)" -> "(911755, 0, 911755, 10)" [color=green]; +"(911755, 0, 911755, 10)" -> "(911755, 0, 911755, 11)" [color=green]; +"(911755, 0, 911755, 11)" -> "(911755, 0, 911755, 12)" [color=green]; +"(911755, 0, 911755, 12)" -> "(911755, 0, 911755, 13)" [color=green]; +"(911755, 0, 911755, 13)" -> "(911755, 0, 911755, 14)" [color=green]; +"(911755, 0, 911755, 14)" -> "(911755, 0, 911755, 15)" [color=green]; +"(911755, 0, 911755, 15)" -> "(911755, 0, 911755, 16)" [color=green]; +"(911755, 0, 911755, 16)" -> "(911755, 0, 911755, 17)" [color=green]; +"(911755, 0, 911755, 17)" -> "(911755, 0, 911755, 18)" [color=green]; +"(911755, 0, 911755, 18)" -> "(911755, 0, 911755, 19)" [color=green]; +"(911755, 0, 911755, 19)" -> "(911755, 0, 911755, 20)" [color=green]; +"(911755, 0, 911755, 20)" -> "(911755, 0, 911755, 21)" [color=green]; +"(911755, 0, 911755, 21)" -> "(911755, 0, 911755, 22)" [color=green]; +"(911755, 0, 911755, 22)" -> "(911755, 0, 911755, 23)" [color=green]; +"(911755, 0, 911755, 23)" -> "(911755, 0, 911755, 24)" [color=green]; +"(911755, 0, 911755, 24)" -> "(911755, 0, 911755, 25)" [color=green]; +"(911755, 0, 911755, 25)" -> "(911755, 0, 911755, 26)" [color=green]; +"(911755, 0, 911755, 26)" -> "(911755, 0, 911755, 27)" [color=green]; +"(911755, 0, 911755, 27)" -> "(911755, 0, 911755, 28)" [color=green]; +"(911755, 0, 911755, 28)" -> "(911755, 0, 911755, 29)" [color=green]; +"(911755, 0, 911755, 29)" -> "(911755, 0, 911755, 30)" [color=green]; +} +