Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
target
Cargo.lock
28 changes: 28 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
[workspace]
resolver = "2"
members = [
"libnyx",
"libnyx_config",
"libnyx_fuzz_runner",
"libnyx_acat",
]
default_members = [
"libnyx",
"libnyx_config",
"libnyx_fuzz_runner",
"libnyx_acat",
]

[workspace.package]
version = "0.1.3"
license = "GPL-2.0-only"
edition = "2021"
description = "libnyx fork only for publishing"
homepage = "https://github.com/wtdcode/libnyx"
repository = "https://github.com/nyx-fuzz/libnyx"
readme = "README.md"

[workspace.dependencies]
libnyx_fuzz_runner = {version = "0.1.3", path = "libnyx_fuzz_runner"}
libnyx = {version = "0.1.3", path = "libnyx"}
libnyx_config = {version = "0.1.3", path = "libnyx_config"}
21 changes: 5 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,10 @@
# libnyx

<p>
<img align="right" width="200" src="logo.png">
</p>
This is a friendly release of [libnyx](https://github.com/nyx-fuzz/libnyx). It is open to transfer with the policy below:

libnyx is a library that allows you to simply build hypervisor-based snapshot fuzzers. Using libnyx, managing multiple VMs and snapshots as well as the communication with the code running in the VM becomes a matter of a handful of lines of code. At the moment, libnyx can be used via a simple C interface or from a rust library.
Please contact me either via [email](mio@lazym.io) or wtdcode in [Discord](https://discord.gg/gCraWct). In case I'm not reachable in one week, I consent to the transfer of this crate to the [libnyx team](https://github.com/nyx-fuzz), specifically the two authors:

## Bug Reports and Contributions
- [Sergej Schumilo](http://schumilo.de) - sergej@schumilo.de / [@ms_s3c](https://twitter.com/ms_s3c)
- [Cornelius Aschermann](https://hexgolems.com) - cornelius@hexgolems.com / [@is_eqv](https://twitter.com/is_eqv)

If you found and fixed a bug on your own: We are very open to patches, please create a pull request!

### License

This library is provided under **GPLv2 license**.

**Free Software Hell Yeah!**

Proudly provided by:
* [Sergej Schumilo](http://schumilo.de) - sergej@schumilo.de / [@ms_s3c](https://twitter.com/ms_s3c)
* [Cornelius Aschermann](https://hexgolems.com) - cornelius@hexgolems.com / [@is_eqv](https://twitter.com/is_eqv)
by asking help@crates.io.
12 changes: 0 additions & 12 deletions acat/Cargo.toml

This file was deleted.

13 changes: 9 additions & 4 deletions libnyx/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
[package]
name = "libnyx"
version = "0.1.0"
edition = "2021"
version.workspace = true
edition.workspace = true
license.workspace = true
description.workspace = true
readme.workspace = true
homepage.workspace = true
repository.workspace = true

[lib]
name = "libnyx"
Expand All @@ -11,6 +16,6 @@ crate-type = ["lib", "staticlib", "dylib"]
cbindgen = "0.28.0"

[dependencies]
config={path="../config"}
fuzz_runner={path="../fuzz_runner"}
libnyx_config.workspace = true
libnyx_fuzz_runner.workspace = true
libc = "0.2"
7 changes: 1 addition & 6 deletions libnyx/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,11 @@ use std::path::PathBuf;


fn main() {
println!("build.rs");
let crate_dir = PathBuf::from(env::var("CARGO_MANIFEST_DIR")
.expect("CARGO_MANIFEST_DIR env var is not defined"));
println!("CARGO_MANIFEST_DIR: {:?}", crate_dir);

let out_dir = PathBuf::from(env::var("OUT_DIR")
.expect("OUT_DIR env var is not defined"));
println!("OUT_DIR: {:?}", out_dir);

let config = cbindgen::Config::from_file("cbindgen.toml")
.expect("Unable to find cbindgen.toml configuration file");
Expand All @@ -20,10 +17,8 @@ fn main() {
// cargo +nightly build --out-dir `pwd` -Z unstable-options
// added question to this issue: https://github.com/rust-lang/cargo/issues/6790
// for now, CARGO_MANIFEST_DIR (crate_dir) seems reasonable


cbindgen::generate_with_config(&crate_dir, config)
.unwrap()
.write_to_file(crate_dir.join("libnyx.h"));
.write_to_file(out_dir.join("libnyx.h"));

}
2 changes: 1 addition & 1 deletion libnyx/src/ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down
10 changes: 5 additions & 5 deletions libnyx/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
}),
Expand Down Expand Up @@ -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)
}
File renamed without changes.
17 changes: 17 additions & 0 deletions libnyx_acat/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[package]
name = "libnyx_acat"
authors = ["Sergej Schumilo <sergej@schumilo.de>"]
version.workspace = true
edition.workspace = true
license.workspace = true
description.workspace = true
readme.workspace = true
homepage.workspace = true
repository.workspace = true

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
libnyx_fuzz_runner.workspace = true
colored = "2.0.0"
clap="2.33.0"
4 changes: 2 additions & 2 deletions acat/src/main.rs → libnyx_acat/src/main.rs
Original file line number Diff line number Diff line change
@@ -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};

Expand Down Expand Up @@ -48,7 +48,7 @@ fn print_aux_buffer(aux_buffer: &aux_buffer::AuxBuffer, target_file: &String, sh

fn main() {

let matches = App::new("acat")
let matches = App::new("libnyx_acat")
.about("Fancy tool to debug aux buffers!")
.arg(
Arg::with_name("target_file")
Expand Down
File renamed without changes.
11 changes: 8 additions & 3 deletions config/Cargo.toml → libnyx_config/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
[package]
name = "config"
version = "0.1.0"
name = "libnyx_config"
authors = ["coco <cornelius@hexgolems.com>"]
edition = "2021"
version.workspace = true
edition.workspace = true
license.workspace = true
description.workspace = true
readme.workspace = true
homepage.workspace = true
repository.workspace = true

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
18 changes: 12 additions & 6 deletions fuzz_runner/Cargo.toml → libnyx_fuzz_runner/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
[package]
name = "fuzz_runner"
version = "0.1.0"
name = "libnyx_fuzz_runner"
version.workspace = true
edition.workspace = true
license.workspace = true
description.workspace = true
readme.workspace = true
homepage.workspace = true
repository.workspace = true

authors = ["coco <cornelius@hexgolems.com>"]
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Expand All @@ -11,15 +17,15 @@ nix = "0.26.2"
time = "0.2.9"
subprocess = "0.2.4"
libc = "0.2.68"
quick-error = "*"
quick-error = "0"
rand = "0.7.3"
serde_derive = "1.0"
serde = "1.0"
byteorder = "*"
byteorder = "0"
snafu = "0.6.3"
timeout-readwrite = "0.3.1"
glob="0.3.0"
config={path="../config"}
libnyx_config.workspace = true
colored = "2.0.0"
derivative = "2.1.1"
fs4 = "0.5.4"
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion fuzz_runner/src/lib.rs → libnyx_fuzz_runner/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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{

Expand All @@ -23,7 +23,7 @@ fn into_absolute_path(sharedir: &str) -> String{
}
}

pub fn qemu_process_new(sharedir: String, cfg: &config::Config) -> Result<QemuProcess, String> {
pub fn qemu_process_new(sharedir: String, cfg: &libnyx_config::Config) -> Result<QemuProcess, String> {


let qemu_params = params::QemuParams::new(into_absolute_path(&sharedir), cfg);
Expand Down
Original file line number Diff line number Diff line change
@@ -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<String>,
Expand Down