Code Monkey home page Code Monkey logo

tasks's Introduction

Instruction set randomization for WebAssembly

  • Task here is to randomize the two Web assembly instructions such as

    • Parametric instrution : drop
    • Control instruction : loop
  • Randomized the above two instruction to

    • drop to drop_rand
    • loop to loop_123.

Below steps show how the wasm interpreter is adapted with drop_rand and loop_123.

STEP 1: Find the file gen-s-parser.py in the binaryen/scripts/gen-s-parser.py

STEP 2: Update the method named instruction_parser() in gen-s-parser.py file with below shown code. It will update the instruction with a tag [for example here the tag for drop is _rand and for loop it is _123]. So for now updated the code as shown below in the gen-s-parser.py file:

  if inst == "drop":
     inst = inst + "_rand"        
  else:
     if inst == "loop":
        inst = inst + "_123"

STEP 3: Run the file gen-s-parser.py in the binaryen/scripts/gen-s-parser.py using the command

  python gen-s-parser.py > ../src/gen-s-parser.inc

The gen-s-parser.py run and emit C++ code.After the gen-s-parser.inc is generated, it is placed in the binaryen/src.

STEP 4: Using cmake and instruction given in binaryen we can build all the tools supported by binaryen compiler such as wasm2js, wasm-opt , wasm-shell etc., [information regarding this tools is given in the binaryen]

STEP 5: After the tools are build use wasm-shell[which can load and interpret WebAssembly code] to check whether the binaryen compiler is adapted to changes or not. Here there two input files are taken one which fails the interpretation and other which passes interpretation successfully.

wasmbackend_copy : file which has instruction drop and loop--------Fails

wasmbackend_copy-randomized_droploop.wast : file which has instruction drop_rand and loop_123--------Passes

NOTE:

tasks's People

Contributors

tareq97 avatar

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.