wasm-micro-runtime/tests/fuzz/wasm-mutator-fuzz
2025-04-29 11:41:34 +08:00
..
aot-compiler use a selected llvm libs list to replace the full list (#4232) 2025-04-29 11:41:34 +08:00
portal build(deps): Bump esbuild, @vitejs/plugin-react and vite (#4149) 2025-03-20 20:07:13 +08:00
server use a random secret key (#3971) 2024-12-19 16:49:44 +08:00
wasm-mutator use a selected llvm libs list to replace the full list (#4232) 2025-04-29 11:41:34 +08:00
workspace Keep fix the CMake compatibility issue (#4180) 2025-04-15 12:51:19 +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
clang_toolchain.cmake feat(fuzz): add a new fuzzing target about aot compiler (#4121) 2025-04-28 21:44:04 +08:00
CMakeLists.txt use a selected llvm libs list to replace the full list (#4232) 2025-04-29 11:41:34 +08:00
docker-compose.yml Add wasm-mutator-fuzz test (#3420) 2024-05-21 12:01:13 +08:00
README.md feat(fuzz): add a new fuzzing target about aot compiler (#4121) 2025-04-28 21:44:04 +08:00
smith_wasm.sh [fuzzing] execute every exported function (#3959) 2025-02-06 13:15:56 +08:00

WAMR fuzz test framework

Install wasm-tools

Download the release suitable for your specific platform from https://github.com/bytecodealliance/wasm-tools/releases/latest, unpack it, and add the executable wasm-tools to the PATH. Then, you should be able to verify that the installation was successful by using the following command:

$ wasm-tools --version
# Or learn subcommands with
$ wasm-tools help

Install clang Toolchain

Refer to: https://apt.llvm.org/ and ensure that you have clang installed.

$ clang --version

$ clang++ --version

Build

# Without custom mutator (libfuzzer modify the buffer randomly)
$ cmake -S . -B build -DCMAKE_TOOLCHAIN_FILE=./clang_toolchain.cmake -DLLVM_DIR=<llvm_install_dir>/lib/cmake/llvm

# TBC: if `wasm-tools mutate` is supported or not
# Or With custom mutator (wasm-tools mutate)
$ cmake -S . -B build -DCMAKE_TOOLCHAIN_FILE=./clang_toolchain.cmake -DLLVM_DIR=<llvm_install_dir>/lib/cmake/llvm -DCUSTOM_MUTATOR=1

# Then
$ cmake --build build

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
$ ./build/wasm-mutator/wasm_mutator_fuzz ./build/CORPUS_DIR

$ ./build/aot-compiler/aot_compiler_fuzz ./build/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