Upgrade to Rust 2021 Edition (#340)

* Enable missing const_xxh3 feature

* Move to Rust 2021 Edition

* Fix clippy complaints

* Remove imports made unecessary in 2021 edition
This commit is contained in:
Jordan McLeod 2021-11-04 04:59:49 -04:00 committed by GitHub
parent 43a32f9e2b
commit 3d436b7519
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
48 changed files with 49 additions and 73 deletions

View File

@ -1,7 +1,7 @@
[package]
name = "pylibafl"
version = "0.1.0"
edition = "2018"
edition = "2021"
[dependencies]
pyo3 = { version = "0.14.3", features = ["extension-module"] }

View File

@ -2,7 +2,7 @@
name = "baby_fuzzer"
version = "0.6.1"
authors = ["Andrea Fioraldi <andreafioraldi@gmail.com>", "Dominik Maier <domenukk@gmail.com>"]
edition = "2018"
edition = "2021"
[features]
default = ["std"]

View File

@ -2,7 +2,7 @@
name = "baby_fuzzer"
version = "0.6.0"
authors = ["Andrea Fioraldi <andreafioraldi@gmail.com>", "Dominik Maier <domenukk@gmail.com>"]
edition = "2018"
edition = "2021"
[features]
default = ["std"]

View File

@ -2,7 +2,7 @@
name = "baby_fuzzer"
version = "0.6.0"
authors = ["Andrea Fioraldi <andreafioraldi@gmail.com>", "Dominik Maier <domenukk@gmail.com>"]
edition = "2018"
edition = "2021"
[features]
default = ["std"]

View File

@ -2,7 +2,7 @@
name = "baby_no_std"
version = "0.6.1"
authors = ["Andrea Fioraldi <andreafioraldi@gmail.com>", "Dominik Maier <domenukk@gmail.com>"]
edition = "2018"
edition = "2021"
[profile.dev]
panic = "abort"

View File

@ -2,7 +2,7 @@
name = "forkserver_simple"
version = "0.6.1"
authors = ["tokatoka <tokazerkje@outlook.com>"]
edition = "2018"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
@ -16,4 +16,4 @@ codegen-units = 1
opt-level = 3
[dependencies]
libafl = { path = "../../libafl/" }
libafl = { path = "../../libafl/" }

View File

@ -2,7 +2,7 @@
name = "frida_libpng"
version = "0.6.1"
authors = ["Andrea Fioraldi <andreafioraldi@gmail.com>", "Dominik Maier <domenukk@gmail.com>"]
edition = "2018"
edition = "2021"
build = "build.rs"
[features]

View File

@ -2,7 +2,7 @@
name = "fuzzbench"
version = "0.6.1"
authors = ["Andrea Fioraldi <andreafioraldi@gmail.com>", "Dominik Maier <domenukk@gmail.com>"]
edition = "2018"
edition = "2021"
[features]
default = ["std"]

View File

@ -2,7 +2,7 @@
name = "fuzzbench"
version = "0.6.1"
authors = ["Andrea Fioraldi <andreafioraldi@gmail.com>", "Dominik Maier <domenukk@gmail.com>"]
edition = "2018"
edition = "2021"
[features]
default = ["std"]

View File

@ -2,7 +2,7 @@
name = "fuzzbench_qemu"
version = "0.6.1"
authors = ["Andrea Fioraldi <andreafioraldi@gmail.com>", "Dominik Maier <domenukk@gmail.com>"]
edition = "2018"
edition = "2021"
[features]
default = ["std"]

View File

@ -2,7 +2,7 @@
name = "generic_inmemory"
version = "0.6.1"
authors = ["Andrea Fioraldi <andreafioraldi@gmail.com>", "Dominik Maier <domenukk@gmail.com>"]
edition = "2018"
edition = "2021"
[features]
default = ["std"]

View File

@ -2,7 +2,7 @@
name = "libfuzzer_libmozjpeg"
version = "0.6.1"
authors = ["Andrea Fioraldi <andreafioraldi@gmail.com>", "Dominik Maier <domenukk@gmail.com>"]
edition = "2018"
edition = "2021"
[features]
default = ["std"]

View File

@ -2,7 +2,7 @@
name = "libfuzzer_libpng"
version = "0.6.1"
authors = ["Andrea Fioraldi <andreafioraldi@gmail.com>", "Dominik Maier <domenukk@gmail.com>"]
edition = "2018"
edition = "2021"
[features]
default = ["std"]

View File

@ -2,7 +2,7 @@
name = "libfuzzer_libpng_launcher"
version = "0.6.1"
authors = ["Andrea Fioraldi <andreafioraldi@gmail.com>", "Dominik Maier <domenukk@gmail.com>"]
edition = "2018"
edition = "2021"
[features]
default = ["std"]

View File

@ -2,7 +2,7 @@
name = "libfuzzer_reachability"
version = "0.6.1"
authors = ["Andrea Fioraldi <andreafioraldi@gmail.com>", "Dominik Maier <domenukk@gmail.com>"]
edition = "2018"
edition = "2021"
[features]
default = ["std"]

View File

@ -2,7 +2,7 @@
name = "libfuzzer_stb_image"
version = "0.6.1"
authors = ["Andrea Fioraldi <andreafioraldi@gmail.com>", "Dominik Maier <domenukk@gmail.com>"]
edition = "2018"
edition = "2021"
build = "build.rs"
[features]

View File

@ -2,7 +2,7 @@
name = "libfuzzer_stb_image_concolic"
version = "0.6.1"
authors = ["Andrea Fioraldi <andreafioraldi@gmail.com>", "Dominik Maier <domenukk@gmail.com>", "Julius Hohnerlein"]
edition = "2018"
edition = "2021"
build = "build.rs"
[features]

View File

@ -1,7 +1,7 @@
[package]
name = "example_runtime"
version = "0.1.0"
edition = "2018"
edition = "2021"
authors = ["Julius Hohnerlein <julihoh@users.noreply.github.com>"]
[lib]

View File

@ -2,7 +2,7 @@
name = "libfuzzer_stb_image"
version = "0.6.1"
authors = ["Andrea Fioraldi <andreafioraldi@gmail.com>", "Dominik Maier <domenukk@gmail.com>"]
edition = "2018"
edition = "2021"
build = "build.rs"
[features]

View File

@ -2,7 +2,7 @@
name = "push_harness"
version = "0.5.0"
authors = ["Andrea Fioraldi <andreafioraldi@gmail.com>", "Dominik Maier <domenukk@gmail.com>"]
edition = "2018"
edition = "2021"
[features]
default = ["std"]
@ -20,4 +20,4 @@ debug = true
[dependencies]
libafl = { path = "../../libafl/" }
klo-routines = { version = "0.1.0", git = "https://github.com/andreafioraldi/klo-routines.git", rev = "b8e2fb6" }
klo-routines = { version = "0.1.0", git = "https://github.com/andreafioraldi/klo-routines.git", rev = "b8e2fb6" }

View File

@ -2,7 +2,7 @@
name = "tutorial"
version = "0.6.1"
authors = ["Andrea Fioraldi <andreafioraldi@gmail.com>", "Dominik Maier <domenukk@gmail.com>"]
edition = "2018"
edition = "2021"
[features]
default = ["std"]

View File

@ -8,7 +8,7 @@ repository = "https://github.com/AFLplusplus/LibAFL/"
readme = "../README.md"
license = "MIT OR Apache-2.0"
keywords = ["fuzzing", "testing", "security"]
edition = "2018"
edition = "2021"
build = "build.rs"
[build-dependencies]
@ -18,7 +18,7 @@ rustc_version = "0.4"
criterion = "0.3" # Benchmarking
ahash = "0.7" # another hash
fxhash = "0.2.1" # yet another hash
xxhash-rust = { version = "0.8.2", features = ["xxh3"] } # xxh3 hashing for rust
xxhash-rust = { version = "0.8.2", features = ["xxh3", "const_xxh3"] } # xxh3 hashing for rust
serde_json = "1.0.60"
num_cpus = "1.0" # cpu count, for llmp example
serial_test = "0.5"

View File

@ -1,7 +1,5 @@
//! Compare the speed of rust hash implementations
use ahash;
use fxhash;
use std::hash::Hasher;
use xxhash_rust::const_xxh3;
use xxhash_rust::xxh3;

View File

@ -4,7 +4,7 @@ This shows how llmp can be used directly, without libafl abstractions
extern crate alloc;
#[cfg(all(unix, feature = "std"))]
use core::{convert::TryInto, time::Duration};
use core::time::Duration;
#[cfg(all(unix, feature = "std"))]
use std::{thread, time};
@ -124,13 +124,13 @@ fn main() {
.expect("no mode specified, chose 'broker', 'b2b', 'ctr', 'adder', or 'large'");
let port: u16 = std::env::args()
.nth(2)
.unwrap_or("1337".into())
.unwrap_or_else(|| "1337".into())
.parse::<u16>()
.unwrap();
// in the b2b use-case, this is our "own" port, we connect to the "normal" broker node on startup.
let b2b_port: u16 = std::env::args()
.nth(3)
.unwrap_or("4242".into())
.unwrap_or_else(|| "4242".into())
.parse::<u16>()
.unwrap();
println!("Launching in mode {} on port {}", mode, port);

View File

@ -62,7 +62,6 @@ For broker2broker communication, all messages are forwarded via network sockets.
use alloc::{string::String, vec::Vec};
use core::{
cmp::max,
convert::{TryFrom, TryInto},
fmt::Debug,
mem::size_of,
ptr, slice,
@ -896,7 +895,7 @@ where
/// So if [`alloc_next`] fails, create new page if necessary, use this function,
/// place `EOP`, commit `EOP`, reset, alloc again on the new space.
unsafe fn alloc_eop(&mut self) -> Result<*mut LlmpMsg, Error> {
let mut map = self.out_maps.last_mut().unwrap();
let map = self.out_maps.last_mut().unwrap();
let page = map.page_mut();
let last_msg = self.last_msg_sent;
if (*page).size_used + EOP_MSG_SIZE > (*page).size_total {
@ -906,7 +905,7 @@ where
let mut ret: *mut LlmpMsg = if last_msg.is_null() {
(*page).messages.as_mut_ptr()
} else {
llmp_next_msg_ptr_checked(&mut map, last_msg, EOP_MSG_SIZE)?
llmp_next_msg_ptr_checked(map, last_msg, EOP_MSG_SIZE)?
};
if (*ret).tag == LLMP_TAG_UNINITIALIZED {
panic!("Did not call send() on last message!");

View File

@ -2,7 +2,6 @@
use alloc::vec::Vec;
use core::{
cell::UnsafeCell,
convert::TryFrom,
fmt::{self, Display, Formatter},
mem, ptr,
ptr::write_volatile,

View File

@ -12,7 +12,6 @@ use std::os::raw::{c_long, c_void};
use alloc::vec::Vec;
use core::{
cell::UnsafeCell,
convert::TryFrom,
fmt::{self, Display, Formatter},
ptr,
ptr::write_volatile,

View File

@ -63,10 +63,7 @@ pub type StdShMemService = DummyShMemService;
use serde::{Deserialize, Serialize};
#[cfg(feature = "std")]
use std::{
convert::{TryFrom, TryInto},
env,
};
use std::env;
#[cfg(all(unix, feature = "std"))]
use crate::bolts::os::pipes::Pipe;
@ -487,7 +484,7 @@ pub mod unix_shmem {
#[cfg(all(unix, feature = "std", not(target_os = "android")))]
mod default {
use core::{convert::TryInto, ptr, slice};
use core::{ptr, slice};
use libc::{
c_int, c_long, c_uchar, c_uint, c_ulong, c_ushort, close, ftruncate, mmap, munmap,
perror, shm_open, shm_unlink, shmat, shmctl, shmget,

View File

@ -19,18 +19,12 @@ use crate::{
/// A per-fuzzer unique `ID`, usually starting with `0` and increasing
/// by `1` in multiprocessed `EventManager`s, such as [`self::llmp::LlmpEventManager`].
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
pub struct EventManagerId {
/// The id
pub id: usize,
}
impl Default for EventManagerId {
fn default() -> Self {
Self { id: 0 }
}
}
#[cfg(feature = "introspection")]
use crate::stats::ClientPerfStats;
#[cfg(feature = "introspection")]

View File

@ -12,7 +12,6 @@ use crate::{
use alloc::{string::ToString, vec::Vec};
#[cfg(feature = "std")]
use core::{
convert::TryInto,
marker::PhantomData,
sync::atomic::{compiler_fence, Ordering},
};

View File

@ -722,11 +722,11 @@ mod tests {
.new_map(MAP_SIZE as usize)
.unwrap();
shmem.write_to_env("__AFL_SHM_ID").unwrap();
let mut shmem_map = shmem.map_mut();
let shmem_map = shmem.map_mut();
let edges_observer = HitcountsMapObserver::new(ConstMapObserver::<_, MAP_SIZE>::new(
"shared_mem",
&mut shmem_map,
shmem_map,
));
let executor = ForkserverExecutor::<NopInput, _, ()>::new(

View File

@ -12,7 +12,6 @@ use crate::{
use alloc::{borrow::ToOwned, vec::Vec};
use core::{
cmp::{max, min},
convert::TryInto,
marker::PhantomData,
mem::size_of,
};

View File

@ -1,7 +1,7 @@
//! Tokens are what afl calls extras or dictionaries.
//! They may be inserted as part of mutations during fuzzing.
use alloc::vec::Vec;
use core::{convert::TryInto, marker::PhantomData, mem::size_of};
use core::{marker::PhantomData, mem::size_of};
use serde::{Deserialize, Serialize};
#[cfg(feature = "std")]

View File

@ -43,10 +43,7 @@
#![cfg(feature = "std")]
use std::{
convert::TryFrom,
io::{self, Cursor, Read, Seek, SeekFrom, Write},
};
use std::io::{self, Cursor, Read, Seek, SeekFrom, Write};
use bincode::{DefaultOptions, Options};

View File

@ -96,7 +96,6 @@ use crate::stats::PerfFeature;
fn generate_mutations(iter: impl Iterator<Item = (SymExprRef, SymExpr)>) -> Vec<Vec<(usize, u8)>> {
use core::mem::size_of;
use hashbrown::HashMap;
use std::convert::TryInto;
use z3::{
ast::{Ast, Bool, Dynamic, BV},
Config, Context, Solver, Symbol,

View File

@ -12,8 +12,6 @@ use hashbrown::HashMap;
#[cfg(feature = "introspection")]
use alloc::string::ToString;
#[cfg(feature = "introspection")]
use core::convert::TryInto;
use crate::bolts::current_time;

View File

@ -8,7 +8,7 @@ repository = "https://github.com/AFLplusplus/LibAFL/"
readme = "../README.md"
license = "MIT OR Apache-2.0"
keywords = ["fuzzing", "testing", "compiler"]
edition = "2018"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

View File

@ -1,7 +1,7 @@
[package]
name = "symcc_libafl"
version = "0.1.0"
edition = "2018"
edition = "2021"
authors = ["Julius Hohnerlein <julihoh@users.noreply.github.com>", "Andrea Fioraldi <andreafioraldi@gmail.com>", "Dominik Maier <domenukk@gmail.com>"]
description = "Meta package for symcc_runtime"
documentation = "https://docs.rs/symcc_libafl"
@ -19,4 +19,4 @@ clone = ["which"] # common functionality to check out the symcc repo using git
[dependencies]
which = { version = "4.1", optional = true }
cmake = { version = "0.1", optional = true }
cmake = { version = "0.1", optional = true }

View File

@ -1,7 +1,7 @@
[package]
name = "symcc_runtime"
version = "0.1.2"
edition = "2018"
edition = "2021"
authors = ["Julius Hohnerlein <julihoh@users.noreply.github.com>", "Andrea Fioraldi <andreafioraldi@gmail.com>", "Dominik Maier <domenukk@gmail.com>"]
description = "Build Concolic Tracing tools based on SymCC in Rust"
documentation = "https://docs.rs/symcc_runtime"

View File

@ -1,6 +1,5 @@
use std::{
collections::hash_map::DefaultHasher,
convert::TryInto,
hash::{BuildHasher, BuildHasherDefault, Hash, Hasher},
marker::PhantomData,
};

View File

@ -1,11 +1,11 @@
[package]
name = "dump_constraints"
version = "0.1.0"
edition = "2018"
edition = "2021"
authors = ["Julius Hohnerlein <julihoh@users.noreply.github.com>"]
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
libafl = {path = "../../../libafl"}
structopt = "0.3.21"
structopt = "0.3.21"

View File

@ -1,7 +1,7 @@
[package]
name = "runtime_test"
version = "0.1.0"
edition = "2018"
edition = "2021"
authors = ["Julius Hohnerlein <julihoh@users.noreply.github.com>"]
[lib]

View File

@ -8,7 +8,7 @@ repository = "https://github.com/AFLplusplus/LibAFL/"
readme = "../README.md"
license = "MIT OR Apache-2.0"
keywords = ["fuzzing", "testing"]
edition = "2018"
edition = "2021"
[lib]
proc-macro = true

View File

@ -8,7 +8,7 @@ repository = "https://github.com/AFLplusplus/LibAFL/"
readme = "../README.md"
license = "MIT OR Apache-2.0"
keywords = ["fuzzing", "frida", "instrumentation"]
edition = "2018"
edition = "2021"
[features]

View File

@ -8,7 +8,7 @@ repository = "https://github.com/AFLplusplus/LibAFL/"
readme = "../README.md"
license = "MIT OR Apache-2.0"
keywords = ["fuzzing", "qemu", "instrumentation"]
edition = "2018"
edition = "2021"
[features]
python = ["pyo3", "pyo3-build-config"]

View File

@ -2,7 +2,6 @@
use core::{
convert::Into,
convert::TryFrom,
ffi::c_void,
mem::{size_of, transmute, MaybeUninit},
ptr::{copy_nonoverlapping, null},

View File

@ -8,7 +8,7 @@ repository = "https://github.com/AFLplusplus/LibAFL/"
readme = "../README.md"
license = "MIT OR Apache-2.0"
keywords = ["fuzzing"]
edition = "2018"
edition = "2021"
build = "build.rs"
[features]

View File

@ -8,7 +8,7 @@ repository = "https://github.com/AFLplusplus/LibAFL/"
readme = "../README.md"
license = "MIT OR Apache-2.0"
keywords = ["fuzzing", "testing"]
edition = "2018"
edition = "2021"
[features]
default = []