Git Product home page Git Product logo

crow_tmp's Introduction

Logo CROW

Research project on randomization for WebAssembly/WASM.

Prerequisites

  • Python version 3.7

  • Download our changed version of Souper. The main reason behind is that we include some extra options to be able of working together with the SLUMPs core. After downloading all the submodules in SLUMPs, build every one of them following the respective instructions in the original repos.

    Inside the souper folder:

    ./build_deps.sh
    mkdir build
    cd build
    cmake  ../
    make
  • Build wabt toolkit to provide the WASM to WAT conversion for debugging reasons.

    Follow this instructions inside the wabt folder:

    git submodule update --init
    mkdir build
    cd build
    cmake ..
    cmake --build .
  • Install the python requirements: pip3 install -r crow/requirements.txt

Troubleshooting

  • CROW shows a fail in the CLANG step: Install emscripten and run it as follows emcc -v <file>.c. Then copy all the include files in the include configuration for CROW.
  • CROW shows a fail connecting to REDIS: Install Redis in your local pc and ensure that its running, or change the usage of external cache in the Souper config.
  • CROW doesn't find the souper folder: Check the path in the settings file

Config options

  • Optimization subset strategy: generator-method = subset | onexone | all

  • Output only different binaries: prune-equal, we calculate the sha256 value for evey WASM program, then we keep only the programs with different sha values.

Change the remaining values to get different results, for instance, add extra arguments to the CLANG step.

How to use it

In the project root, run bash run.sh <number_of_concurrent_generators> <file.(c|bc)>, collect the output in the folder crow_out

Docker images

To run CROW in an easy way, we provide a Docker image which contains the plumping to work with Souper (our modest changed version), binaryen and wabt. To build it, run: docker build -t slumps/backend:latest -m 8g -f Dockerfile inside the docker_images folder.

If the LLVM build takes to long or fails due to memory lack in the image building: > Increase memory and/or CPU ressources in the docker engine configuration

CROW dockerized app

Bothg images are avaiable in the docker Hub

The application can be ported to a docker container too. To execute SLUMPs, enter in the src file and build the docker image. Run the following command to start the application docker run -it -v $(pwd):/inputs -v $(pwd)/<logs>:/slumps/src/logs -v $(pwd)/<out folder>:/slumps/src/out slumps/crow:latest <program> <config-options> . Slumps will process the fetched code from the arguments, exporting the results to the out folder volumen. You can specify the config parameters, specify the values of <config-options> as %<namespace>.key <value>. For example, to change the timeout per program use <docker_run> %DEFAULT.timeout 3600 <program_url>, this example changes the timeout to 3600 seconds. The other available options and possible values are listed below.

Namespace Key Default value Comments
DEFAULT slumpspath /slumps
debugfile /slumps/src/slumps.debug.txt
outfolder /slumps/src/out
print-sha True
prune-equal True
exit-on-find False
generator-method subset all to superoptimize :)
candidates-threshold 1
fail-silently True
timeout 3600
link-wasi False Add WASI std lib to create WASM binaries
clang command -S -O3 --target=wasm32-unknown-unknown -emit-llvm You can add extra includes
wasm-ld command --no-entry --export-all --allow-undefined -o %s
wabt path /slumps/wabt/bin
wasm2wat /slumps/wabt/bin/wasm2wat
souper solver -z3-path=/slumps/souper/third_party/z3/build/z3
passname libsouperPass.so
souper-debug-level 2
souper-common -solver-timeout=1800

Study of memory disclosure vulnerabilities

Slides

Souper new features

We added some features/options to Souper:

  • souper-subset: Based on the candidate indexes, specify the candidates to be applied, for example -souper-subset=1,2,3,4 or -souper-subset=0,3
  • souper-valid-count: Search for successful optimizations without replacing
  • souper-redis-host: Host for redis
  • souper-redis-pass: Password for redis connection
  • souper-crow-workers: Number of concurrent threads looking for replacements
  • souper-crow-port: To which socket port send the found replacement information

Issues

  • LLVM frontend for WASM: This will provide the WASM -> WASM behavior in CROW

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.