awslabs / snapchange

Lightweight fuzzing of a memory snapshot using KVM
Apache License 2.0
440 stars 27 forks source link

Error in building example 4 #41

Open amirmohammadeftekhar opened 2 months ago

amirmohammadeftekhar commented 2 months ago

After running the install.sh in the main directory I tried to run the 4th example but I got this error:

# Build the base snapchange target container
docker build -t snapchange_base_target \
  -f Dockerfile.base_target \
  .
[+] Building 0.8s (6/6) FINISHED                                                                                                                                                                                                docker:default
 => [internal] load build definition from Dockerfile.base_target                                                                                                                                                                          0.0s
 => => transferring dockerfile: 222B                                                                                                                                                                                                      0.0s
 => WARN: FromAsCasing: 'as' and 'FROM' keywords' casing do not match (line 1)                                                                                                                                                            0.0s
 => [internal] load metadata for docker.io/library/alpine:edge                                                                                                                                                                            0.8s
 => [internal] load .dockerignore                                                                                                                                                                                                         0.0s
 => => transferring context: 207B                                                                                                                                                                                                         0.0s
 => [1/2] FROM docker.io/library/alpine:edge@sha256:b93f4f6834d5c6849d859a4c07cc88f5a7d8ce5fb8d2e72940d8edd8be343c04                                                                                                                      0.0s
 => CACHED [2/2] RUN apk add --no-cache --initramfs-diskless-boot python3 gdb curl tar build-base perf     nasm gcc git musl-dbg clang compiler-rt llvm gcompat                                                                           0.0s
 => exporting to image                                                                                                                                                                                                                    0.0s
 => => exporting layers                                                                                                                                                                                                                   0.0s
 => => writing image sha256:c1f4ec8d5a1e863eae56e0af7246610436fde94744a97cf5bf4532cc50d98b05                                                                                                                                              0.0s
 => => naming to docker.io/library/snapchange_base_target                                                                                                                                                                                 0.0s

 1 warning found (use docker --debug to expand):
 - FromAsCasing: 'as' and 'FROM' keywords' casing do not match (line 1)
make[2]: Leaving directory '/home/eftekhar/fuzzing/programs/snapchange/docker'
make[1]: Leaving directory '/home/eftekhar/fuzzing/programs/snapchange/examples/04_syscall_fuzzer'
docker run --rm -i \
        -v /home/eftekhar/fuzzing/programs/snapchange/examples/04_syscall_fuzzer/snapshot:/snapshot \
        -e SNAPSHOT_IMGTYPE=initramfs \
        $(cat dockers/snapshot_image) >/dev/null 2>&1

cargo build -r >/dev/null 2>&1
make: *** [Makefile:36: fuzzer] Error 101

The problem is it doesn't give more information for debugging.

f0rki commented 2 months ago

Try running cargo build in the dir. Output is suppressed by default, even if it fails.

amirmohammadeftekhar commented 2 months ago

Try running cargo build in the dir. Output is suppressed by default, even if it fails.

In the host? or inside the docker? I am a bit confused where.

f0rki commented 2 months ago

Yeah it is a bit confusing. It's not polished. Generally I always built and ran the fuzzer on the host system, so yeah I meant run cargo build on the host. The docker things are just to create the snapshot. (Ofc you can also run the fuzzer in docker if you pass in /dev/kvm)

amirmohammadeftekhar commented 2 months ago

The error looks like this:

cargo build -r 2>&1
   Compiling snapchange v0.1.0 (/home/amir/fuzzing/snapchange)
error[E0433]: failed to resolve: could not find `input_types` in the crate root
    --> /home/amir/fuzzing/snapchange/src/lib.rs:1052:9
     |
1052 |         input_types::bytes::BytesMinimizeState,
     |         ^^^^^^^^^^^ could not find `input_types` in the crate root

error[E0554]: `#![feature]` may not be used on the stable release channel
  --> /home/amir/fuzzing/snapchange/src/lib.rs:96:1
   |
96 | #![feature(exclusive_range_pattern)]
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0554]: `#![feature]` may not be used on the stable release channel
  --> /home/amir/fuzzing/snapchange/src/lib.rs:97:1
   |
97 | #![feature(trait_alias)]
   | ^^^^^^^^^^^^^^^^^^^^^^^^

error[E0554]: `#![feature]` may not be used on the stable release channel
  --> /home/amir/fuzzing/snapchange/src/lib.rs:98:1
   |
98 | #![feature(thread_id_value)]
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0554]: `#![feature]` may not be used on the stable release channel
  --> /home/amir/fuzzing/snapchange/src/lib.rs:99:1
   |
99 | #![feature(map_try_insert)]
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0554]: `#![feature]` may not be used on the stable release channel
   --> /home/amir/fuzzing/snapchange/src/lib.rs:100:1
    |
100 | #![feature(stdsimd)]
    | ^^^^^^^^^^^^^^^^^^^^

error[E0554]: `#![feature]` may not be used on the stable release channel
   --> /home/amir/fuzzing/snapchange/src/lib.rs:101:1
    |
101 | #![feature(avx512_target_feature)]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0554]: `#![feature]` may not be used on the stable release channel
   --> /home/amir/fuzzing/snapchange/src/lib.rs:102:1
    |
102 | #![feature(core_intrinsics)]
f0rki commented 2 months ago

As the error says, you can't use stable rust, you need nightly rust. rustup override set nightly should do the trick.

amirmohammadeftekhar commented 2 months ago

Still not solved completely:

error[E0433]: failed to resolve: could not find `input_types` in the crate root
    --> /home/amir/fuzzing/snapchange/src/lib.rs:1052:9
     |
1052 |         input_types::bytes::BytesMinimizeState,
     |         ^^^^^^^^^^^ could not find `input_types` in the crate root

warning: unused import: `AtomicBool`
 --> /home/amir/fuzzing/snapchange/src/commands/fuzz.rs:9:25
  |
9 | use std::sync::atomic::{AtomicBool, Ordering};
  |                         ^^^^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

warning: the feature `exclusive_range_pattern` has been stable since 1.80.0 and no longer requires an attribute to enable
  --> /home/amir/fuzzing/snapchange/src/lib.rs:96:12
   |
96 | #![feature(exclusive_range_pattern)]
   |            ^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: `#[warn(stable_features)]` on by default

error[E0635]: unknown feature `stdsimd`
   --> /home/amir/fuzzing/snapchange/src/lib.rs:100:12
    |
100 | #![feature(stdsimd)]
    |            ^^^^^^^

warning: use of deprecated method `indexmap::IndexMap::<K, V, S>::remove`: `remove` disrupts the map order -- use `swap_remove` or `shift_remove` for explicit behavior.
   --> /home/amir/fuzzing/snapchange/src/fuzzvm.rs:902:25
    |
902 |                 cov_bps.remove(addr);
    |                         ^^^^^^
    |
    = note: `#[warn(deprecated)]` on by default