andreafioraldi / libafl_quickjs_fuzzing

An example fuzzer about how to fuzz a JS engine combinign Nautilus with Token-level fuzzing
Apache License 2.0
43 stars 7 forks source link

Errors while running build.sh #5

Open finleyfoxcraft opened 8 months ago

finleyfoxcraft commented 8 months ago

I'm hitting these errors when running bash ./build.sh

Trying different revisions of LibAFL didn't help.

error[E0432]: unresolved import `core::simd::SimdOrd`
 --> /home/florian/.cargo/git/checkouts/libafl-c33dc6f5ec2f7a70/977415c/libafl/src/feedbacks/map.rs:8:5
  |
8 | use core::simd::SimdOrd;
  |     ^^^^^^^^^^^^^^^^^^^ no `SimdOrd` in `simd`
  |
help: consider importing one of these items instead
  |
8 | use core::simd::prelude::SimdOrd;
  |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
8 | use crate::prelude::std::simd::prelude::SimdOrd;
  |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
8 | use std::simd::prelude::SimdOrd;
  |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~

error[E0512]: cannot transmute between types of different sizes, or dependently-sized types
  --> /home/florian/.cargo/git/checkouts/libafl-c33dc6f5ec2f7a70/977415c/libafl/src/bolts/anymap.rs:48:5
   |
48 |     assert_eq_size!(TypeId, u64);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: source type: `TypeId` (128 bits)
   = note: target type: `u64` (64 bits)
   = note: this error originates in the macro `assert_eq_size` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0512]: cannot transmute between types of different sizes, or dependently-sized types
  --> /home/florian/.cargo/git/checkouts/libafl-c33dc6f5ec2f7a70/977415c/libafl/src/bolts/anymap.rs:59:5
   |
59 |     assert_eq_size!(TypeId, u64);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: source type: `TypeId` (128 bits)
   = note: target type: `u64` (64 bits)
   = note: this error originates in the macro `assert_eq_size` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0599]: no associated item named `LANES` found for struct `Simd` in the current scope
   --> /home/florian/.cargo/git/checkouts/libafl-c33dc6f5ec2f7a70/977415c/libafl/src/feedbacks/map.rs:490:40
    |
490 |         let steps = size / VectorType::LANES;
    |                                        ^^^^^ associated item not found in `Simd<u8, 16>`
    |
note: if you're trying to build a new `Simd<u8, 16>` consider using one of the following associated functions:
      Simd::<T, N>::splat
      Simd::<T, N>::load
      Simd::<T, N>::from_array
      Simd::<T, N>::from_slice
      and 6 others
   --> /rustc/d18480b84fdbf1efc34f62070951334aa833d761/library/core/src/../../portable-simd/crates/core_simd/src/vector.rs:147:5

error[E0599]: no associated item named `LANES` found for struct `Simd` in the current scope
   --> /home/florian/.cargo/git/checkouts/libafl-c33dc6f5ec2f7a70/977415c/libafl/src/feedbacks/map.rs:491:39
    |
491 |         let left = size % VectorType::LANES;
    |                                       ^^^^^ associated item not found in `Simd<u8, 16>`
    |
note: if you're trying to build a new `Simd<u8, 16>` consider using one of the following associated functions:
      Simd::<T, N>::splat
      Simd::<T, N>::load
      Simd::<T, N>::from_array
      Simd::<T, N>::from_slice
      and 6 others
   --> /rustc/d18480b84fdbf1efc34f62070951334aa833d761/library/core/src/../../portable-simd/crates/core_simd/src/vector.rs:147:5

error[E0599]: no associated item named `LANES` found for struct `Simd` in the current scope
   --> /home/florian/.cargo/git/checkouts/libafl-c33dc6f5ec2f7a70/977415c/libafl/src/feedbacks/map.rs:494:40
    |
494 |             let i = step * VectorType::LANES;
    |                                        ^^^^^ associated item not found in `Simd<u8, 16>`
    |
note: if you're trying to build a new `Simd<u8, 16>` consider using one of the following associated functions:
      Simd::<T, N>::splat
      Simd::<T, N>::load
      Simd::<T, N>::from_array
      Simd::<T, N>::from_slice
      and 6 others
   --> /rustc/d18480b84fdbf1efc34f62070951334aa833d761/library/core/src/../../portable-simd/crates/core_simd/src/vector.rs:147:5

error[E0599]: no method named `simd_max` found for struct `Simd` in the current scope
   --> /home/florian/.cargo/git/checkouts/libafl-c33dc6f5ec2f7a70/977415c/libafl/src/feedbacks/map.rs:498:22
    |
498 |             if items.simd_max(history) != history {
    |                      ^^^^^^^^
   --> /rustc/d18480b84fdbf1efc34f62070951334aa833d761/library/core/src/../../portable-simd/crates/core_simd/src/simd/cmp/ord.rs:30:8
    |
    = note: the method is available for `Simd<u8, 16>` here
    |
    = help: items from traits can only be used if the trait is in scope
help: trait `SimdOrd` which provides `simd_max` is implemented but not in scope; perhaps you want to import it
    |
3   + use core::simd::cmp::SimdOrd;
    |
help: there is a method `simd_min` with a similar name
    |
498 |             if items.simd_min(history) != history {
    |                      ~~~~~~~~

error[E0599]: no associated item named `LANES` found for struct `Simd` in the current scope
   --> /home/florian/.cargo/git/checkouts/libafl-c33dc6f5ec2f7a70/977415c/libafl/src/feedbacks/map.rs:501:50
    |
501 |                     for j in i..(i + VectorType::LANES) {
    |                                                  ^^^^^ associated item not found in `Simd<u8, 16>`
    |
note: if you're trying to build a new `Simd<u8, 16>` consider using one of the following associated functions:
      Simd::<T, N>::splat
      Simd::<T, N>::load
      Simd::<T, N>::from_array
      Simd::<T, N>::from_slice
      and 6 others
   --> /rustc/d18480b84fdbf1efc34f62070951334aa833d761/library/core/src/../../portable-simd/crates/core_simd/src/vector.rs:147:5

   Compiling rangemap v1.5.1
   Compiling clap v4.5.1
Some errors have detailed explanations: E0432, E0512, E0599.
For more information about an error, try `rustc --explain E0432`.
error: could not compile `libafl` (lib) due to 8 previous errors
finleyfoxcraft commented 8 months ago

I've tried to point the LibAFL version to the latest main, but that led to different errors

error[E0599]: no method named `parse_args` found for mutable reference `&mut ClangWrapper` in the current scope
  --> src/bin/libafl_cc.rs:21:14
   |
19 |           if let Some(code) = cc
   |  _____________________________-
20 | |             .cpp(is_cpp)
21 | |             .parse_args(&args)
   | |_____________-^^^^^^^^^^
   |
   = help: items from traits can only be used if the trait is in scope
help: trait `ToolWrapper` which provides `parse_args` is implemented but not in scope; perhaps you want to import it
   |
1  + use libafl_cc::ToolWrapper;
   |
help: there is a method `add_args` with a similar name
   |
21 |             .add_args(&args)
   |              ~~~~~~~~

warning: unused import: `CompilerWrapper`
 --> src/bin/libafl_cc.rs:1:31
  |
1 | use libafl_cc::{ClangWrapper, CompilerWrapper};
  |                               ^^^^^^^^^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

For more information about this error, try `rustc --explain E0599`.
warning: `libafl_quickjs` (bin "libafl_cc") generated 1 warning
error: could not compile `libafl_quickjs` (bin "libafl_cc") due to 1 previous error; 1 warning emitted
warning: build failed, waiting for other jobs to finish...
warning: `libafl_quickjs` (bin "libafl_cxx") generated 1 warning (1 duplicate)
error: could not compile `libafl_quickjs` (bin "libafl_cxx") due to 1 previous error; 1 warning emitted
error[E0432]: unresolved imports `libafl::bolts::core_affinity`, `libafl::bolts::current_nanos`, `libafl::bolts::launcher`, `libafl::bolts::rands`, `libafl::bolts::shmem`, `libafl::bolts::tuples`, `libafl::executors::TimeoutExecutor`
  --> src/lib.rs:16:9
   |
16 |         core_affinity::Cores,
   |         ^^^^^^^^^^^^^ could not find `core_affinity` in `bolts`
17 |         current_nanos,
   |         ^^^^^^^^^^^^^ no `current_nanos` in `bolts`
18 |         launcher::Launcher,
   |         ^^^^^^^^ could not find `launcher` in `bolts`
19 |         rands::StdRand,
   |         ^^^^^ could not find `rands` in `bolts`
20 |         shmem::{ShMemProvider, StdShMemProvider},
   |         ^^^^^ could not find `shmem` in `bolts`
21 |         tuples::tuple_list,
   |         ^^^^^^ could not find `tuples` in `bolts`
...
25 |     executors::{inprocess::InProcessExecutor, ExitKind, TimeoutExecutor},
   |                                                         ^^^^^^^^^^^^^^^ no `TimeoutExecutor` in `executors`

warning: unused import: `stages::mutational::StdMutationalStage`
  --> src/lib.rs:37:5
   |
37 |     stages::mutational::StdMutationalStage,
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: `#[warn(unused_imports)]` on by default

error[E0599]: no function or associated item named `new_tracking` found for struct `MapFeedback` in the current scope
   --> src/lib.rs:198:29
    |
198 |             MaxMapFeedback::new_tracking(&edges_observer, true, false),
    |                             ^^^^^^^^^^^^ function or associated item not found in `MapFeedback<DifferentIsNovel, _, MaxReducer, _, _>`
    |
note: if you're trying to build a new `MapFeedback<DifferentIsNovel, _, MaxReducer, _, _>` consider using one of the following associated functions:
      MapFeedback::<N, O, R, S, T>::new
      MapFeedback::<N, O, R, S, T>::tracking
      MapFeedback::<N, O, R, S, T>::with_names
      MapFeedback::<N, O, R, S, T>::with_name
      MapFeedback::<N, O, R, S, T>::with_names_tracking
   --> /home/florian/.cargo/git/checkouts/libafl-c33dc6f5ec2f7a70/e3f837d/libafl/src/feedbacks/map.rs:674:5
    |
674 |       pub fn new(map_observer: &O) -> Self {
    |       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
688 |       pub fn tracking(map_observer: &O, track_indexes: bool, track_novelties: bool) -> Self {
    |       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
702 |       pub fn with_names(name: &'static str, observer_name: &'static str) -> Self {
    |       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
725 |       pub fn with_name(name: &'static str, map_observer: &O) -> Self {
    |       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
739 | /     pub fn with_names_tracking(
740 | |         name: &'static str,
741 | |         observer_name: &'static str,
742 | |         track_indexes: bool,
743 | |         track_novelties: bool,
744 | |     ) -> Self {
    | |_____________^
help: there is an associated function `tracking` with a similar name
    |
198 |             MaxMapFeedback::tracking(&edges_observer, true, false),
    |                             ~~~~~~~~

error[E0599]: no function or associated item named `new_with_observer` found for struct `TimeFeedback` in the current scope
   --> src/lib.rs:200:27
    |
200 |             TimeFeedback::new_with_observer(&time_observer)
    |                           ^^^^^^^^^^^^^^^^^ function or associated item not found in `TimeFeedback`
    |
note: if you're trying to build a new `TimeFeedback` consider using one of the following associated functions:
      TimeFeedback::new
      TimeFeedback::with_observer
   --> /home/florian/.cargo/git/checkouts/libafl-c33dc6f5ec2f7a70/e3f837d/libafl/src/feedbacks/mod.rs:949:5
    |
949 |     pub fn new(name: &'static str) -> Self {
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
957 |     pub fn with_observer(observer: &TimeObserver) -> Self {
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
help: there is an associated function `with_observer` with a similar name
    |
200 |             TimeFeedback::with_observer(&time_observer)
    |                           ~~~~~~~~~~~~~

error[E0282]: type annotations needed for `StdState<EncodedInput, _, _, _>`
   --> src/lib.rs:207:13
    |
207 |         let mut state = state.unwrap_or_else(|| {
    |             ^^^^^^^^^
...
263 |         if state.corpus().count() < 1 {
    |                           ----- type must be known at this point
    |
help: consider giving `state` an explicit type, where the type for type parameter `C` is specified
    |
207 |         let mut state: StdState<EncodedInput, _, _, _> = state.unwrap_or_else(|| {
    |                      +++++++++++++++++++++++++++++++++

warning: unused import: `Fuzzer`
  --> src/lib.rs:28:14
   |
28 |     fuzzer::{Fuzzer, StdFuzzer},
   |              ^^^^^^

warning: unused import: `Corpus`
  --> src/lib.rs:23:34
   |
23 |     corpus::{CachedOnDiskCorpus, Corpus, OnDiskCorpus},
   |                                  ^^^^^^

warning: unused import: `Evaluator`
  --> src/lib.rs:39:12
   |
39 |     Error, Evaluator,
   |            ^^^^^^^^^

Some errors have detailed explanations: E0282, E0432, E0599.
For more information about an error, try `rustc --explain E0282`.
warning: `libafl_quickjs` (lib) generated 4 warnings
error: could not compile `libafl_quickjs` (lib) due to 4 previous errors; 4 warnings emitted
tokatoka commented 8 months ago

How about moving this thing to LibAFL/fuzzers so that we can keep this updated @andreafioraldi

domenukk commented 8 months ago

Can you try if https://github.com/andreafioraldi/libafl_quickjs_fuzzing/pull/6 fixes this issue?

finleyfoxcraft commented 8 months ago

Yes, that works.