wasm-micro-runtime/tests/fuzz/wasm-mutator-fuzz
liang.he 40c41d5110
Fix several issues reported by oss-fuzz (#3526)
- possible integer overflow in adjust_table_max_size:
  unsigned integer overflow: 2684354559 * 2 cannot be represented in type 'uint32'
- limit max memory size in wasm_runtime_malloc
- add more checks in aot loader
- adjust compilation options
2024-06-13 16:06:36 +08:00
..
portal Add wasm-mutator-fuzz test (#3420) 2024-05-21 12:01:13 +08:00
server Add wasm-mutator-fuzz test (#3420) 2024-05-21 12:01:13 +08:00
workspace wasm-mutator-fuzz: Generate more kinds of corpus (#3487) 2024-05-31 11:16:14 +08:00
.env Add wasm-mutator-fuzz test (#3420) 2024-05-21 12:01:13 +08:00
.gitignore Add wasm-mutator-fuzz test (#3420) 2024-05-21 12:01:13 +08:00
CMakeLists.txt Fix several issues reported by oss-fuzz (#3526) 2024-06-13 16:06:36 +08:00
docker-compose.yml Add wasm-mutator-fuzz test (#3420) 2024-05-21 12:01:13 +08:00
README.md Add wasm-mutator-fuzz test (#3420) 2024-05-21 12:01:13 +08:00
smith_wasm.sh wasm-mutator-fuzz: Generate more kinds of corpus (#3487) 2024-05-31 11:16:14 +08:00
wasm_mutator_fuzz.cc Add wasm-mutator-fuzz test (#3420) 2024-05-21 12:01:13 +08:00

WAMR fuzz test framework

install wasm-tools

1.git clone https://github.com/bytecodealliance/wasm-tools
$ cd wasm-tools
2.This project can be installed and compiled from source with this Cargo command:
$ cargo install wasm-tools
3.Installation can be confirmed with:
$ wasm-tools --version
4.Subcommands can be explored with:
$ wasm-tools help

Build

mkdir build && cd build
# Without custom mutator (libfuzzer modify the buffer randomly)
cmake ..
# With custom mutator (wasm-tools mutate)
cmake .. -DCUSTOM_MUTATOR=1
make -j$(nproc)

Manually generate wasm file in build

# wasm-tools smith generate some valid wasm file
# The generated wasm file is in corpus_dir under build
# N - Number of files to be generated
./smith_wasm.sh N 

# running
``` bash
cd build
./wasm-mutate-fuzz CORPUS_DIR
 

Fuzzing Server

1. Installation Dependent Environment
$ cd server
$ pip install -r requirements.txt

2. Database Migration
$ python3 app/manager.py db init
$ python3 app/manager.py db migrate  
$ python3 app/manager.py db upgrade  

3. Change localhost to your machine's IP address
$ cd ../portal 
$ vim .env   # Change localhost to your machine's IP address  # http://<ip>:16667

4. Run Server and Portal
$ cd ..   # Switch to the original directory
If you want to customize the front-end deployment port:  # defaut 9999
    $ vim .env # Please change the portal_port to the port you want to use 

The server is deployed on port 16667 by default, If you want to change the server deployment port:
    $ vim .env # Please change the server_port to the port you want to use 
    $ vim portal/.env # Please change the VITE_SERVER_URL to the port you want to use  # http://ip:<port>


If your network needs to set up a proxy
    $ vim .env # Change proxy to your proxy address

$ docker-compose up --build -d
Wait for completion, Access the port set by env