From a2b1cd5b08c2c8e7d5f09df588be52d69a1287c8 Mon Sep 17 00:00:00 2001 From: Dominik Maier Date: Fri, 23 May 2025 15:40:40 +0200 Subject: [PATCH] Rename crates in order to make LibNyx publishable --- .gitignore | 2 ++ Cargo.toml | 18 ++++++++++++++++++ acat/Cargo.toml | 2 +- acat/src/main.rs | 2 +- libnyx/Cargo.toml | 4 ++-- libnyx/src/ffi.rs | 2 +- libnyx/src/lib.rs | 10 +++++----- {config => libnyx_config}/.gitignore | 0 {config => libnyx_config}/Cargo.toml | 2 +- {config => libnyx_config}/src/config.rs | 0 {config => libnyx_config}/src/lib.rs | 0 {config => libnyx_config}/src/loader.rs | 0 {fuzz_runner => libnyx_fuzz_runner}/.gitignore | 0 {fuzz_runner => libnyx_fuzz_runner}/Cargo.toml | 4 ++-- .../src/exitreason.rs | 0 {fuzz_runner => libnyx_fuzz_runner}/src/lib.rs | 2 +- .../src/nyx/aux_buffer.rs | 0 .../src/nyx/ijon_data.rs | 0 .../src/nyx/mem_barrier.rs | 0 .../src/nyx/mod.rs | 4 ++-- .../src/nyx/params.rs | 2 +- .../src/nyx/qemu_process.rs | 0 .../src/nyx/tests/tests.rs | 0 23 files changed, 37 insertions(+), 17 deletions(-) create mode 100644 .gitignore create mode 100644 Cargo.toml rename {config => libnyx_config}/.gitignore (100%) rename {config => libnyx_config}/Cargo.toml (92%) rename {config => libnyx_config}/src/config.rs (100%) rename {config => libnyx_config}/src/lib.rs (100%) rename {config => libnyx_config}/src/loader.rs (100%) rename {fuzz_runner => libnyx_fuzz_runner}/.gitignore (100%) rename {fuzz_runner => libnyx_fuzz_runner}/Cargo.toml (87%) rename {fuzz_runner => libnyx_fuzz_runner}/src/exitreason.rs (100%) rename {fuzz_runner => libnyx_fuzz_runner}/src/lib.rs (90%) rename {fuzz_runner => libnyx_fuzz_runner}/src/nyx/aux_buffer.rs (100%) rename {fuzz_runner => libnyx_fuzz_runner}/src/nyx/ijon_data.rs (100%) rename {fuzz_runner => libnyx_fuzz_runner}/src/nyx/mem_barrier.rs (100%) rename {fuzz_runner => libnyx_fuzz_runner}/src/nyx/mod.rs (81%) rename {fuzz_runner => libnyx_fuzz_runner}/src/nyx/params.rs (98%) rename {fuzz_runner => libnyx_fuzz_runner}/src/nyx/qemu_process.rs (100%) rename {fuzz_runner => libnyx_fuzz_runner}/src/nyx/tests/tests.rs (100%) diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f2f9e58 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +target +Cargo.lock \ No newline at end of file diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..4abf59b --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,18 @@ +[workspace] +resolver = "2" +members = [ + "libnyx", + "libnyx_config", + "libnyx_fuzz_runner", + "acat", +] +default_members = [ + "libnyx", + "libnyx_config", + "libnyx_fuzz_runner", + "acat", +] + +[workspace.package] +version = "0.1.0" +license = "GPLv2" diff --git a/acat/Cargo.toml b/acat/Cargo.toml index dd3239a..8b41521 100644 --- a/acat/Cargo.toml +++ b/acat/Cargo.toml @@ -7,6 +7,6 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -fuzz_runner={path="../fuzz_runner"} +libnyx_fuzz_runner={path="../libnyx_fuzz_runner"} colored = "2.0.0" clap="2.33.0" diff --git a/acat/src/main.rs b/acat/src/main.rs index 2b14fe6..e3f2b9e 100644 --- a/acat/src/main.rs +++ b/acat/src/main.rs @@ -1,4 +1,4 @@ -use fuzz_runner::nyx::aux_buffer::{self, AUX_BUFFER_SIZE}; +use libnyx_fuzz_runner::nyx::aux_buffer::{self, AUX_BUFFER_SIZE}; use clap::{App, Arg, AppSettings}; diff --git a/libnyx/Cargo.toml b/libnyx/Cargo.toml index df45885..f46a215 100644 --- a/libnyx/Cargo.toml +++ b/libnyx/Cargo.toml @@ -11,6 +11,6 @@ crate-type = ["lib", "staticlib", "dylib"] cbindgen = "0.28.0" [dependencies] -config={path="../config"} -fuzz_runner={path="../fuzz_runner"} +libnyx_config={path="../libnyx_config"} +libnyx_fuzz_runner={path="../libnyx_fuzz_runner"} libc = "0.2" diff --git a/libnyx/src/ffi.rs b/libnyx/src/ffi.rs index 976894f..7b6cac7 100644 --- a/libnyx/src/ffi.rs +++ b/libnyx/src/ffi.rs @@ -19,7 +19,7 @@ use libc::c_char; use std::ffi::CStr; use std::ffi::c_void; -use fuzz_runner::nyx::aux_buffer::{NYX_CRASH, NYX_HPRINTF, NYX_ABORT}; +use libnyx_fuzz_runner::nyx::aux_buffer::{NYX_CRASH, NYX_HPRINTF, NYX_ABORT}; use super::*; /* Helper function to load a C string pointer and return a Rust string. */ diff --git a/libnyx/src/lib.rs b/libnyx/src/lib.rs index d6560b3..a53c672 100644 --- a/libnyx/src/lib.rs +++ b/libnyx/src/lib.rs @@ -17,10 +17,10 @@ */ extern crate libc; -use config::{Config, FuzzRunnerConfig, QemuNyxRole}; +use libnyx_config::{Config, FuzzRunnerConfig, QemuNyxRole}; -use fuzz_runner::nyx::qemu_process::QemuProcess; -use fuzz_runner::nyx::aux_buffer::{NYX_SUCCESS, NYX_CRASH, NYX_TIMEOUT, NYX_INPUT_WRITE, NYX_ABORT}; +use libnyx_fuzz_runner::nyx::qemu_process::QemuProcess; +use libnyx_fuzz_runner::nyx::aux_buffer::{NYX_SUCCESS, NYX_CRASH, NYX_TIMEOUT, NYX_INPUT_WRITE, NYX_ABORT}; use libc::fcntl; use std::fmt; @@ -258,7 +258,7 @@ impl NyxProcess { let sharedir = config.sharedir_path(); config.set_worker_id(worker_id); - match fuzz_runner::nyx::qemu_process_new(sharedir.to_string(), &config.config){ + match libnyx_fuzz_runner::nyx::qemu_process_new(sharedir.to_string(), &config.config){ Ok(x) => Ok(NyxProcess{ process: x, }), @@ -389,5 +389,5 @@ impl NyxProcess { } pub fn remove_work_dir(workdir: &str) -> Result<(), String> { - fuzz_runner::nyx::qemu_process::remove_workdir_safe(workdir) + libnyx_fuzz_runner::nyx::qemu_process::remove_workdir_safe(workdir) } diff --git a/config/.gitignore b/libnyx_config/.gitignore similarity index 100% rename from config/.gitignore rename to libnyx_config/.gitignore diff --git a/config/Cargo.toml b/libnyx_config/Cargo.toml similarity index 92% rename from config/Cargo.toml rename to libnyx_config/Cargo.toml index 0f842c0..7a5db08 100644 --- a/config/Cargo.toml +++ b/libnyx_config/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "config" +name = "libnyx_config" version = "0.1.0" authors = ["coco "] edition = "2021" diff --git a/config/src/config.rs b/libnyx_config/src/config.rs similarity index 100% rename from config/src/config.rs rename to libnyx_config/src/config.rs diff --git a/config/src/lib.rs b/libnyx_config/src/lib.rs similarity index 100% rename from config/src/lib.rs rename to libnyx_config/src/lib.rs diff --git a/config/src/loader.rs b/libnyx_config/src/loader.rs similarity index 100% rename from config/src/loader.rs rename to libnyx_config/src/loader.rs diff --git a/fuzz_runner/.gitignore b/libnyx_fuzz_runner/.gitignore similarity index 100% rename from fuzz_runner/.gitignore rename to libnyx_fuzz_runner/.gitignore diff --git a/fuzz_runner/Cargo.toml b/libnyx_fuzz_runner/Cargo.toml similarity index 87% rename from fuzz_runner/Cargo.toml rename to libnyx_fuzz_runner/Cargo.toml index c70d0e8..c0592c7 100644 --- a/fuzz_runner/Cargo.toml +++ b/libnyx_fuzz_runner/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "fuzz_runner" +name = "libnyx_fuzz_runner" version = "0.1.0" authors = ["coco "] edition = "2021" @@ -19,7 +19,7 @@ byteorder = "*" snafu = "0.6.3" timeout-readwrite = "0.3.1" glob="0.3.0" -config={path="../config"} +libnyx_config={path="../libnyx_config"} colored = "2.0.0" derivative = "2.1.1" fs4 = "0.5.4" diff --git a/fuzz_runner/src/exitreason.rs b/libnyx_fuzz_runner/src/exitreason.rs similarity index 100% rename from fuzz_runner/src/exitreason.rs rename to libnyx_fuzz_runner/src/exitreason.rs diff --git a/fuzz_runner/src/lib.rs b/libnyx_fuzz_runner/src/lib.rs similarity index 90% rename from fuzz_runner/src/lib.rs rename to libnyx_fuzz_runner/src/lib.rs index d2d6d37..911a583 100644 --- a/fuzz_runner/src/lib.rs +++ b/libnyx_fuzz_runner/src/lib.rs @@ -4,7 +4,7 @@ extern crate nix; extern crate serde_derive; extern crate snafu; extern crate timeout_readwrite; -extern crate config; +extern crate libnyx_config; pub mod exitreason; diff --git a/fuzz_runner/src/nyx/aux_buffer.rs b/libnyx_fuzz_runner/src/nyx/aux_buffer.rs similarity index 100% rename from fuzz_runner/src/nyx/aux_buffer.rs rename to libnyx_fuzz_runner/src/nyx/aux_buffer.rs diff --git a/fuzz_runner/src/nyx/ijon_data.rs b/libnyx_fuzz_runner/src/nyx/ijon_data.rs similarity index 100% rename from fuzz_runner/src/nyx/ijon_data.rs rename to libnyx_fuzz_runner/src/nyx/ijon_data.rs diff --git a/fuzz_runner/src/nyx/mem_barrier.rs b/libnyx_fuzz_runner/src/nyx/mem_barrier.rs similarity index 100% rename from fuzz_runner/src/nyx/mem_barrier.rs rename to libnyx_fuzz_runner/src/nyx/mem_barrier.rs diff --git a/fuzz_runner/src/nyx/mod.rs b/libnyx_fuzz_runner/src/nyx/mod.rs similarity index 81% rename from fuzz_runner/src/nyx/mod.rs rename to libnyx_fuzz_runner/src/nyx/mod.rs index 5184d7b..a85c57d 100644 --- a/fuzz_runner/src/nyx/mod.rs +++ b/libnyx_fuzz_runner/src/nyx/mod.rs @@ -9,7 +9,7 @@ pub use qemu_process::QemuProcess; use std::fs; use std::path::PathBuf; -extern crate config; +extern crate libnyx_config; fn into_absolute_path(sharedir: &str) -> String{ @@ -23,7 +23,7 @@ fn into_absolute_path(sharedir: &str) -> String{ } } -pub fn qemu_process_new(sharedir: String, cfg: &config::Config) -> Result { +pub fn qemu_process_new(sharedir: String, cfg: &libnyx_config::Config) -> Result { let qemu_params = params::QemuParams::new(into_absolute_path(&sharedir), cfg); diff --git a/fuzz_runner/src/nyx/params.rs b/libnyx_fuzz_runner/src/nyx/params.rs similarity index 98% rename from fuzz_runner/src/nyx/params.rs rename to libnyx_fuzz_runner/src/nyx/params.rs index f837513..5686b47 100644 --- a/fuzz_runner/src/nyx/params.rs +++ b/libnyx_fuzz_runner/src/nyx/params.rs @@ -1,5 +1,5 @@ use std::time::Duration; -use crate::{config::{Config, FuzzRunnerConfig, QemuNyxRole}, QemuProcess}; +use crate::{libnyx_config::{Config, FuzzRunnerConfig, QemuNyxRole}, QemuProcess}; pub struct QemuParams { pub cmd: Vec, diff --git a/fuzz_runner/src/nyx/qemu_process.rs b/libnyx_fuzz_runner/src/nyx/qemu_process.rs similarity index 100% rename from fuzz_runner/src/nyx/qemu_process.rs rename to libnyx_fuzz_runner/src/nyx/qemu_process.rs diff --git a/fuzz_runner/src/nyx/tests/tests.rs b/libnyx_fuzz_runner/src/nyx/tests/tests.rs similarity index 100% rename from fuzz_runner/src/nyx/tests/tests.rs rename to libnyx_fuzz_runner/src/nyx/tests/tests.rs