From ab1d3c5ae9ce05b0631c52b568fbd5fa08ded187 Mon Sep 17 00:00:00 2001 From: Logan Wendholt Date: Mon, 19 Aug 2019 19:42:07 -0400 Subject: [PATCH 1/8] Reorganize cargo workspace for better modularity --- Cargo.toml | 6 ++- common/Cargo.toml | 11 ++++ {src => common/src}/consts.rs | 0 common/src/lib.rs | 13 +++++ {src => common/src}/local_state.rs | 0 {src => common/src}/profiling.rs | 0 {src => common/src}/state.rs | 1 + preloader/Cargo.toml | 1 + preloader/build.rs | 1 - preloader/src/lib.rs | 2 +- src/lib.rs | 8 +-- src/main.rs | 4 +- src/remote.rs | 5 +- src/rpc_ptrace.rs | 3 +- src/sched.rs | 2 +- src/sched_wait.rs | 5 +- src/stubs.rs | 3 +- src/task.rs | 5 +- src/traced_task.rs | 11 ++-- tools_helper/Cargo.toml | 5 ++ tools_helper/build.rs | 27 ++++------ tools_helper/src/counter.rs | 2 +- {trampoline => tools_helper/src}/ffi.rs | 51 +++++++++++-------- tools_helper/src/lib.rs | 8 +-- .../src}/raw_syscall.S | 0 .../src}/remote_call.S | 0 {trampoline => tools_helper/src}/scinfo.h | 0 {trampoline => tools_helper/src}/trampoline.S | 0 28 files changed, 107 insertions(+), 67 deletions(-) create mode 100644 common/Cargo.toml rename {src => common/src}/consts.rs (100%) create mode 100644 common/src/lib.rs rename {src => common/src}/local_state.rs (100%) rename {src => common/src}/profiling.rs (100%) rename {src => common/src}/state.rs (97%) rename {trampoline => tools_helper/src}/ffi.rs (76%) rename {trampoline => tools_helper/src}/raw_syscall.S (100%) rename {trampoline => tools_helper/src}/remote_call.S (100%) rename {trampoline => tools_helper/src}/scinfo.h (100%) rename {trampoline => tools_helper/src}/trampoline.S (100%) diff --git a/Cargo.toml b/Cargo.toml index ee9cc29..dade031 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,8 +5,8 @@ authors = ["Baojun Wang "] edition = "2018" [workspace] -members= [".", "syscalls", "tools_helper", "preloader", "examples/none", "examples/echo", "examples/counter", "examples/det" ] -default-members = [".", "syscalls", "preloader", "tools_helper" ] +members= [".", "syscalls", "tools_helper", "common", "preloader", "examples/none", "examples/echo", "examples/counter", "examples/det" ] +default-members = [".", "syscalls", "common", "preloader", "tools_helper" ] [lib] name = "reverie" @@ -19,6 +19,8 @@ path = "src/main.rs" [dependencies] libc = { version = "0.2", default-features = false } syscalls = { path = "syscalls" } +common = { path = "common" } +tools_helper = { path = "tools_helper" } nix = "0.13" goblin = "0.0" procfs = "0.5" diff --git a/common/Cargo.toml b/common/Cargo.toml new file mode 100644 index 0000000..d614ddd --- /dev/null +++ b/common/Cargo.toml @@ -0,0 +1,11 @@ +[package] +name = "common" +version = "0.1.0" +authors = ["Logan Wendholt "] +edition = "2018" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +nix = "0.13" +lazy_static = "1.3" diff --git a/src/consts.rs b/common/src/consts.rs similarity index 100% rename from src/consts.rs rename to common/src/consts.rs diff --git a/common/src/lib.rs b/common/src/lib.rs new file mode 100644 index 0000000..edd4923 --- /dev/null +++ b/common/src/lib.rs @@ -0,0 +1,13 @@ +//! reverie tools helper +//! + +#![feature(format_args_nl, slice_internals)] + +#[macro_use] +extern crate lazy_static; + +pub mod consts; +pub mod state; +pub mod local_state; +pub mod profiling; + diff --git a/src/local_state.rs b/common/src/local_state.rs similarity index 100% rename from src/local_state.rs rename to common/src/local_state.rs diff --git a/src/profiling.rs b/common/src/profiling.rs similarity index 100% rename from src/profiling.rs rename to common/src/profiling.rs diff --git a/src/state.rs b/common/src/state.rs similarity index 97% rename from src/state.rs rename to common/src/state.rs index 9c02d8b..6d44ab6 100644 --- a/src/state.rs +++ b/common/src/state.rs @@ -1,6 +1,7 @@ //! reverie global state use std::sync::Mutex; +use lazy_static; use crate::profiling::*; diff --git a/preloader/Cargo.toml b/preloader/Cargo.toml index be20bef..e7a71ac 100644 --- a/preloader/Cargo.toml +++ b/preloader/Cargo.toml @@ -13,6 +13,7 @@ path = "src/lib.rs" [dependencies] syscalls = { path = "../syscalls" } +common = { path = "../common" } procfs = "0.5" nix = "0.14" libc = "0.2" diff --git a/preloader/build.rs b/preloader/build.rs index e7b4ce4..7cc8f27 100644 --- a/preloader/build.rs +++ b/preloader/build.rs @@ -11,6 +11,5 @@ fn main() -> Result<()> { .file("src/bpf-helper.c") .file("src/dl_ns.c") .compile("my-asm-lib"); - std::fs::copy("../src/consts.rs", "src/consts.rs")?; Ok(()) } diff --git a/preloader/src/lib.rs b/preloader/src/lib.rs index 64003e8..64720bc 100644 --- a/preloader/src/lib.rs +++ b/preloader/src/lib.rs @@ -2,11 +2,11 @@ use std::io::Result; -pub mod consts; pub mod relink; pub mod seccomp_bpf; use syscalls::*; +use common::consts; #[link_section = ".init_array"] #[used] diff --git a/src/lib.rs b/src/lib.rs index 3f42cb5..2ceabce 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -10,7 +10,10 @@ #[macro_use] extern crate lazy_static; -pub mod consts; +pub use syscalls; +pub use tools_helper; +pub use common; + pub mod hooks; pub mod nr; pub mod ns; @@ -22,12 +25,9 @@ pub mod stubs; pub mod vdso; pub mod task; pub mod traced_task; -pub mod state; -pub mod local_state; pub mod block_events; pub mod rpc_ptrace; pub mod auxv; pub mod aux; pub mod config; pub mod debug; -pub mod profiling; diff --git a/src/main.rs b/src/main.rs index 53fa80f..8c3156b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -21,11 +21,11 @@ use std::path::PathBuf; use std::sync::atomic::{Ordering, AtomicUsize}; use std::env; -use reverie::{ns, consts, task, hooks}; +use reverie::{ns, task, hooks}; use reverie::sched::Scheduler; use reverie::sched_wait::SchedWait; use reverie::task::{RunTask, Task}; -use reverie::state::*; +use reverie::common::{state::*, consts}; #[test] fn can_resolve_syscall_hooks() -> Result<()> { diff --git a/src/remote.rs b/src/remote.rs index fca8ef4..d329a69 100644 --- a/src/remote.rs +++ b/src/remote.rs @@ -11,8 +11,9 @@ use std::io::{Error, ErrorKind, Result}; use std::path::PathBuf; use std::ptr::NonNull; -use crate::consts; -use crate::consts::*; +use common::consts; +use common::consts::*; + use crate::hooks; use crate::nr; use crate::nr::SyscallNo; diff --git a/src/rpc_ptrace.rs b/src/rpc_ptrace.rs index 85bbecd..ba35995 100644 --- a/src/rpc_ptrace.rs +++ b/src/rpc_ptrace.rs @@ -6,10 +6,11 @@ //! NB: the tracee must be in a ptrace stop //! +use common::consts; + use crate::remote::*; use crate::task::Task; use crate::traced_task::TracedTask; -use crate::consts; use nix::sys::wait; use nix::sys::signal; use nix::sys::ptrace; diff --git a/src/sched.rs b/src/sched.rs index b2f42ff..bc48849 100644 --- a/src/sched.rs +++ b/src/sched.rs @@ -8,7 +8,7 @@ use std::io::{Error, ErrorKind, Result}; use crate::remote::*; use crate::task::Task; -use crate::state::ReverieState; +use common::state::ReverieState; pub trait Scheduler { fn new() -> Self diff --git a/src/sched_wait.rs b/src/sched_wait.rs index 612d1f8..58118fd 100644 --- a/src/sched_wait.rs +++ b/src/sched_wait.rs @@ -11,7 +11,9 @@ use std::sync::atomic::{Ordering, AtomicUsize}; use procfs; -use crate::consts; +use common::consts; +use common::state::ReverieState; + use crate::nr::*; use crate::remote; use crate::remote::*; @@ -19,7 +21,6 @@ use crate::sched::*; use crate::task::*; use crate::traced_task::TracedTask; use crate::traced_task::*; -use crate::state::ReverieState; use crate::debug; /// the scheduler diff --git a/src/stubs.rs b/src/stubs.rs index 0147417..9945d74 100644 --- a/src/stubs.rs +++ b/src/stubs.rs @@ -5,7 +5,8 @@ use std::fs::File; use std::io::{Error, ErrorKind, Result, Write}; use std::path::PathBuf; -use crate::consts; +use common::consts; + use crate::hooks; // jmp *0x0(pc) diff --git a/src/task.rs b/src/task.rs index cd41940..5ff096e 100644 --- a/src/task.rs +++ b/src/task.rs @@ -8,8 +8,9 @@ use std::io::{Error, ErrorKind, Result}; use std::path::PathBuf; use std::ptr::NonNull; -use crate::consts; -use crate::consts::*; +use common::consts; +use common::consts::*; + use crate::hooks; use crate::nr; use crate::remote::*; diff --git a/src/traced_task.rs b/src/traced_task.rs index 3517bc9..5640887 100644 --- a/src/traced_task.rs +++ b/src/traced_task.rs @@ -36,8 +36,11 @@ use std::ffi::c_void; use std::fs::File; use goblin::elf::Elf; -use crate::consts; -use crate::consts::*; +use common::state::*; +use common::local_state::*; +use common::consts; +use common::consts::*; + use crate::hooks; use crate::nr::*; use crate::remote; @@ -48,8 +51,6 @@ use crate::stubs; use crate::task::*; use crate::remote_rwlock::*; use crate::vdso; -use crate::state::*; -use crate::local_state::*; use crate::rpc_ptrace::*; use crate::auxv; use crate::aux; @@ -784,7 +785,7 @@ impl RemoteSyscall for TracedTask { } /// inject syscall for given tracee -/// +/// /// NB: limitations: /// - tracee must be in stopped state. /// - the tracee must have returned from PTRACE_EXEC_EVENT diff --git a/tools_helper/Cargo.toml b/tools_helper/Cargo.toml index b8d7abd..54d4093 100644 --- a/tools_helper/Cargo.toml +++ b/tools_helper/Cargo.toml @@ -4,11 +4,16 @@ version = "0.1.0" authors = ["Baojun Wang "] edition = "2018" +[lib] +name = "tools_helper" +crate-type = ["lib"] + [features] std = [] [dependencies] syscalls = { path = "../syscalls" } +common = { path = "../common" } log = { version = "0.4", default-features = false } serde = { version = "1.0", default-features = false, features = [ "derive" ] } nix = "0.13" diff --git a/tools_helper/build.rs b/tools_helper/build.rs index a763893..facb024 100644 --- a/tools_helper/build.rs +++ b/tools_helper/build.rs @@ -2,22 +2,17 @@ use std::fs::File; use std::io::{Result, Write}; fn main() -> Result<()> { - let cwd = std::env::current_dir()?; + cc::Build::new() + .define("_POSIX_C_SOURCE", "20180920") + .define("_GNU_SOURCE", "1") + .define("USE_SAVE", "1") + .flag("-fPIC") + .include("../include") + .include("./src") + .file("./src/trampoline.S") + .file("./src/raw_syscall.S") + .file("./src/remote_call.S") + .compile("my-trampoline"); - let src_dir = std::fs::canonicalize(cwd.join("../src"))?; - let dst_dir = std::fs::canonicalize(cwd.join("src"))?; - - let files_to_copy = &[ "consts.rs", "profiling.rs", "state.rs", "local_state.rs"]; - files_to_copy.iter().for_each(|f| { - let do_copy: Box Result<()>> = Box::new(|| { - let mut src = File::open(src_dir.join(f))?; - let mut dst = File::create(dst_dir.join(f))?; - let header = format!("// AUTOMATICALLY GENERATED by build.rs by copying {:?}. DO NOT EDIT.\n\n",src_dir.join(f)); - dst.write_all(header.as_bytes())?; - std::io::copy(&mut src, &mut dst)?; - Ok(()) - }); - do_copy().expect("failed to copy files"); - }); Ok(()) } diff --git a/tools_helper/src/counter.rs b/tools_helper/src/counter.rs index d8f5941..518b9eb 100644 --- a/tools_helper/src/counter.rs +++ b/tools_helper/src/counter.rs @@ -2,7 +2,7 @@ use std::sync::atomic::Ordering; -use crate::local_state::*; +use common::local_state::*; /// syscall events pub enum NoteInfo { diff --git a/trampoline/ffi.rs b/tools_helper/src/ffi.rs similarity index 76% rename from trampoline/ffi.rs rename to tools_helper/src/ffi.rs index 3eded29..e3ed39c 100644 --- a/trampoline/ffi.rs +++ b/tools_helper/src/ffi.rs @@ -8,11 +8,9 @@ /// cdylib is built correctly. use core::ffi::c_void; -use crate::consts; -use crate::captured_syscall; -use crate::local_state::*; +use common::consts; +use common::local_state::*; -use tools_helper::local_state::*; use syscalls::*; static SYSCALL_UNTRACED: u64 = 0x7000_0000; @@ -43,69 +41,78 @@ extern "C" { fn _syscall_hook_trampoline_85_c0_0f_94_c2(); fn _remote_syscall_helper(); fn _remote_funccall_helper(); + fn captured_syscall( + _p: &mut ProcessState, + no: i32, + a0: i64, + a1: i64, + a2: i64, + a3: i64, + a4: i64, + a5: i64) -> i64; } #[no_mangle] -unsafe extern "C" fn syscall_hook_trampoline() { +pub unsafe extern "C" fn syscall_hook_trampoline() { _syscall_hook_trampoline() } #[no_mangle] -unsafe extern "C" fn syscall_hook_trampoline_48_3d_01_f0_ff_ff() { +pub unsafe extern "C" fn syscall_hook_trampoline_48_3d_01_f0_ff_ff() { _syscall_hook_trampoline_48_3d_01_f0_ff_ff() } #[no_mangle] -unsafe extern "C" fn syscall_hook_trampoline_48_3d_00_f0_ff_ff() { +pub unsafe extern "C" fn syscall_hook_trampoline_48_3d_00_f0_ff_ff() { _syscall_hook_trampoline_48_3d_00_f0_ff_ff() } #[no_mangle] -unsafe extern "C" fn syscall_hook_trampoline_48_8b_3c_24() { +pub unsafe extern "C" fn syscall_hook_trampoline_48_8b_3c_24() { _syscall_hook_trampoline_48_8b_3c_24() } #[no_mangle] -unsafe extern "C" fn syscall_hook_trampoline_5a_5e_c3() { +pub unsafe extern "C" fn syscall_hook_trampoline_5a_5e_c3() { _syscall_hook_trampoline_5a_5e_c3() } #[no_mangle] -unsafe extern "C" fn syscall_hook_trampoline_89_c2_f7_da() { +pub unsafe extern "C" fn syscall_hook_trampoline_89_c2_f7_da() { _syscall_hook_trampoline_89_c2_f7_da() } #[no_mangle] -unsafe extern "C" fn syscall_hook_trampoline_90_90_90() { +pub unsafe extern "C" fn syscall_hook_trampoline_90_90_90() { _syscall_hook_trampoline_90_90_90() } #[no_mangle] -unsafe extern "C" fn syscall_hook_trampoline_ba_01_00_00_00() { +pub unsafe extern "C" fn syscall_hook_trampoline_ba_01_00_00_00() { _syscall_hook_trampoline_ba_01_00_00_00() } #[no_mangle] -unsafe extern "C" fn syscall_hook_trampoline_89_c1_31_d2() { +pub unsafe extern "C" fn syscall_hook_trampoline_89_c1_31_d2() { _syscall_hook_trampoline_89_c1_31_d2() } #[no_mangle] -unsafe extern "C" fn syscall_hook_trampoline_89_d0_87_07() { +pub unsafe extern "C" fn syscall_hook_trampoline_89_d0_87_07() { _syscall_hook_trampoline_89_d0_87_07() } #[no_mangle] -unsafe extern "C" fn syscall_hook_trampoline_c3_nop() { +pub unsafe extern "C" fn syscall_hook_trampoline_c3_nop() { _syscall_hook_trampoline_c3_nop() } #[no_mangle] -unsafe extern "C" fn syscall_hook_trampoline_85_c0_0f_94_c2() { +pub unsafe extern "C" fn syscall_hook_trampoline_85_c0_0f_94_c2() { _syscall_hook_trampoline_85_c0_0f_94_c2() } #[no_mangle] -unsafe extern "C" fn traced_syscall( +pub unsafe extern "C" fn traced_syscall( syscallno: i32, arg0: i64, arg1: i64, @@ -118,7 +125,7 @@ unsafe extern "C" fn traced_syscall( } #[no_mangle] -unsafe extern "C" fn untraced_syscall( +pub unsafe extern "C" fn untraced_syscall( syscallno: i32, arg0: i64, arg1: i64, @@ -131,18 +138,18 @@ unsafe extern "C" fn untraced_syscall( } #[no_mangle] -unsafe extern "C" fn remote_syscall_helper_do_not_call_me() { +pub unsafe extern "C" fn remote_syscall_helper_do_not_call_me() { _remote_syscall_helper(); } #[repr(C)] -struct syscall_info { +pub struct syscall_info { no: u64, args: [u64; 6], } #[no_mangle] -unsafe extern "C" fn syscall_hook(info: *const syscall_info) -> i64 { +pub unsafe extern "C" fn syscall_hook(info: *const syscall_info) -> i64 { if let Some(cell) = &PSTATE { let mut pstate = cell.get().as_mut().unwrap(); let sc = info.as_ref().unwrap(); @@ -159,7 +166,7 @@ unsafe extern "C" fn syscall_hook(info: *const syscall_info) -> i64 { #[link_section = ".init_array"] #[used] -static EARLY_TRAMPOLINE_INIT: extern fn() = { +pub static EARLY_TRAMPOLINE_INIT: extern fn() = { extern "C" fn trampoline_ctor() { let syscall_hook_ptr = consts::REVERIE_LOCAL_SYSCALL_HOOK_ADDR as *mut u64; unsafe { diff --git a/tools_helper/src/lib.rs b/tools_helper/src/lib.rs index 2b193b2..683a5da 100644 --- a/tools_helper/src/lib.rs +++ b/tools_helper/src/lib.rs @@ -6,12 +6,12 @@ #[macro_use] pub mod logger; pub mod spinlock; -pub mod consts; pub mod counter; -pub mod local_state; -pub mod profiling; +pub mod ffi; pub use counter::note_syscall; pub use counter::NoteInfo; -pub use local_state::ProcessState; + +pub use common; +pub use common::local_state::ProcessState; diff --git a/trampoline/raw_syscall.S b/tools_helper/src/raw_syscall.S similarity index 100% rename from trampoline/raw_syscall.S rename to tools_helper/src/raw_syscall.S diff --git a/trampoline/remote_call.S b/tools_helper/src/remote_call.S similarity index 100% rename from trampoline/remote_call.S rename to tools_helper/src/remote_call.S diff --git a/trampoline/scinfo.h b/tools_helper/src/scinfo.h similarity index 100% rename from trampoline/scinfo.h rename to tools_helper/src/scinfo.h diff --git a/trampoline/trampoline.S b/tools_helper/src/trampoline.S similarity index 100% rename from trampoline/trampoline.S rename to tools_helper/src/trampoline.S From 044d8988656723f57d0254c30fb7197f1424f590 Mon Sep 17 00:00:00 2001 From: Logan Wendholt Date: Mon, 19 Aug 2019 20:03:19 -0400 Subject: [PATCH 2/8] Fix examples to work with new project structure --- examples/counter/build.rs | 37 ------------------------------------- examples/counter/src/lib.rs | 2 -- examples/det/build.rs | 37 ------------------------------------- examples/det/src/lib.rs | 2 -- examples/echo/build.rs | 37 ------------------------------------- examples/echo/src/dpc.rs | 4 ++-- examples/echo/src/entry.rs | 4 ++-- examples/echo/src/lib.rs | 4 +--- examples/none/build.rs | 37 ------------------------------------- examples/none/src/lib.rs | 2 -- 10 files changed, 5 insertions(+), 161 deletions(-) delete mode 100644 examples/counter/build.rs delete mode 100644 examples/det/build.rs delete mode 100644 examples/echo/build.rs delete mode 100644 examples/none/build.rs diff --git a/examples/counter/build.rs b/examples/counter/build.rs deleted file mode 100644 index 8af2661..0000000 --- a/examples/counter/build.rs +++ /dev/null @@ -1,37 +0,0 @@ -use cc; -use std::fs::File; -use std::io::{Result, Write}; -use std::path::Path; - -fn main() -> Result<()> { - cc::Build::new() - .define("_POSIX_C_SOURCE", "20180920") - .define("_GNU_SOURCE", "1") - .define("USE_SAVE", "1") - .flag("-fPIC") - .include("../../include") - .include("../../trampoline") - .file("../../trampoline/trampoline.S") - .file("../../trampoline/raw_syscall.S") - .file("../../trampoline/remote_call.S") - .compile("my-trampoline"); - - let cwd = std::env::current_dir()?; - let src_files: Vec<_> = vec![ std::fs::canonicalize("../../trampoline/ffi.rs").unwrap(), - std::fs::canonicalize("../../src/consts.rs").unwrap()]; - let dst_dir = std::fs::canonicalize(cwd.join("src"))?; - - src_files.iter().for_each(|f| { - let do_copy: Box Result<()>> = Box::new(|| { - let p = Path::new(&f).file_name().unwrap(); - let mut src = File::open(f)?; - let mut dst = File::create(dst_dir.join(p))?; - let header = format!("// AUTOMATICALLY GENERATED by build.rs by copying {:?}. DO NOT EDIT.\n\n", dst_dir.join(p)); - dst.write_all(header.as_bytes())?; - std::io::copy(&mut src, &mut dst)?; - Ok(()) - }); - do_copy().expect("failed to copy files"); - }); - Ok(()) -} diff --git a/examples/counter/src/lib.rs b/examples/counter/src/lib.rs index 9fb47df..d702316 100644 --- a/examples/counter/src/lib.rs +++ b/examples/counter/src/lib.rs @@ -9,8 +9,6 @@ use std::ffi::CStr; use tools_helper::*; use syscalls::*; -pub mod ffi; - #[cfg_attr(target_os = "linux", link_section = ".ctors")] #[used] static ECHO_DSO_CTORS: extern fn() = { diff --git a/examples/det/build.rs b/examples/det/build.rs deleted file mode 100644 index 8af2661..0000000 --- a/examples/det/build.rs +++ /dev/null @@ -1,37 +0,0 @@ -use cc; -use std::fs::File; -use std::io::{Result, Write}; -use std::path::Path; - -fn main() -> Result<()> { - cc::Build::new() - .define("_POSIX_C_SOURCE", "20180920") - .define("_GNU_SOURCE", "1") - .define("USE_SAVE", "1") - .flag("-fPIC") - .include("../../include") - .include("../../trampoline") - .file("../../trampoline/trampoline.S") - .file("../../trampoline/raw_syscall.S") - .file("../../trampoline/remote_call.S") - .compile("my-trampoline"); - - let cwd = std::env::current_dir()?; - let src_files: Vec<_> = vec![ std::fs::canonicalize("../../trampoline/ffi.rs").unwrap(), - std::fs::canonicalize("../../src/consts.rs").unwrap()]; - let dst_dir = std::fs::canonicalize(cwd.join("src"))?; - - src_files.iter().for_each(|f| { - let do_copy: Box Result<()>> = Box::new(|| { - let p = Path::new(&f).file_name().unwrap(); - let mut src = File::open(f)?; - let mut dst = File::create(dst_dir.join(p))?; - let header = format!("// AUTOMATICALLY GENERATED by build.rs by copying {:?}. DO NOT EDIT.\n\n", dst_dir.join(p)); - dst.write_all(header.as_bytes())?; - std::io::copy(&mut src, &mut dst)?; - Ok(()) - }); - do_copy().expect("failed to copy files"); - }); - Ok(()) -} diff --git a/examples/det/src/lib.rs b/examples/det/src/lib.rs index 6805079..08d6f31 100644 --- a/examples/det/src/lib.rs +++ b/examples/det/src/lib.rs @@ -15,8 +15,6 @@ use std::sync::atomic::{AtomicUsize, Ordering}; use libc; -pub mod ffi; - #[link_section = ".init_array"] #[used] static ECHO_DSO_CTORS: extern fn() = { diff --git a/examples/echo/build.rs b/examples/echo/build.rs deleted file mode 100644 index 8af2661..0000000 --- a/examples/echo/build.rs +++ /dev/null @@ -1,37 +0,0 @@ -use cc; -use std::fs::File; -use std::io::{Result, Write}; -use std::path::Path; - -fn main() -> Result<()> { - cc::Build::new() - .define("_POSIX_C_SOURCE", "20180920") - .define("_GNU_SOURCE", "1") - .define("USE_SAVE", "1") - .flag("-fPIC") - .include("../../include") - .include("../../trampoline") - .file("../../trampoline/trampoline.S") - .file("../../trampoline/raw_syscall.S") - .file("../../trampoline/remote_call.S") - .compile("my-trampoline"); - - let cwd = std::env::current_dir()?; - let src_files: Vec<_> = vec![ std::fs::canonicalize("../../trampoline/ffi.rs").unwrap(), - std::fs::canonicalize("../../src/consts.rs").unwrap()]; - let dst_dir = std::fs::canonicalize(cwd.join("src"))?; - - src_files.iter().for_each(|f| { - let do_copy: Box Result<()>> = Box::new(|| { - let p = Path::new(&f).file_name().unwrap(); - let mut src = File::open(f)?; - let mut dst = File::create(dst_dir.join(p))?; - let header = format!("// AUTOMATICALLY GENERATED by build.rs by copying {:?}. DO NOT EDIT.\n\n", dst_dir.join(p)); - dst.write_all(header.as_bytes())?; - std::io::copy(&mut src, &mut dst)?; - Ok(()) - }); - do_copy().expect("failed to copy files"); - }); - Ok(()) -} diff --git a/examples/echo/src/dpc.rs b/examples/echo/src/dpc.rs index 0b62a53..11dd4d6 100644 --- a/examples/echo/src/dpc.rs +++ b/examples/echo/src/dpc.rs @@ -4,8 +4,8 @@ use syscalls::syscall; use log::debug; -use crate::consts; -use crate::logger; +use tools_helper::common::consts; +use tools_helper::logger; const DPC_PREFIX: &'static str = "/tmp/dpc-task."; diff --git a/examples/echo/src/entry.rs b/examples/echo/src/entry.rs index d6d8df0..ce97d73 100644 --- a/examples/echo/src/entry.rs +++ b/examples/echo/src/entry.rs @@ -4,8 +4,8 @@ use syscalls::*; use tools_helper::*; use crate::show::*; -use crate::counter::{note_syscall, NoteInfo}; -use crate::local_state::{ProcessState, ThreadState}; +use tools_helper::counter::{note_syscall, NoteInfo}; +use tools_helper::common::local_state::{ProcessState, ThreadState}; #[macro_export(smsg)] macro_rules! smsg { diff --git a/examples/echo/src/lib.rs b/examples/echo/src/lib.rs index ff7a2da..7728126 100644 --- a/examples/echo/src/lib.rs +++ b/examples/echo/src/lib.rs @@ -5,14 +5,12 @@ use tools_helper::*; #[macro_use] pub mod macros; -pub mod ffi; -pub mod consts; pub mod entry; pub mod dpc; pub mod show; pub use counter::{NoteInfo, note_syscall}; -pub use local_state::{ProcessState, ThreadState}; +pub use common::local_state::{ProcessState, ThreadState}; use entry::captured_syscall; diff --git a/examples/none/build.rs b/examples/none/build.rs deleted file mode 100644 index 8af2661..0000000 --- a/examples/none/build.rs +++ /dev/null @@ -1,37 +0,0 @@ -use cc; -use std::fs::File; -use std::io::{Result, Write}; -use std::path::Path; - -fn main() -> Result<()> { - cc::Build::new() - .define("_POSIX_C_SOURCE", "20180920") - .define("_GNU_SOURCE", "1") - .define("USE_SAVE", "1") - .flag("-fPIC") - .include("../../include") - .include("../../trampoline") - .file("../../trampoline/trampoline.S") - .file("../../trampoline/raw_syscall.S") - .file("../../trampoline/remote_call.S") - .compile("my-trampoline"); - - let cwd = std::env::current_dir()?; - let src_files: Vec<_> = vec![ std::fs::canonicalize("../../trampoline/ffi.rs").unwrap(), - std::fs::canonicalize("../../src/consts.rs").unwrap()]; - let dst_dir = std::fs::canonicalize(cwd.join("src"))?; - - src_files.iter().for_each(|f| { - let do_copy: Box Result<()>> = Box::new(|| { - let p = Path::new(&f).file_name().unwrap(); - let mut src = File::open(f)?; - let mut dst = File::create(dst_dir.join(p))?; - let header = format!("// AUTOMATICALLY GENERATED by build.rs by copying {:?}. DO NOT EDIT.\n\n", dst_dir.join(p)); - dst.write_all(header.as_bytes())?; - std::io::copy(&mut src, &mut dst)?; - Ok(()) - }); - do_copy().expect("failed to copy files"); - }); - Ok(()) -} diff --git a/examples/none/src/lib.rs b/examples/none/src/lib.rs index 2e68026..57d0e6a 100644 --- a/examples/none/src/lib.rs +++ b/examples/none/src/lib.rs @@ -4,8 +4,6 @@ use syscalls::*; use tools_helper::*; -pub mod ffi; - #[no_mangle] pub extern "C" fn captured_syscall( _p: &mut ProcessState, From 44a414d5ffd4ab08fc77f65aef4cdf77f0fb1f9f Mon Sep 17 00:00:00 2001 From: Logan Wendholt Date: Tue, 20 Aug 2019 07:46:19 -0400 Subject: [PATCH 3/8] Clean up unused imports --- build.rs | 2 -- common/src/local_state.rs | 1 - preloader/build.rs | 4 +--- tools_helper/build.rs | 3 +-- tools_helper/src/ffi.rs | 4 ++-- 5 files changed, 4 insertions(+), 10 deletions(-) diff --git a/build.rs b/build.rs index 091e204..4538c49 100644 --- a/build.rs +++ b/build.rs @@ -3,8 +3,6 @@ use std::io::{Result, Write}; use std::path::PathBuf; use sysnum::gen_syscalls; -use cc; - fn gen_syscall_nrs(dest: PathBuf) -> Result<()> { let mut f = File::create(dest)?; writeln!(f, "// AUTOMATICALLY GENERATED BY reverie/build.rs. DO NOT EDIT.\n")?; diff --git a/common/src/local_state.rs b/common/src/local_state.rs index 2c64ed0..25ebae1 100644 --- a/common/src/local_state.rs +++ b/common/src/local_state.rs @@ -21,7 +21,6 @@ use std::collections::{HashMap, HashSet}; use nix::unistd::Pid; -use crate::consts; use crate::profiling::*; /// resources belongs to threads diff --git a/preloader/build.rs b/preloader/build.rs index 7cc8f27..6195b4e 100644 --- a/preloader/build.rs +++ b/preloader/build.rs @@ -1,6 +1,4 @@ -use std::fs::File; -use std::io::{Result, Write}; -use std::path::PathBuf; +use std::io::{Result}; use cc; diff --git a/tools_helper/build.rs b/tools_helper/build.rs index facb024..c465aa0 100644 --- a/tools_helper/build.rs +++ b/tools_helper/build.rs @@ -1,5 +1,4 @@ -use std::fs::File; -use std::io::{Result, Write}; +use std::io::Result; fn main() -> Result<()> { cc::Build::new() diff --git a/tools_helper/src/ffi.rs b/tools_helper/src/ffi.rs index e3ed39c..09b4707 100644 --- a/tools_helper/src/ffi.rs +++ b/tools_helper/src/ffi.rs @@ -153,8 +153,8 @@ pub unsafe extern "C" fn syscall_hook(info: *const syscall_info) -> i64 { if let Some(cell) = &PSTATE { let mut pstate = cell.get().as_mut().unwrap(); let sc = info.as_ref().unwrap(); - let no = SyscallNo::from(sc.no as i32); - let tid = syscall!(SYS_gettid).unwrap() as i32; + let _no = SyscallNo::from(sc.no as i32); + let _tid = syscall!(SYS_gettid).unwrap() as i32; let res = captured_syscall(&mut pstate, sc.no as i32, sc.args[0] as i64, sc.args[1] as i64, sc.args[2] as i64, sc.args[3] as i64, From 243212222ad25fcc16286e5c6399278d94dfc9cb Mon Sep 17 00:00:00 2001 From: Logan Wendholt Date: Tue, 20 Aug 2019 07:58:24 -0400 Subject: [PATCH 4/8] Update .gitignore --- .gitignore | 19 -- Cargo.lock | 773 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 773 insertions(+), 19 deletions(-) create mode 100644 Cargo.lock diff --git a/.gitignore b/.gitignore index 0972a0f..5664b31 100644 --- a/.gitignore +++ b/.gitignore @@ -58,16 +58,10 @@ core # will have compiled files and executables /target/ -# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries -# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html -Cargo.lock - # These are backup files generated by rustfmt **/*.rs.bk - # Systrace specific things - bin/reverie tests/clock-nanosleep tests/forkExec @@ -95,18 +89,5 @@ tests/threads6 tests/threads7 tests/write-many tests/x64-save-return-address -examples/counter/src/ffi.rs -examples/counter/src/consts.rs -examples/echo/src/ffi.rs -examples/echo/src/consts.rs -examples/det/src/ffi.rs -examples/det/src/consts.rs -examples/none/src/ffi.rs -examples/none/src/consts.rs src/nr.rs syscalls/src/nr.rs -tools_helper/src/consts.rs -tools_helper/src/profiling.rs -tools_helper/src/state.rs -tools_helper/src/local_state.rs -preloader/src/consts.rs diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..09515ea --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,773 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +[[package]] +name = "adler32" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "ansi_term" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "approx" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "atty" +version = "0.2.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "autocfg" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "bitflags" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "byteorder" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "c2-chacha" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "ppv-lite86 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "cc" +version = "1.0.40" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "cfg-if" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "cgmath" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "approx 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "chrono" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", + "num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "clap" +version = "2.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "colored" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winconsole 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "common" +version = "0.1.0" +dependencies = [ + "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "nix 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "counter" +version = "0.1.0" +dependencies = [ + "cc 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "syscalls 0.1.0", + "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tools_helper 0.1.0", +] + +[[package]] +name = "crc32fast" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "det" +version = "0.1.0" +dependencies = [ + "cc 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "syscalls 0.1.0", + "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tools_helper 0.1.0", +] + +[[package]] +name = "echo" +version = "0.1.0" +dependencies = [ + "cc 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", + "syscalls 0.1.0", + "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tools_helper 0.1.0", +] + +[[package]] +name = "fern" +version = "0.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "fuchsia-cprng" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "getrandom" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", + "wasi 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "goblin" +version = "0.0.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "plain 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "scroll 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "hex" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "itoa" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "lazy_static" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "libc" +version = "0.2.62" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "libflate" +version = "0.1.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "adler32 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "crc32fast 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rle-decode-fast 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "take_mut 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "log" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "nix" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", + "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "nix" +version = "0.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", + "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "none" +version = "0.1.0" +dependencies = [ + "cc 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", + "syscalls 0.1.0", + "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tools_helper 0.1.0", +] + +[[package]] +name = "num-integer" +version = "0.1.41" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "num-traits" +version = "0.1.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "num-traits" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "plain" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "ppv-lite86" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "preloader" +version = "0.1.0" +dependencies = [ + "cc 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", + "common 0.1.0", + "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", + "nix 0.14.1 (registry+https://github.com/rust-lang/crates.io-index)", + "procfs 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", + "syscalls 0.1.0", +] + +[[package]] +name = "proc-macro2" +version = "0.4.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "proc-macro2" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "procfs" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "chrono 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", + "hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", + "libflate 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "quote" +version = "0.6.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "quote" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "getrandom 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_chacha 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand_chacha" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "c2-chacha 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand_core" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand_core" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "rand_core" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "getrandom 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand_hc" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand_core 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rdrand" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "redox_syscall" +version = "0.1.56" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "remove_dir_all" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "reverie" +version = "0.1.0" +dependencies = [ + "cc 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", + "chrono 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)", + "colored 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "common 0.1.0", + "fern 0.5.8 (registry+https://github.com/rust-lang/crates.io-index)", + "goblin 0.0.24 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "nix 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", + "procfs 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", + "syscalls 0.1.0", + "sysnum 0.1.0", + "tools_helper 0.1.0", +] + +[[package]] +name = "rgb" +version = "0.8.13" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "rle-decode-fast" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "rustc_version" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "ryu" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "scroll" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "scroll_derive 0.9.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "scroll_derive" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "semver" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "semver-parser" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "serde" +version = "1.0.99" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "serde_derive 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "serde_derive" +version = "1.0.99" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "serde_json" +version = "1.0.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "ryu 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "strsim" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "syn" +version = "0.15.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "syn" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "syscalls" +version = "0.1.0" +dependencies = [ + "sysnum 0.1.0", +] + +[[package]] +name = "sysnum" +version = "0.1.0" +dependencies = [ + "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "take_mut" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "tempfile" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", + "remove_dir_all 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "textwrap" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "unicode-width 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "time" +version = "0.1.42" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tools_helper" +version = "0.1.0" +dependencies = [ + "cc 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", + "common 0.1.0", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "nix 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", + "syscalls 0.1.0", + "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "unicode-width" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "unicode-xid" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "unicode-xid" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "vec_map" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "void" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "wasi" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "winapi" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "winconsole" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cgmath 0.16.1 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rgb 0.8.13 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[metadata] +"checksum adler32 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7e522997b529f05601e05166c07ed17789691f562762c7f3b987263d2dedee5c" +"checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" +"checksum approx 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "08abcc3b4e9339e33a3d0a5ed15d84a687350c05689d825e0f6655eef9e76a94" +"checksum atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "1803c647a3ec87095e7ae7acfca019e98de5ec9a7d01343f611cf3152ed71a90" +"checksum autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "22130e92352b948e7e82a49cdb0aa94f2211761117f29e052dd397c1ac33542b" +"checksum bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3d155346769a6855b86399e9bc3814ab343cd3d62c7e985113d46a0ec3c281fd" +"checksum byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a7c3dd8985a7111efc5c80b44e23ecdd8c007de8ade3b96595387e812b957cf5" +"checksum c2-chacha 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7d64d04786e0f528460fc884753cf8dddcc466be308f6026f8e355c41a0e4101" +"checksum cc 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)" = "b548a4ee81fccb95919d4e22cfea83c7693ebfd78f0495493178db20b3139da7" +"checksum cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "b486ce3ccf7ffd79fdeb678eac06a9e6c09fc88d33836340becb8fffe87c5e33" +"checksum cgmath 0.16.1 (registry+https://github.com/rust-lang/crates.io-index)" = "64a4b57c8f4e3a2e9ac07e0f6abc9c24b6fc9e1b54c3478cfb598f3d0023e51c" +"checksum chrono 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)" = "77d81f58b7301084de3b958691458a53c3f7e0b1d702f77e550b6a88e3a88abe" +"checksum clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5067f5bb2d80ef5d68b4c87db81601f0b75bca627bc2ef76b141d7b846a3c6d9" +"checksum colored 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6cdb90b60f2927f8d76139c72dbde7e10c3a2bc47c8594c9c7a66529f2687c03" +"checksum crc32fast 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ba125de2af0df55319f41944744ad91c71113bf74a4646efff39afe1f6842db1" +"checksum fern 0.5.8 (registry+https://github.com/rust-lang/crates.io-index)" = "29d26fa0f4d433d1956746e66ec10d6bf4d6c8b93cd39965cceea7f7cc78c7dd" +"checksum fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" +"checksum getrandom 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "6171a6cc63fbabbe27c2b5ee268e8b7fe5dc1eb0dd2dfad537c1dfed6f69117e" +"checksum goblin 0.0.24 (registry+https://github.com/rust-lang/crates.io-index)" = "e3fa261d919c1ae9d1e4533c4a2f99e10938603c4208d56c05bec7a872b661b0" +"checksum hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "805026a5d0141ffc30abb3be3173848ad46a1b1664fe632428479619a3644d77" +"checksum itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "501266b7edd0174f8530248f87f99c88fbe60ca4ef3dd486835b8d8d53136f7f" +"checksum lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bc5729f27f159ddd61f4df6228e827e86643d4d3e7c32183cb30a1c08f604a14" +"checksum libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)" = "34fcd2c08d2f832f376f4173a231990fa5aef4e99fb569867318a227ef4c06ba" +"checksum libflate 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)" = "d9135df43b1f5d0e333385cb6e7897ecd1a43d7d11b91ac003f4d2c2d2401fdd" +"checksum log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7" +"checksum nix 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4dbdc256eaac2e3bd236d93ad999d3479ef775c863dbda3068c4006a92eec51b" +"checksum nix 0.14.1 (registry+https://github.com/rust-lang/crates.io-index)" = "6c722bee1037d430d0f8e687bbdbf222f27cc6e4e68d5caf630857bb2b6dbdce" +"checksum num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)" = "b85e541ef8255f6cf42bbfe4ef361305c6c135d10919ecc26126c4e5ae94bc09" +"checksum num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)" = "92e5113e9fd4cc14ded8e499429f396a20f98c772a47cc8622a736e1ec843c31" +"checksum num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "6ba9a427cfca2be13aa6f6403b0b7e7368fe982bfa16fccc450ce74c46cd9b32" +"checksum plain 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "b4596b6d070b27117e987119b4dac604f3c58cfb0b191112e24771b2faeac1a6" +"checksum ppv-lite86 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e3cbf9f658cdb5000fcf6f362b8ea2ba154b9f146a61c7a20d647034c6b6561b" +"checksum proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)" = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759" +"checksum proc-macro2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4c5c2380ae88876faae57698be9e9775e3544decad214599c3a6266cca6ac802" +"checksum procfs 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7fedbab4f73bb05650bf3a74a925f6f0351f6978303e0b9570d3b677cbbde4c7" +"checksum quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)" = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1" +"checksum quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe" +"checksum rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "552840b97013b1a26992c11eac34bdd778e464601a4c2054b5f0bff7c6761293" +"checksum rand 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d47eab0e83d9693d40f825f86948aa16eff6750ead4bdffc4ab95b8b3a7f052c" +"checksum rand_chacha 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "03a2a90da8c7523f554344f921aa97283eadf6ac484a6d2a7d0212fa7f8d6853" +"checksum rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" +"checksum rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" +"checksum rand_core 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "615e683324e75af5d43d8f7a39ffe3ee4a9dc42c5c701167a71dc59c3a493aca" +"checksum rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" +"checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" +"checksum redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)" = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84" +"checksum remove_dir_all 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4a83fa3702a688b9359eccba92d153ac33fd2e8462f9e0e3fdf155239ea7792e" +"checksum rgb 0.8.13 (registry+https://github.com/rust-lang/crates.io-index)" = "4f089652ca87f5a82a62935ec6172a534066c7b97be003cc8f702ee9a7a59c92" +"checksum rle-decode-fast 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cabe4fa914dec5870285fa7f71f602645da47c486e68486d2b4ceb4a343e90ac" +"checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" +"checksum ryu 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c92464b447c0ee8c4fb3824ecc8383b81717b9f1e74ba2e72540aef7b9f82997" +"checksum scroll 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)" = "2f84d114ef17fd144153d608fba7c446b0145d038985e7a8cc5d08bb0ce20383" +"checksum scroll_derive 0.9.5 (registry+https://github.com/rust-lang/crates.io-index)" = "8f1aa96c45e7f5a91cb7fabe7b279f02fea7126239fc40b732316e8b6a2d0fcb" +"checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" +"checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" +"checksum serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)" = "fec2851eb56d010dc9a21b89ca53ee75e6528bab60c11e89d38390904982da9f" +"checksum serde_derive 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)" = "cb4dc18c61206b08dc98216c98faa0232f4337e1e1b8574551d5bad29ea1b425" +"checksum serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)" = "051c49229f282f7c6f3813f8286cc1e3323e8051823fce42c7ea80fe13521704" +"checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" +"checksum syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)" = "9ca4b3b69a77cbe1ffc9e198781b7acb0c7365a883670e8f1c1bc66fba79a5c5" +"checksum syn 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "158521e6f544e7e3dcfc370ac180794aa38cb34a1b1e07609376d4adcf429b93" +"checksum take_mut 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f764005d11ee5f36500a149ace24e00e3da98b0158b3e2d53a7495660d3f4d60" +"checksum tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9" +"checksum textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" +"checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" +"checksum unicode-width 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "7007dbd421b92cc6e28410fe7362e2e0a2503394908f417b68ec8d1c364c4e20" +"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" +"checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c" +"checksum vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a" +"checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" +"checksum wasi 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fd5442abcac6525a045cc8c795aedb60da7a2e5e89c7bf18a0d5357849bb23c7" +"checksum winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "f10e386af2b13e47c89e7236a7a14a086791a2b88ebad6df9bf42040195cf770" +"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" +"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +"checksum winconsole 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3ef84b96d10db72dd980056666d7f1e7663ce93d82fa33b63e71c966f4cf5032" From 83c5e2604aec9ed042b9c9b34a5760cb158516b0 Mon Sep 17 00:00:00 2001 From: Logan Wendholt Date: Wed, 21 Aug 2019 13:48:05 -0400 Subject: [PATCH 5/8] Don't add tools_helper dependency to reverie The tools_helper crate is intended to be used when developing new reverie tool libraries. Previously, this was being made available by adding it as a dependency, then making it public via the reverie library crate. However, this causes issues in certain cases when building the binary, because the binary does not implement all the same functions that would be present in a tool library, leading to unresolved references. To solve this, the tools_library is removed as a dependency and is no longer a default member of the reverie workspace. However, tool library projects can still include it as a dependency by adding `tools_helper = { git = "https://github.com/iu-parfunc/reverie" }` within `Cargo.toml` --- Cargo.lock | 1 - Cargo.toml | 3 +-- src/lib.rs | 1 - 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 09515ea..cb585cd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -461,7 +461,6 @@ dependencies = [ "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", "syscalls 0.1.0", "sysnum 0.1.0", - "tools_helper 0.1.0", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index dade031..a70d677 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,7 +6,7 @@ edition = "2018" [workspace] members= [".", "syscalls", "tools_helper", "common", "preloader", "examples/none", "examples/echo", "examples/counter", "examples/det" ] -default-members = [".", "syscalls", "common", "preloader", "tools_helper" ] +default-members = [".", "syscalls", "common", "preloader" ] [lib] name = "reverie" @@ -20,7 +20,6 @@ path = "src/main.rs" libc = { version = "0.2", default-features = false } syscalls = { path = "syscalls" } common = { path = "common" } -tools_helper = { path = "tools_helper" } nix = "0.13" goblin = "0.0" procfs = "0.5" diff --git a/src/lib.rs b/src/lib.rs index 2ceabce..56c92e0 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -11,7 +11,6 @@ extern crate lazy_static; pub use syscalls; -pub use tools_helper; pub use common; pub mod hooks; From 24d39f9624d393ab8e6b3953b8fe561e26a21684 Mon Sep 17 00:00:00 2001 From: Logan Wendholt Date: Tue, 27 Aug 2019 13:50:22 -0400 Subject: [PATCH 6/8] Remove unnecessary pubs from ffi.rs --- tools_helper/src/ffi.rs | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/tools_helper/src/ffi.rs b/tools_helper/src/ffi.rs index 09b4707..06c6564 100644 --- a/tools_helper/src/ffi.rs +++ b/tools_helper/src/ffi.rs @@ -53,66 +53,66 @@ extern "C" { } #[no_mangle] -pub unsafe extern "C" fn syscall_hook_trampoline() { +unsafe extern "C" fn syscall_hook_trampoline() { _syscall_hook_trampoline() } #[no_mangle] -pub unsafe extern "C" fn syscall_hook_trampoline_48_3d_01_f0_ff_ff() { +unsafe extern "C" fn syscall_hook_trampoline_48_3d_01_f0_ff_ff() { _syscall_hook_trampoline_48_3d_01_f0_ff_ff() } #[no_mangle] -pub unsafe extern "C" fn syscall_hook_trampoline_48_3d_00_f0_ff_ff() { +unsafe extern "C" fn syscall_hook_trampoline_48_3d_00_f0_ff_ff() { _syscall_hook_trampoline_48_3d_00_f0_ff_ff() } #[no_mangle] -pub unsafe extern "C" fn syscall_hook_trampoline_48_8b_3c_24() { +unsafe extern "C" fn syscall_hook_trampoline_48_8b_3c_24() { _syscall_hook_trampoline_48_8b_3c_24() } #[no_mangle] -pub unsafe extern "C" fn syscall_hook_trampoline_5a_5e_c3() { +unsafe extern "C" fn syscall_hook_trampoline_5a_5e_c3() { _syscall_hook_trampoline_5a_5e_c3() } #[no_mangle] -pub unsafe extern "C" fn syscall_hook_trampoline_89_c2_f7_da() { +unsafe extern "C" fn syscall_hook_trampoline_89_c2_f7_da() { _syscall_hook_trampoline_89_c2_f7_da() } #[no_mangle] -pub unsafe extern "C" fn syscall_hook_trampoline_90_90_90() { +unsafe extern "C" fn syscall_hook_trampoline_90_90_90() { _syscall_hook_trampoline_90_90_90() } #[no_mangle] -pub unsafe extern "C" fn syscall_hook_trampoline_ba_01_00_00_00() { +unsafe extern "C" fn syscall_hook_trampoline_ba_01_00_00_00() { _syscall_hook_trampoline_ba_01_00_00_00() } #[no_mangle] -pub unsafe extern "C" fn syscall_hook_trampoline_89_c1_31_d2() { +unsafe extern "C" fn syscall_hook_trampoline_89_c1_31_d2() { _syscall_hook_trampoline_89_c1_31_d2() } #[no_mangle] -pub unsafe extern "C" fn syscall_hook_trampoline_89_d0_87_07() { +unsafe extern "C" fn syscall_hook_trampoline_89_d0_87_07() { _syscall_hook_trampoline_89_d0_87_07() } #[no_mangle] -pub unsafe extern "C" fn syscall_hook_trampoline_c3_nop() { +unsafe extern "C" fn syscall_hook_trampoline_c3_nop() { _syscall_hook_trampoline_c3_nop() } #[no_mangle] -pub unsafe extern "C" fn syscall_hook_trampoline_85_c0_0f_94_c2() { +unsafe extern "C" fn syscall_hook_trampoline_85_c0_0f_94_c2() { _syscall_hook_trampoline_85_c0_0f_94_c2() } #[no_mangle] -pub unsafe extern "C" fn traced_syscall( +unsafe extern "C" fn traced_syscall( syscallno: i32, arg0: i64, arg1: i64, @@ -125,7 +125,7 @@ pub unsafe extern "C" fn traced_syscall( } #[no_mangle] -pub unsafe extern "C" fn untraced_syscall( +unsafe extern "C" fn untraced_syscall( syscallno: i32, arg0: i64, arg1: i64, @@ -138,18 +138,18 @@ pub unsafe extern "C" fn untraced_syscall( } #[no_mangle] -pub unsafe extern "C" fn remote_syscall_helper_do_not_call_me() { +unsafe extern "C" fn remote_syscall_helper_do_not_call_me() { _remote_syscall_helper(); } #[repr(C)] -pub struct syscall_info { +struct syscall_info { no: u64, args: [u64; 6], } #[no_mangle] -pub unsafe extern "C" fn syscall_hook(info: *const syscall_info) -> i64 { +unsafe extern "C" fn syscall_hook(info: *const syscall_info) -> i64 { if let Some(cell) = &PSTATE { let mut pstate = cell.get().as_mut().unwrap(); let sc = info.as_ref().unwrap(); @@ -166,7 +166,7 @@ pub unsafe extern "C" fn syscall_hook(info: *const syscall_info) -> i64 { #[link_section = ".init_array"] #[used] -pub static EARLY_TRAMPOLINE_INIT: extern fn() = { +static EARLY_TRAMPOLINE_INIT: extern fn() = { extern "C" fn trampoline_ctor() { let syscall_hook_ptr = consts::REVERIE_LOCAL_SYSCALL_HOOK_ADDR as *mut u64; unsafe { From 76dddf674c784143ae6492874d6a043018f0c651 Mon Sep 17 00:00:00 2001 From: Logan Wendholt Date: Tue, 27 Aug 2019 15:41:37 -0400 Subject: [PATCH 7/8] Implement a better naming convention for sub-crates --- Cargo.lock | 156 ++- Cargo.toml | 38 +- Makefile | 2 +- examples/counter/Cargo.toml | 3 +- examples/counter/src/lib.rs | 3 +- examples/det/Cargo.toml | 3 +- examples/det/src/lib.rs | 7 +- examples/echo/Cargo.toml | 3 +- examples/echo/src/dpc.rs | 5 +- examples/echo/src/entry.rs | 12 +- examples/echo/src/lib.rs | 2 +- examples/echo/src/show/args.rs | 4 +- examples/echo/src/show/types.rs | 2 +- examples/none/Cargo.toml | 3 +- examples/none/src/lib.rs | 3 +- include/systrace.h | 15 - {common => reverie-common}/Cargo.toml | 6 +- {common => reverie-common}/src/consts.rs | 0 {common => reverie-common}/src/lib.rs | 0 {common => reverie-common}/src/local_state.rs | 0 {common => reverie-common}/src/profiling.rs | 0 {common => reverie-common}/src/state.rs | 0 {preloader => reverie-preloader}/Cargo.toml | 8 +- {preloader => reverie-preloader}/build.rs | 0 .../src/bpf-helper.c | 0 .../src/bpf-helper.h | 0 {preloader => reverie-preloader}/src/bpf_ll.c | 0 {preloader => reverie-preloader}/src/bpf_ll.h | 0 {preloader => reverie-preloader}/src/dl_ns.c | 0 {preloader => reverie-preloader}/src/lib.rs | 4 +- .../src/relink.rs | 0 .../src/seccomp_bpf.rs | 0 {syscalls => reverie-syscalls}/Cargo.toml | 6 +- {syscalls => reverie-syscalls}/build.rs | 2 +- {syscalls => reverie-syscalls}/src/helper.rs | 0 {syscalls => reverie-syscalls}/src/lib.rs | 0 {syscalls => reverie-syscalls}/src/macros.rs | 0 reverie-syscalls/src/nr.rs | 1068 +++++++++++++++++ {syscalls => reverie-syscalls}/src/raw.rs | 0 {sysnum => reverie-sysnum}/Cargo.toml | 6 +- {sysnum => reverie-sysnum}/src/lib.rs | 0 .../Cargo.toml | 8 +- .../build.rs | 0 .../src/counter.rs | 2 +- .../src/ffi.rs | 6 +- .../src/lib.rs | 8 +- .../src/logger.rs | 2 +- .../src/raw_syscall.S | 0 .../src/remote_call.S | 0 .../src/scinfo.h | 0 .../src/spinlock.rs | 2 +- .../src/trampoline.S | 0 reverie/Cargo.toml | 33 + build.rs => reverie/build.rs | 2 +- {src => reverie/src}/aux.rs | 0 {src => reverie/src}/auxv.rs | 0 {src => reverie/src}/block_events.rs | 0 {src => reverie/src}/config.rs | 32 +- {src => reverie/src}/debug.rs | 0 {src => reverie/src}/hooks.rs | 0 {src => reverie/src}/lib.rs | 4 +- {src => reverie/src}/macros.rs | 0 {src => reverie/src}/main.rs | 4 +- reverie/src/nr.rs | 1067 ++++++++++++++++ {src => reverie/src}/ns.rs | 0 {src => reverie/src}/remote.rs | 4 +- {src => reverie/src}/remote_rwlock.rs | 0 {src => reverie/src}/rpc_ptrace.rs | 2 +- {src => reverie/src}/sched.rs | 2 +- {src => reverie/src}/sched_wait.rs | 4 +- {src => reverie/src}/stubs.rs | 2 +- {src => reverie/src}/task.rs | 4 +- {src => reverie/src}/traced_task.rs | 8 +- {src => reverie/src}/vdso.rs | 0 74 files changed, 2334 insertions(+), 223 deletions(-) delete mode 100644 include/systrace.h rename {common => reverie-common}/Cargo.toml (76%) rename {common => reverie-common}/src/consts.rs (100%) rename {common => reverie-common}/src/lib.rs (100%) rename {common => reverie-common}/src/local_state.rs (100%) rename {common => reverie-common}/src/profiling.rs (100%) rename {common => reverie-common}/src/state.rs (100%) rename {preloader => reverie-preloader}/Cargo.toml (68%) rename {preloader => reverie-preloader}/build.rs (100%) rename {preloader => reverie-preloader}/src/bpf-helper.c (100%) rename {preloader => reverie-preloader}/src/bpf-helper.h (100%) rename {preloader => reverie-preloader}/src/bpf_ll.c (100%) rename {preloader => reverie-preloader}/src/bpf_ll.h (100%) rename {preloader => reverie-preloader}/src/dl_ns.c (100%) rename {preloader => reverie-preloader}/src/lib.rs (98%) rename {preloader => reverie-preloader}/src/relink.rs (100%) rename {preloader => reverie-preloader}/src/seccomp_bpf.rs (100%) rename {syscalls => reverie-syscalls}/Cargo.toml (60%) rename {syscalls => reverie-syscalls}/build.rs (98%) rename {syscalls => reverie-syscalls}/src/helper.rs (100%) rename {syscalls => reverie-syscalls}/src/lib.rs (100%) rename {syscalls => reverie-syscalls}/src/macros.rs (100%) create mode 100644 reverie-syscalls/src/nr.rs rename {syscalls => reverie-syscalls}/src/raw.rs (100%) rename {sysnum => reverie-sysnum}/Cargo.toml (62%) rename {sysnum => reverie-sysnum}/src/lib.rs (100%) rename {tools_helper => reverie-tools-helper}/Cargo.toml (68%) rename {tools_helper => reverie-tools-helper}/build.rs (100%) rename {tools_helper => reverie-tools-helper}/src/counter.rs (92%) rename {tools_helper => reverie-tools-helper}/src/ffi.rs (98%) rename {tools_helper => reverie-tools-helper}/src/lib.rs (56%) rename {tools_helper => reverie-tools-helper}/src/logger.rs (99%) rename {tools_helper => reverie-tools-helper}/src/raw_syscall.S (100%) rename {tools_helper => reverie-tools-helper}/src/remote_call.S (100%) rename {tools_helper => reverie-tools-helper}/src/scinfo.h (100%) rename {tools_helper => reverie-tools-helper}/src/spinlock.rs (98%) rename {tools_helper => reverie-tools-helper}/src/trampoline.S (100%) create mode 100644 reverie/Cargo.toml rename build.rs => reverie/build.rs (98%) rename {src => reverie/src}/aux.rs (100%) rename {src => reverie/src}/auxv.rs (100%) rename {src => reverie/src}/block_events.rs (100%) rename {src => reverie/src}/config.rs (93%) rename {src => reverie/src}/debug.rs (100%) rename {src => reverie/src}/hooks.rs (100%) rename {src => reverie/src}/lib.rs (93%) rename {src => reverie/src}/macros.rs (100%) rename {src => reverie/src}/main.rs (99%) create mode 100644 reverie/src/nr.rs rename {src => reverie/src}/ns.rs (100%) rename {src => reverie/src}/remote.rs (99%) rename {src => reverie/src}/remote_rwlock.rs (100%) rename {src => reverie/src}/rpc_ptrace.rs (98%) rename {src => reverie/src}/sched.rs (93%) rename {src => reverie/src}/sched_wait.rs (99%) rename {src => reverie/src}/stubs.rs (98%) rename {src => reverie/src}/task.rs (95%) rename {src => reverie/src}/traced_task.rs (99%) rename {src => reverie/src}/vdso.rs (100%) diff --git a/Cargo.lock b/Cargo.lock index cb585cd..7ebc668 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -29,7 +29,7 @@ dependencies = [ [[package]] name = "autocfg" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -47,7 +47,7 @@ name = "c2-chacha" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "ppv-lite86 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -101,27 +101,18 @@ name = "colored" version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "winconsole 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "common" -version = "0.1.0" -dependencies = [ - "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "nix 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "counter" version = "0.1.0" dependencies = [ "cc 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "syscalls 0.1.0", + "reverie-tools-helper 0.1.0", "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "tools_helper 0.1.0", ] [[package]] @@ -139,9 +130,8 @@ dependencies = [ "cc 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "syscalls 0.1.0", + "reverie-tools-helper 0.1.0", "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "tools_helper 0.1.0", ] [[package]] @@ -149,13 +139,12 @@ name = "echo" version = "0.1.0" dependencies = [ "cc 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "reverie-tools-helper 0.1.0", "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", - "syscalls 0.1.0", "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "tools_helper 0.1.0", ] [[package]] @@ -173,7 +162,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "getrandom" -version = "0.1.10" +version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", @@ -203,7 +192,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "lazy_static" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -259,10 +248,9 @@ name = "none" version = "0.1.0" dependencies = [ "cc 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", + "reverie-tools-helper 0.1.0", "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", - "syscalls 0.1.0", "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "tools_helper 0.1.0", ] [[package]] @@ -270,7 +258,7 @@ name = "num-integer" version = "0.1.41" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -287,7 +275,7 @@ name = "num-traits" version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -300,18 +288,6 @@ name = "ppv-lite86" version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "preloader" -version = "0.1.0" -dependencies = [ - "cc 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", - "common 0.1.0", - "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", - "nix 0.14.1 (registry+https://github.com/rust-lang/crates.io-index)", - "procfs 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", - "syscalls 0.1.0", -] - [[package]] name = "proc-macro2" version = "0.4.30" @@ -337,7 +313,7 @@ dependencies = [ "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "chrono 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", "hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", "libflate 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -375,7 +351,7 @@ name = "rand" version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "getrandom 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "getrandom 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", "rand_chacha 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -409,7 +385,7 @@ name = "rand_core" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "getrandom 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "getrandom 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -449,23 +425,70 @@ dependencies = [ "chrono 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", "clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)", "colored 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "common 0.1.0", "fern 0.5.8 (registry+https://github.com/rust-lang/crates.io-index)", "goblin 0.0.24 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "nix 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", "procfs 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", + "reverie-common 0.1.0", + "reverie-syscalls 0.1.0", + "reverie-sysnum 0.1.0", "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", - "syscalls 0.1.0", - "sysnum 0.1.0", +] + +[[package]] +name = "reverie-common" +version = "0.1.0" +dependencies = [ + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "nix 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "reverie-preloader" +version = "0.1.0" +dependencies = [ + "cc 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", + "nix 0.14.1 (registry+https://github.com/rust-lang/crates.io-index)", + "procfs 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", + "reverie-common 0.1.0", + "reverie-syscalls 0.1.0", +] + +[[package]] +name = "reverie-syscalls" +version = "0.1.0" +dependencies = [ + "reverie-sysnum 0.1.0", +] + +[[package]] +name = "reverie-sysnum" +version = "0.1.0" +dependencies = [ + "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "reverie-tools-helper" +version = "0.1.0" +dependencies = [ + "cc 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "nix 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", + "reverie-common 0.1.0", + "reverie-syscalls 0.1.0", + "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", + "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rgb" -version = "0.8.13" +version = "0.8.14" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -533,7 +556,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -563,7 +586,7 @@ dependencies = [ [[package]] name = "syn" -version = "1.0.3" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -571,20 +594,6 @@ dependencies = [ "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "syscalls" -version = "0.1.0" -dependencies = [ - "sysnum 0.1.0", -] - -[[package]] -name = "sysnum" -version = "0.1.0" -dependencies = [ - "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "take_mut" version = "0.2.2" @@ -621,19 +630,6 @@ dependencies = [ "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "tools_helper" -version = "0.1.0" -dependencies = [ - "cc 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", - "common 0.1.0", - "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "nix 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", - "syscalls 0.1.0", - "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "unicode-width" version = "0.1.6" @@ -689,8 +685,8 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cgmath 0.16.1 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rgb 0.8.13 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rgb 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -699,7 +695,7 @@ dependencies = [ "checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" "checksum approx 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "08abcc3b4e9339e33a3d0a5ed15d84a687350c05689d825e0f6655eef9e76a94" "checksum atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "1803c647a3ec87095e7ae7acfca019e98de5ec9a7d01343f611cf3152ed71a90" -"checksum autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "22130e92352b948e7e82a49cdb0aa94f2211761117f29e052dd397c1ac33542b" +"checksum autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "b671c8fb71b457dd4ae18c4ba1e59aa81793daacc361d82fcd410cef0d491875" "checksum bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3d155346769a6855b86399e9bc3814ab343cd3d62c7e985113d46a0ec3c281fd" "checksum byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a7c3dd8985a7111efc5c80b44e23ecdd8c007de8ade3b96595387e812b957cf5" "checksum c2-chacha 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7d64d04786e0f528460fc884753cf8dddcc466be308f6026f8e355c41a0e4101" @@ -712,11 +708,11 @@ dependencies = [ "checksum crc32fast 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ba125de2af0df55319f41944744ad91c71113bf74a4646efff39afe1f6842db1" "checksum fern 0.5.8 (registry+https://github.com/rust-lang/crates.io-index)" = "29d26fa0f4d433d1956746e66ec10d6bf4d6c8b93cd39965cceea7f7cc78c7dd" "checksum fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" -"checksum getrandom 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "6171a6cc63fbabbe27c2b5ee268e8b7fe5dc1eb0dd2dfad537c1dfed6f69117e" +"checksum getrandom 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "fc344b02d3868feb131e8b5fe2b9b0a1cc42942679af493061fc13b853243872" "checksum goblin 0.0.24 (registry+https://github.com/rust-lang/crates.io-index)" = "e3fa261d919c1ae9d1e4533c4a2f99e10938603c4208d56c05bec7a872b661b0" "checksum hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "805026a5d0141ffc30abb3be3173848ad46a1b1664fe632428479619a3644d77" "checksum itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "501266b7edd0174f8530248f87f99c88fbe60ca4ef3dd486835b8d8d53136f7f" -"checksum lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bc5729f27f159ddd61f4df6228e827e86643d4d3e7c32183cb30a1c08f604a14" +"checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" "checksum libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)" = "34fcd2c08d2f832f376f4173a231990fa5aef4e99fb569867318a227ef4c06ba" "checksum libflate 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)" = "d9135df43b1f5d0e333385cb6e7897ecd1a43d7d11b91ac003f4d2c2d2401fdd" "checksum log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7" @@ -742,7 +738,7 @@ dependencies = [ "checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" "checksum redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)" = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84" "checksum remove_dir_all 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4a83fa3702a688b9359eccba92d153ac33fd2e8462f9e0e3fdf155239ea7792e" -"checksum rgb 0.8.13 (registry+https://github.com/rust-lang/crates.io-index)" = "4f089652ca87f5a82a62935ec6172a534066c7b97be003cc8f702ee9a7a59c92" +"checksum rgb 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)" = "2089e4031214d129e201f8c3c8c2fe97cd7322478a0d1cdf78e7029b0042efdb" "checksum rle-decode-fast 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cabe4fa914dec5870285fa7f71f602645da47c486e68486d2b4ceb4a343e90ac" "checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" "checksum ryu 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c92464b447c0ee8c4fb3824ecc8383b81717b9f1e74ba2e72540aef7b9f82997" @@ -755,7 +751,7 @@ dependencies = [ "checksum serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)" = "051c49229f282f7c6f3813f8286cc1e3323e8051823fce42c7ea80fe13521704" "checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" "checksum syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)" = "9ca4b3b69a77cbe1ffc9e198781b7acb0c7365a883670e8f1c1bc66fba79a5c5" -"checksum syn 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "158521e6f544e7e3dcfc370ac180794aa38cb34a1b1e07609376d4adcf429b93" +"checksum syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "66850e97125af79138385e9b88339cbcd037e3f28ceab8c5ad98e64f0f1f80bf" "checksum take_mut 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f764005d11ee5f36500a149ace24e00e3da98b0158b3e2d53a7495660d3f4d60" "checksum tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9" "checksum textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" diff --git a/Cargo.toml b/Cargo.toml index a70d677..e33e231 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,37 +1,3 @@ -[package] -name = "reverie" -version = "0.1.0" -authors = ["Baojun Wang "] -edition = "2018" - [workspace] -members= [".", "syscalls", "tools_helper", "common", "preloader", "examples/none", "examples/echo", "examples/counter", "examples/det" ] -default-members = [".", "syscalls", "common", "preloader" ] - -[lib] -name = "reverie" -path = "src/lib.rs" - -[[bin]] -name = "reverie" -path = "src/main.rs" - -[dependencies] -libc = { version = "0.2", default-features = false } -syscalls = { path = "syscalls" } -common = { path = "common" } -nix = "0.13" -goblin = "0.0" -procfs = "0.5" -clap = "2.32" -lazy_static = "1.3" -colored = "1.7" -chrono = "0.4" -log = "0.4" -fern = "0.5" -serde = { version = "1.0", features = [ "derive" ] } -serde_json = "1.0" - -[build-dependencies] -cc = "1.0" -sysnum = { path = "sysnum" } +members= ["reverie", "reverie-syscalls", "reverie-tools-helper", "reverie-common", "reverie-preloader", "examples/none", "examples/echo", "examples/counter", "examples/det" ] +default-members = ["reverie", "reverie-syscalls", "reverie-common", "reverie-preloader" ] diff --git a/Makefile b/Makefile index 164ac6c..85eab15 100644 --- a/Makefile +++ b/Makefile @@ -21,7 +21,7 @@ all: $(MAKE) -C tests all @cargo build $(WAY) --all @cargo build --manifest-path examples/echo/Cargo.toml --target-dir=target - @cp -v target/$(TARGETDIR)/libpreloader.so lib/ + @cp -v target/$(TARGETDIR)/libreverie_preloader.so lib/ @cp -v target/$(TARGETDIR)/libecho.so lib/ @cp -v target/$(TARGETDIR)/libnone.so lib/ @cp -v target/$(TARGETDIR)/libcounter.so lib/ diff --git a/examples/counter/Cargo.toml b/examples/counter/Cargo.toml index 15af72e..5fef11b 100644 --- a/examples/counter/Cargo.toml +++ b/examples/counter/Cargo.toml @@ -10,8 +10,7 @@ crate-type = ["cdylib"] path = "src/lib.rs" [dependencies] -syscalls = { path = "../../syscalls" } -tools_helper = { path = "../../tools_helper" } +reverie-tools-helper = { path = "../../reverie-tools-helper" } log = { version = "0.4", default-features = false } [build-dependencies] diff --git a/examples/counter/src/lib.rs b/examples/counter/src/lib.rs index d702316..5207c45 100644 --- a/examples/counter/src/lib.rs +++ b/examples/counter/src/lib.rs @@ -6,8 +6,7 @@ #[allow(unused_imports)] use std::ffi::CStr; -use tools_helper::*; -use syscalls::*; +use reverie_tools_helper::{ syscalls::*, counter::*, common::local_state::ProcessState, logger }; #[cfg_attr(target_os = "linux", link_section = ".ctors")] #[used] diff --git a/examples/det/Cargo.toml b/examples/det/Cargo.toml index d247333..74ef4f7 100644 --- a/examples/det/Cargo.toml +++ b/examples/det/Cargo.toml @@ -10,8 +10,7 @@ crate-type = ["cdylib"] path = "src/lib.rs" [dependencies] -syscalls = { path = "../../syscalls" } -tools_helper = { path = "../../tools_helper" } +reverie-tools-helper = { path = "../../reverie-tools-helper" } log = { version = "0.4", default-features = false } libc = { version = "0.2", default-features = false } diff --git a/examples/det/src/lib.rs b/examples/det/src/lib.rs index 08d6f31..62d1312 100644 --- a/examples/det/src/lib.rs +++ b/examples/det/src/lib.rs @@ -2,8 +2,7 @@ #![allow(unused_imports)] #![allow(unused_attributes)] -use tools_helper::*; -use syscalls::*; +use reverie_tools_helper::{syscalls::*, counter::*, common::local_state::ProcessState, logger}; use log::*; #[allow(unused_imports)] @@ -38,10 +37,10 @@ pub extern "C" fn captured_syscall( a5: i64, ) -> i64 { note_syscall(p, no, NoteInfo::SyscallEntry); - let sc = syscalls::SyscallNo::from(no); + let sc = SyscallNo::from(no); #[allow(unused_assignments)] let mut res = -38; // ENOSYS - + match sc { SYS_gettimeofday => { let tick = LOGICAL_TIME.fetch_add(1, Ordering::SeqCst) as i64; diff --git a/examples/echo/Cargo.toml b/examples/echo/Cargo.toml index c93007e..f65b769 100644 --- a/examples/echo/Cargo.toml +++ b/examples/echo/Cargo.toml @@ -10,8 +10,7 @@ crate-type = ["cdylib"] path = "src/lib.rs" [dependencies] -syscalls = { path = "../../syscalls" } -tools_helper = { path = "../../tools_helper" } +reverie-tools-helper = { path = "../../reverie-tools-helper" } log = { version = "0.4", default-features = false } serde = { version = "1.0", default-features = false, features = [ "derive" ] } libc = { version = "0.2", default-features = false, features = [] } diff --git a/examples/echo/src/dpc.rs b/examples/echo/src/dpc.rs index 11dd4d6..e2a51f8 100644 --- a/examples/echo/src/dpc.rs +++ b/examples/echo/src/dpc.rs @@ -1,12 +1,9 @@ //! deferred precedure calls //! -use syscalls::syscall; +use reverie_tools_helper::{ common::consts, syscalls::syscall, logger} ; use log::debug; -use tools_helper::common::consts; -use tools_helper::logger; - const DPC_PREFIX: &'static str = "/tmp/dpc-task."; const PF_UNIX: i32 = 1; diff --git a/examples/echo/src/entry.rs b/examples/echo/src/entry.rs index ce97d73..1064184 100644 --- a/examples/echo/src/entry.rs +++ b/examples/echo/src/entry.rs @@ -1,11 +1,13 @@ //! echo entrypoint who defines `captured_syscall` //! -use syscalls::*; -use tools_helper::*; use crate::show::*; -use tools_helper::counter::{note_syscall, NoteInfo}; -use tools_helper::common::local_state::{ProcessState, ThreadState}; +use reverie_tools_helper::syscalls::*; +use reverie_tools_helper::counter::{note_syscall, NoteInfo}; +use reverie_tools_helper::common::local_state::{ProcessState, ThreadState}; + +use reverie_tools_helper::logger::*; +use reverie_tools_helper::*; #[macro_export(smsg)] macro_rules! smsg { @@ -32,7 +34,7 @@ pub extern "C" fn captured_syscall( a4: i64, a5: i64, ) -> i64 { - let sc = syscalls::SyscallNo::from(no); + let sc = SyscallNo::from(no); note_syscall(p, no, NoteInfo::SyscallEntry); let tid = syscall!(SYS_gettid).unwrap(); diff --git a/examples/echo/src/lib.rs b/examples/echo/src/lib.rs index 7728126..c8c7169 100644 --- a/examples/echo/src/lib.rs +++ b/examples/echo/src/lib.rs @@ -1,7 +1,7 @@ #![feature(format_args_nl, slice_internals)] #![allow(unused_attributes)] -use tools_helper::*; +use reverie_tools_helper::{counter, common, logger}; #[macro_use] pub mod macros; diff --git a/examples/echo/src/show/args.rs b/examples/echo/src/show/args.rs index b5ac059..77256a9 100644 --- a/examples/echo/src/show/args.rs +++ b/examples/echo/src/show/args.rs @@ -1,5 +1,5 @@ //! pretty print syscalls -use syscalls::*; +use reverie_tools_helper::syscalls::*; use core::fmt; use core::fmt::Display; use core::ptr::NonNull; @@ -891,7 +891,7 @@ impl Display for kernel_sigaction { self.sa_mask, { let flags = self.sa_flags as i32; - let mut v: Vec<_> = + let mut v: Vec<_> = [ libc_bit_field!(flags, SA_NOCLDSTOP), libc_bit_field!(flags, SA_NOCLDWAIT), libc_bit_field!(flags, SA_SIGINFO), diff --git a/examples/echo/src/show/types.rs b/examples/echo/src/show/types.rs index 9c8a7e5..2a215f4 100644 --- a/examples/echo/src/show/types.rs +++ b/examples/echo/src/show/types.rs @@ -1,7 +1,7 @@ use core::ptr::NonNull; use core::ffi::c_void as void; -use syscalls::SyscallNo; +use reverie_tools_helper::syscalls::SyscallNo; /// syscall return vaules for formatting purpose #[derive(Clone, Copy)] diff --git a/examples/none/Cargo.toml b/examples/none/Cargo.toml index e3d7cf0..f3ffea8 100644 --- a/examples/none/Cargo.toml +++ b/examples/none/Cargo.toml @@ -10,8 +10,7 @@ crate-type = ["cdylib"] path = "src/lib.rs" [dependencies] -syscalls = { path = "../../syscalls" } -tools_helper = { path = "../../tools_helper" } +reverie-tools-helper = { path = "../../reverie-tools-helper" } serde = { version = "1.0", default-features = false, features = [ "derive" ] } [build-dependencies] diff --git a/examples/none/src/lib.rs b/examples/none/src/lib.rs index 57d0e6a..584b3b5 100644 --- a/examples/none/src/lib.rs +++ b/examples/none/src/lib.rs @@ -1,8 +1,7 @@ #![allow(unused_imports)] #![allow(unused_attributes)] -use syscalls::*; -use tools_helper::*; +use reverie_tools_helper::{ syscalls::*, common::local_state::ProcessState }; #[no_mangle] pub extern "C" fn captured_syscall( diff --git a/include/systrace.h b/include/systrace.h deleted file mode 100644 index 1ddbbfa..0000000 --- a/include/systrace.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef _MY_SYSTRACE_H -#define _MY_SYSTRACE_H - -#include "scinfo.h" - -/* syscall dispatcher, weak symbol, so that others can overrides */ -extern long captured_syscall(int syscallno, long arg0, long arg1, long arg2, long arg3, long arg4, long arg5); - -/* initiate a syscall, traced by seccomp-bpf */ -extern long traced_syscall(int syscallno, long arg0, long arg1, long arg2, long arg3, long arg4, long arg5); -/* initiate a syscall, untraced/allowed by seccomp-bpf */ - -extern long untraced_syscall(int syscallno, long arg0, long arg1, long arg2, long arg3, long arg4, long arg5); - -#endif diff --git a/common/Cargo.toml b/reverie-common/Cargo.toml similarity index 76% rename from common/Cargo.toml rename to reverie-common/Cargo.toml index d614ddd..47fa90e 100644 --- a/common/Cargo.toml +++ b/reverie-common/Cargo.toml @@ -1,11 +1,15 @@ [package] -name = "common" +name = "reverie-common" version = "0.1.0" authors = ["Logan Wendholt "] edition = "2018" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +[lib] +name = "reverie_common" +path = "src/lib.rs" + [dependencies] nix = "0.13" lazy_static = "1.3" diff --git a/common/src/consts.rs b/reverie-common/src/consts.rs similarity index 100% rename from common/src/consts.rs rename to reverie-common/src/consts.rs diff --git a/common/src/lib.rs b/reverie-common/src/lib.rs similarity index 100% rename from common/src/lib.rs rename to reverie-common/src/lib.rs diff --git a/common/src/local_state.rs b/reverie-common/src/local_state.rs similarity index 100% rename from common/src/local_state.rs rename to reverie-common/src/local_state.rs diff --git a/common/src/profiling.rs b/reverie-common/src/profiling.rs similarity index 100% rename from common/src/profiling.rs rename to reverie-common/src/profiling.rs diff --git a/common/src/state.rs b/reverie-common/src/state.rs similarity index 100% rename from common/src/state.rs rename to reverie-common/src/state.rs diff --git a/preloader/Cargo.toml b/reverie-preloader/Cargo.toml similarity index 68% rename from preloader/Cargo.toml rename to reverie-preloader/Cargo.toml index e7a71ac..c5a2014 100644 --- a/preloader/Cargo.toml +++ b/reverie-preloader/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "preloader" +name = "reverie-preloader" version = "0.1.0" authors = ["Baojun Wang "] edition = "2018" @@ -7,13 +7,13 @@ edition = "2018" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [lib] -name = "preloader" +name = "reverie_preloader" crate-type = ["cdylib"] path = "src/lib.rs" [dependencies] -syscalls = { path = "../syscalls" } -common = { path = "../common" } +reverie-syscalls = { path = "../reverie-syscalls" } +reverie-common = { path = "../reverie-common" } procfs = "0.5" nix = "0.14" libc = "0.2" diff --git a/preloader/build.rs b/reverie-preloader/build.rs similarity index 100% rename from preloader/build.rs rename to reverie-preloader/build.rs diff --git a/preloader/src/bpf-helper.c b/reverie-preloader/src/bpf-helper.c similarity index 100% rename from preloader/src/bpf-helper.c rename to reverie-preloader/src/bpf-helper.c diff --git a/preloader/src/bpf-helper.h b/reverie-preloader/src/bpf-helper.h similarity index 100% rename from preloader/src/bpf-helper.h rename to reverie-preloader/src/bpf-helper.h diff --git a/preloader/src/bpf_ll.c b/reverie-preloader/src/bpf_ll.c similarity index 100% rename from preloader/src/bpf_ll.c rename to reverie-preloader/src/bpf_ll.c diff --git a/preloader/src/bpf_ll.h b/reverie-preloader/src/bpf_ll.h similarity index 100% rename from preloader/src/bpf_ll.h rename to reverie-preloader/src/bpf_ll.h diff --git a/preloader/src/dl_ns.c b/reverie-preloader/src/dl_ns.c similarity index 100% rename from preloader/src/dl_ns.c rename to reverie-preloader/src/dl_ns.c diff --git a/preloader/src/lib.rs b/reverie-preloader/src/lib.rs similarity index 98% rename from preloader/src/lib.rs rename to reverie-preloader/src/lib.rs index 64720bc..3d0b6c0 100644 --- a/preloader/src/lib.rs +++ b/reverie-preloader/src/lib.rs @@ -5,8 +5,8 @@ use std::io::Result; pub mod relink; pub mod seccomp_bpf; -use syscalls::*; -use common::consts; +use reverie_syscalls::*; +use reverie_common::consts; #[link_section = ".init_array"] #[used] diff --git a/preloader/src/relink.rs b/reverie-preloader/src/relink.rs similarity index 100% rename from preloader/src/relink.rs rename to reverie-preloader/src/relink.rs diff --git a/preloader/src/seccomp_bpf.rs b/reverie-preloader/src/seccomp_bpf.rs similarity index 100% rename from preloader/src/seccomp_bpf.rs rename to reverie-preloader/src/seccomp_bpf.rs diff --git a/syscalls/Cargo.toml b/reverie-syscalls/Cargo.toml similarity index 60% rename from syscalls/Cargo.toml rename to reverie-syscalls/Cargo.toml index 70e1548..205df38 100644 --- a/syscalls/Cargo.toml +++ b/reverie-syscalls/Cargo.toml @@ -1,14 +1,14 @@ [package] -name = "syscalls" +name = "reverie-syscalls" version = "0.1.0" authors = ["Baojun Wang "] edition = "2018" [lib] -name = "syscalls" +name = "reverie_syscalls" path = "src/lib.rs" [dependencies] [build-dependencies] -sysnum = { path = "../sysnum" } +reverie-sysnum = { path = "../reverie-sysnum" } diff --git a/syscalls/build.rs b/reverie-syscalls/build.rs similarity index 98% rename from syscalls/build.rs rename to reverie-syscalls/build.rs index 1529cfb..2e0f9ae 100644 --- a/syscalls/build.rs +++ b/reverie-syscalls/build.rs @@ -1,7 +1,7 @@ use std::fs::File; use std::io::{Result, Write}; use std::path::PathBuf; -use sysnum::gen_syscalls; +use reverie_sysnum::gen_syscalls; fn gen_syscall_nrs(dest: PathBuf) -> Result<()> { let mut f = File::create(dest)?; diff --git a/syscalls/src/helper.rs b/reverie-syscalls/src/helper.rs similarity index 100% rename from syscalls/src/helper.rs rename to reverie-syscalls/src/helper.rs diff --git a/syscalls/src/lib.rs b/reverie-syscalls/src/lib.rs similarity index 100% rename from syscalls/src/lib.rs rename to reverie-syscalls/src/lib.rs diff --git a/syscalls/src/macros.rs b/reverie-syscalls/src/macros.rs similarity index 100% rename from syscalls/src/macros.rs rename to reverie-syscalls/src/macros.rs diff --git a/reverie-syscalls/src/nr.rs b/reverie-syscalls/src/nr.rs new file mode 100644 index 0000000..3d85a69 --- /dev/null +++ b/reverie-syscalls/src/nr.rs @@ -0,0 +1,1068 @@ +// AUTOMATICALLY GENERATED BY reverie/syscalls/build.rs. DO NOT EDIT. + +pub use self::SyscallNo::*; +use core::fmt; +#[allow(non_snake_case, non_camel_case_types, non_upper_case_globals)] + +#[derive(PartialEq, Eq, Clone, Copy)] +pub enum SyscallNo { + SYS_read = 0, + SYS_write = 1, + SYS_open = 2, + SYS_close = 3, + SYS_stat = 4, + SYS_fstat = 5, + SYS_lstat = 6, + SYS_poll = 7, + SYS_lseek = 8, + SYS_mmap = 9, + SYS_mprotect = 10, + SYS_munmap = 11, + SYS_brk = 12, + SYS_rt_sigaction = 13, + SYS_rt_sigprocmask = 14, + SYS_rt_sigreturn = 15, + SYS_ioctl = 16, + SYS_pread64 = 17, + SYS_pwrite64 = 18, + SYS_readv = 19, + SYS_writev = 20, + SYS_access = 21, + SYS_pipe = 22, + SYS_select = 23, + SYS_sched_yield = 24, + SYS_mremap = 25, + SYS_msync = 26, + SYS_mincore = 27, + SYS_madvise = 28, + SYS_shmget = 29, + SYS_shmat = 30, + SYS_shmctl = 31, + SYS_dup = 32, + SYS_dup2 = 33, + SYS_pause = 34, + SYS_nanosleep = 35, + SYS_getitimer = 36, + SYS_alarm = 37, + SYS_setitimer = 38, + SYS_getpid = 39, + SYS_sendfile = 40, + SYS_socket = 41, + SYS_connect = 42, + SYS_accept = 43, + SYS_sendto = 44, + SYS_recvfrom = 45, + SYS_sendmsg = 46, + SYS_recvmsg = 47, + SYS_shutdown = 48, + SYS_bind = 49, + SYS_listen = 50, + SYS_getsockname = 51, + SYS_getpeername = 52, + SYS_socketpair = 53, + SYS_setsockopt = 54, + SYS_getsockopt = 55, + SYS_clone = 56, + SYS_fork = 57, + SYS_vfork = 58, + SYS_execve = 59, + SYS_exit = 60, + SYS_wait4 = 61, + SYS_kill = 62, + SYS_uname = 63, + SYS_semget = 64, + SYS_semop = 65, + SYS_semctl = 66, + SYS_shmdt = 67, + SYS_msgget = 68, + SYS_msgsnd = 69, + SYS_msgrcv = 70, + SYS_msgctl = 71, + SYS_fcntl = 72, + SYS_flock = 73, + SYS_fsync = 74, + SYS_fdatasync = 75, + SYS_truncate = 76, + SYS_ftruncate = 77, + SYS_getdents = 78, + SYS_getcwd = 79, + SYS_chdir = 80, + SYS_fchdir = 81, + SYS_rename = 82, + SYS_mkdir = 83, + SYS_rmdir = 84, + SYS_creat = 85, + SYS_link = 86, + SYS_unlink = 87, + SYS_symlink = 88, + SYS_readlink = 89, + SYS_chmod = 90, + SYS_fchmod = 91, + SYS_chown = 92, + SYS_fchown = 93, + SYS_lchown = 94, + SYS_umask = 95, + SYS_gettimeofday = 96, + SYS_getrlimit = 97, + SYS_getrusage = 98, + SYS_sysinfo = 99, + SYS_times = 100, + SYS_ptrace = 101, + SYS_getuid = 102, + SYS_syslog = 103, + SYS_getgid = 104, + SYS_setuid = 105, + SYS_setgid = 106, + SYS_geteuid = 107, + SYS_getegid = 108, + SYS_setpgid = 109, + SYS_getppid = 110, + SYS_getpgrp = 111, + SYS_setsid = 112, + SYS_setreuid = 113, + SYS_setregid = 114, + SYS_getgroups = 115, + SYS_setgroups = 116, + SYS_setresuid = 117, + SYS_getresuid = 118, + SYS_setresgid = 119, + SYS_getresgid = 120, + SYS_getpgid = 121, + SYS_setfsuid = 122, + SYS_setfsgid = 123, + SYS_getsid = 124, + SYS_capget = 125, + SYS_capset = 126, + SYS_rt_sigpending = 127, + SYS_rt_sigtimedwait = 128, + SYS_rt_sigqueueinfo = 129, + SYS_rt_sigsuspend = 130, + SYS_sigaltstack = 131, + SYS_utime = 132, + SYS_mknod = 133, + SYS_uselib = 134, + SYS_personality = 135, + SYS_ustat = 136, + SYS_statfs = 137, + SYS_fstatfs = 138, + SYS_sysfs = 139, + SYS_getpriority = 140, + SYS_setpriority = 141, + SYS_sched_setparam = 142, + SYS_sched_getparam = 143, + SYS_sched_setscheduler = 144, + SYS_sched_getscheduler = 145, + SYS_sched_get_priority_max = 146, + SYS_sched_get_priority_min = 147, + SYS_sched_rr_get_interval = 148, + SYS_mlock = 149, + SYS_munlock = 150, + SYS_mlockall = 151, + SYS_munlockall = 152, + SYS_vhangup = 153, + SYS_modify_ldt = 154, + SYS_pivot_root = 155, + SYS__sysctl = 156, + SYS_prctl = 157, + SYS_arch_prctl = 158, + SYS_adjtimex = 159, + SYS_setrlimit = 160, + SYS_chroot = 161, + SYS_sync = 162, + SYS_acct = 163, + SYS_settimeofday = 164, + SYS_mount = 165, + SYS_umount2 = 166, + SYS_swapon = 167, + SYS_swapoff = 168, + SYS_reboot = 169, + SYS_sethostname = 170, + SYS_setdomainname = 171, + SYS_iopl = 172, + SYS_ioperm = 173, + SYS_create_module = 174, + SYS_init_module = 175, + SYS_delete_module = 176, + SYS_get_kernel_syms = 177, + SYS_query_module = 178, + SYS_quotactl = 179, + SYS_nfsservctl = 180, + SYS_getpmsg = 181, + SYS_putpmsg = 182, + SYS_afs_syscall = 183, + SYS_tuxcall = 184, + SYS_security = 185, + SYS_gettid = 186, + SYS_readahead = 187, + SYS_setxattr = 188, + SYS_lsetxattr = 189, + SYS_fsetxattr = 190, + SYS_getxattr = 191, + SYS_lgetxattr = 192, + SYS_fgetxattr = 193, + SYS_listxattr = 194, + SYS_llistxattr = 195, + SYS_flistxattr = 196, + SYS_removexattr = 197, + SYS_lremovexattr = 198, + SYS_fremovexattr = 199, + SYS_tkill = 200, + SYS_time = 201, + SYS_futex = 202, + SYS_sched_setaffinity = 203, + SYS_sched_getaffinity = 204, + SYS_set_thread_area = 205, + SYS_io_setup = 206, + SYS_io_destroy = 207, + SYS_io_getevents = 208, + SYS_io_submit = 209, + SYS_io_cancel = 210, + SYS_get_thread_area = 211, + SYS_lookup_dcookie = 212, + SYS_epoll_create = 213, + SYS_epoll_ctl_old = 214, + SYS_epoll_wait_old = 215, + SYS_remap_file_pages = 216, + SYS_getdents64 = 217, + SYS_set_tid_address = 218, + SYS_restart_syscall = 219, + SYS_semtimedop = 220, + SYS_fadvise64 = 221, + SYS_timer_create = 222, + SYS_timer_settime = 223, + SYS_timer_gettime = 224, + SYS_timer_getoverrun = 225, + SYS_timer_delete = 226, + SYS_clock_settime = 227, + SYS_clock_gettime = 228, + SYS_clock_getres = 229, + SYS_clock_nanosleep = 230, + SYS_exit_group = 231, + SYS_epoll_wait = 232, + SYS_epoll_ctl = 233, + SYS_tgkill = 234, + SYS_utimes = 235, + SYS_vserver = 236, + SYS_mbind = 237, + SYS_set_mempolicy = 238, + SYS_get_mempolicy = 239, + SYS_mq_open = 240, + SYS_mq_unlink = 241, + SYS_mq_timedsend = 242, + SYS_mq_timedreceive = 243, + SYS_mq_notify = 244, + SYS_mq_getsetattr = 245, + SYS_kexec_load = 246, + SYS_waitid = 247, + SYS_add_key = 248, + SYS_request_key = 249, + SYS_keyctl = 250, + SYS_ioprio_set = 251, + SYS_ioprio_get = 252, + SYS_inotify_init = 253, + SYS_inotify_add_watch = 254, + SYS_inotify_rm_watch = 255, + SYS_migrate_pages = 256, + SYS_openat = 257, + SYS_mkdirat = 258, + SYS_mknodat = 259, + SYS_fchownat = 260, + SYS_futimesat = 261, + SYS_newfstatat = 262, + SYS_unlinkat = 263, + SYS_renameat = 264, + SYS_linkat = 265, + SYS_symlinkat = 266, + SYS_readlinkat = 267, + SYS_fchmodat = 268, + SYS_faccessat = 269, + SYS_pselect6 = 270, + SYS_ppoll = 271, + SYS_unshare = 272, + SYS_set_robust_list = 273, + SYS_get_robust_list = 274, + SYS_splice = 275, + SYS_tee = 276, + SYS_sync_file_range = 277, + SYS_vmsplice = 278, + SYS_move_pages = 279, + SYS_utimensat = 280, + SYS_epoll_pwait = 281, + SYS_signalfd = 282, + SYS_timerfd_create = 283, + SYS_eventfd = 284, + SYS_fallocate = 285, + SYS_timerfd_settime = 286, + SYS_timerfd_gettime = 287, + SYS_accept4 = 288, + SYS_signalfd4 = 289, + SYS_eventfd2 = 290, + SYS_epoll_create1 = 291, + SYS_dup3 = 292, + SYS_pipe2 = 293, + SYS_inotify_init1 = 294, + SYS_preadv = 295, + SYS_pwritev = 296, + SYS_rt_tgsigqueueinfo = 297, + SYS_perf_event_open = 298, + SYS_recvmmsg = 299, + SYS_fanotify_init = 300, + SYS_fanotify_mark = 301, + SYS_prlimit64 = 302, + SYS_name_to_handle_at = 303, + SYS_open_by_handle_at = 304, + SYS_clock_adjtime = 305, + SYS_syncfs = 306, + SYS_sendmmsg = 307, + SYS_setns = 308, + SYS_getcpu = 309, + SYS_process_vm_readv = 310, + SYS_process_vm_writev = 311, + SYS_kcmp = 312, + SYS_finit_module = 313, + SYS_sched_setattr = 314, + SYS_sched_getattr = 315, + SYS_renameat2 = 316, + SYS_seccomp = 317, + SYS_getrandom = 318, + SYS_memfd_create = 319, + SYS_kexec_file_load = 320, + SYS_bpf = 321, + SYS_execveat = 322, + SYS_userfaultfd = 323, + SYS_membarrier = 324, + SYS_mlock2 = 325, + SYS_copy_file_range = 326, + SYS_preadv2 = 327, + SYS_pwritev2 = 328, + SYS_pkey_mprotect = 329, + SYS_pkey_alloc = 330, + SYS_pkey_free = 331, + SYS_statx = 332, + SYS_io_pgetevents = 333, + SYS_rseq = 334, + SYS_pidfd_send_signal = 424, + SYS_io_uring_setup = 425, + SYS_io_uring_enter = 426, + SYS_io_uring_register = 427, + SYS_open_tree = 428, + SYS_move_mount = 429, + SYS_fsopen = 430, + SYS_fsconfig = 431, + SYS_fsmount = 432, + SYS_fspick = 433, + SYS_pidfd_open = 434, + SYS_clone3 = 435, +} +static SYSCALL_NAMES: [&str; 347] = [ + "read", + "write", + "open", + "close", + "stat", + "fstat", + "lstat", + "poll", + "lseek", + "mmap", + "mprotect", + "munmap", + "brk", + "rt_sigaction", + "rt_sigprocmask", + "rt_sigreturn", + "ioctl", + "pread64", + "pwrite64", + "readv", + "writev", + "access", + "pipe", + "select", + "sched_yield", + "mremap", + "msync", + "mincore", + "madvise", + "shmget", + "shmat", + "shmctl", + "dup", + "dup2", + "pause", + "nanosleep", + "getitimer", + "alarm", + "setitimer", + "getpid", + "sendfile", + "socket", + "connect", + "accept", + "sendto", + "recvfrom", + "sendmsg", + "recvmsg", + "shutdown", + "bind", + "listen", + "getsockname", + "getpeername", + "socketpair", + "setsockopt", + "getsockopt", + "clone", + "fork", + "vfork", + "execve", + "exit", + "wait4", + "kill", + "uname", + "semget", + "semop", + "semctl", + "shmdt", + "msgget", + "msgsnd", + "msgrcv", + "msgctl", + "fcntl", + "flock", + "fsync", + "fdatasync", + "truncate", + "ftruncate", + "getdents", + "getcwd", + "chdir", + "fchdir", + "rename", + "mkdir", + "rmdir", + "creat", + "link", + "unlink", + "symlink", + "readlink", + "chmod", + "fchmod", + "chown", + "fchown", + "lchown", + "umask", + "gettimeofday", + "getrlimit", + "getrusage", + "sysinfo", + "times", + "ptrace", + "getuid", + "syslog", + "getgid", + "setuid", + "setgid", + "geteuid", + "getegid", + "setpgid", + "getppid", + "getpgrp", + "setsid", + "setreuid", + "setregid", + "getgroups", + "setgroups", + "setresuid", + "getresuid", + "setresgid", + "getresgid", + "getpgid", + "setfsuid", + "setfsgid", + "getsid", + "capget", + "capset", + "rt_sigpending", + "rt_sigtimedwait", + "rt_sigqueueinfo", + "rt_sigsuspend", + "sigaltstack", + "utime", + "mknod", + "uselib", + "personality", + "ustat", + "statfs", + "fstatfs", + "sysfs", + "getpriority", + "setpriority", + "sched_setparam", + "sched_getparam", + "sched_setscheduler", + "sched_getscheduler", + "sched_get_priority_max", + "sched_get_priority_min", + "sched_rr_get_interval", + "mlock", + "munlock", + "mlockall", + "munlockall", + "vhangup", + "modify_ldt", + "pivot_root", + "_sysctl", + "prctl", + "arch_prctl", + "adjtimex", + "setrlimit", + "chroot", + "sync", + "acct", + "settimeofday", + "mount", + "umount2", + "swapon", + "swapoff", + "reboot", + "sethostname", + "setdomainname", + "iopl", + "ioperm", + "create_module", + "init_module", + "delete_module", + "get_kernel_syms", + "query_module", + "quotactl", + "nfsservctl", + "getpmsg", + "putpmsg", + "afs_syscall", + "tuxcall", + "security", + "gettid", + "readahead", + "setxattr", + "lsetxattr", + "fsetxattr", + "getxattr", + "lgetxattr", + "fgetxattr", + "listxattr", + "llistxattr", + "flistxattr", + "removexattr", + "lremovexattr", + "fremovexattr", + "tkill", + "time", + "futex", + "sched_setaffinity", + "sched_getaffinity", + "set_thread_area", + "io_setup", + "io_destroy", + "io_getevents", + "io_submit", + "io_cancel", + "get_thread_area", + "lookup_dcookie", + "epoll_create", + "epoll_ctl_old", + "epoll_wait_old", + "remap_file_pages", + "getdents64", + "set_tid_address", + "restart_syscall", + "semtimedop", + "fadvise64", + "timer_create", + "timer_settime", + "timer_gettime", + "timer_getoverrun", + "timer_delete", + "clock_settime", + "clock_gettime", + "clock_getres", + "clock_nanosleep", + "exit_group", + "epoll_wait", + "epoll_ctl", + "tgkill", + "utimes", + "vserver", + "mbind", + "set_mempolicy", + "get_mempolicy", + "mq_open", + "mq_unlink", + "mq_timedsend", + "mq_timedreceive", + "mq_notify", + "mq_getsetattr", + "kexec_load", + "waitid", + "add_key", + "request_key", + "keyctl", + "ioprio_set", + "ioprio_get", + "inotify_init", + "inotify_add_watch", + "inotify_rm_watch", + "migrate_pages", + "openat", + "mkdirat", + "mknodat", + "fchownat", + "futimesat", + "newfstatat", + "unlinkat", + "renameat", + "linkat", + "symlinkat", + "readlinkat", + "fchmodat", + "faccessat", + "pselect6", + "ppoll", + "unshare", + "set_robust_list", + "get_robust_list", + "splice", + "tee", + "sync_file_range", + "vmsplice", + "move_pages", + "utimensat", + "epoll_pwait", + "signalfd", + "timerfd_create", + "eventfd", + "fallocate", + "timerfd_settime", + "timerfd_gettime", + "accept4", + "signalfd4", + "eventfd2", + "epoll_create1", + "dup3", + "pipe2", + "inotify_init1", + "preadv", + "pwritev", + "rt_tgsigqueueinfo", + "perf_event_open", + "recvmmsg", + "fanotify_init", + "fanotify_mark", + "prlimit64", + "name_to_handle_at", + "open_by_handle_at", + "clock_adjtime", + "syncfs", + "sendmmsg", + "setns", + "getcpu", + "process_vm_readv", + "process_vm_writev", + "kcmp", + "finit_module", + "sched_setattr", + "sched_getattr", + "renameat2", + "seccomp", + "getrandom", + "memfd_create", + "kexec_file_load", + "bpf", + "execveat", + "userfaultfd", + "membarrier", + "mlock2", + "copy_file_range", + "preadv2", + "pwritev2", + "pkey_mprotect", + "pkey_alloc", + "pkey_free", + "statx", + "io_pgetevents", + "rseq", + "pidfd_send_signal", + "io_uring_setup", + "io_uring_enter", + "io_uring_register", + "open_tree", + "move_mount", + "fsopen", + "fsconfig", + "fsmount", + "fspick", + "pidfd_open", + "clone3", +]; +impl fmt::Debug for SyscallNo { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "{}", SYSCALL_NAMES[self.clone() as usize]) + } +} +static SYSCALL_IDS: [SyscallNo; 347] = [ + SYS_read, + SYS_write, + SYS_open, + SYS_close, + SYS_stat, + SYS_fstat, + SYS_lstat, + SYS_poll, + SYS_lseek, + SYS_mmap, + SYS_mprotect, + SYS_munmap, + SYS_brk, + SYS_rt_sigaction, + SYS_rt_sigprocmask, + SYS_rt_sigreturn, + SYS_ioctl, + SYS_pread64, + SYS_pwrite64, + SYS_readv, + SYS_writev, + SYS_access, + SYS_pipe, + SYS_select, + SYS_sched_yield, + SYS_mremap, + SYS_msync, + SYS_mincore, + SYS_madvise, + SYS_shmget, + SYS_shmat, + SYS_shmctl, + SYS_dup, + SYS_dup2, + SYS_pause, + SYS_nanosleep, + SYS_getitimer, + SYS_alarm, + SYS_setitimer, + SYS_getpid, + SYS_sendfile, + SYS_socket, + SYS_connect, + SYS_accept, + SYS_sendto, + SYS_recvfrom, + SYS_sendmsg, + SYS_recvmsg, + SYS_shutdown, + SYS_bind, + SYS_listen, + SYS_getsockname, + SYS_getpeername, + SYS_socketpair, + SYS_setsockopt, + SYS_getsockopt, + SYS_clone, + SYS_fork, + SYS_vfork, + SYS_execve, + SYS_exit, + SYS_wait4, + SYS_kill, + SYS_uname, + SYS_semget, + SYS_semop, + SYS_semctl, + SYS_shmdt, + SYS_msgget, + SYS_msgsnd, + SYS_msgrcv, + SYS_msgctl, + SYS_fcntl, + SYS_flock, + SYS_fsync, + SYS_fdatasync, + SYS_truncate, + SYS_ftruncate, + SYS_getdents, + SYS_getcwd, + SYS_chdir, + SYS_fchdir, + SYS_rename, + SYS_mkdir, + SYS_rmdir, + SYS_creat, + SYS_link, + SYS_unlink, + SYS_symlink, + SYS_readlink, + SYS_chmod, + SYS_fchmod, + SYS_chown, + SYS_fchown, + SYS_lchown, + SYS_umask, + SYS_gettimeofday, + SYS_getrlimit, + SYS_getrusage, + SYS_sysinfo, + SYS_times, + SYS_ptrace, + SYS_getuid, + SYS_syslog, + SYS_getgid, + SYS_setuid, + SYS_setgid, + SYS_geteuid, + SYS_getegid, + SYS_setpgid, + SYS_getppid, + SYS_getpgrp, + SYS_setsid, + SYS_setreuid, + SYS_setregid, + SYS_getgroups, + SYS_setgroups, + SYS_setresuid, + SYS_getresuid, + SYS_setresgid, + SYS_getresgid, + SYS_getpgid, + SYS_setfsuid, + SYS_setfsgid, + SYS_getsid, + SYS_capget, + SYS_capset, + SYS_rt_sigpending, + SYS_rt_sigtimedwait, + SYS_rt_sigqueueinfo, + SYS_rt_sigsuspend, + SYS_sigaltstack, + SYS_utime, + SYS_mknod, + SYS_uselib, + SYS_personality, + SYS_ustat, + SYS_statfs, + SYS_fstatfs, + SYS_sysfs, + SYS_getpriority, + SYS_setpriority, + SYS_sched_setparam, + SYS_sched_getparam, + SYS_sched_setscheduler, + SYS_sched_getscheduler, + SYS_sched_get_priority_max, + SYS_sched_get_priority_min, + SYS_sched_rr_get_interval, + SYS_mlock, + SYS_munlock, + SYS_mlockall, + SYS_munlockall, + SYS_vhangup, + SYS_modify_ldt, + SYS_pivot_root, + SYS__sysctl, + SYS_prctl, + SYS_arch_prctl, + SYS_adjtimex, + SYS_setrlimit, + SYS_chroot, + SYS_sync, + SYS_acct, + SYS_settimeofday, + SYS_mount, + SYS_umount2, + SYS_swapon, + SYS_swapoff, + SYS_reboot, + SYS_sethostname, + SYS_setdomainname, + SYS_iopl, + SYS_ioperm, + SYS_create_module, + SYS_init_module, + SYS_delete_module, + SYS_get_kernel_syms, + SYS_query_module, + SYS_quotactl, + SYS_nfsservctl, + SYS_getpmsg, + SYS_putpmsg, + SYS_afs_syscall, + SYS_tuxcall, + SYS_security, + SYS_gettid, + SYS_readahead, + SYS_setxattr, + SYS_lsetxattr, + SYS_fsetxattr, + SYS_getxattr, + SYS_lgetxattr, + SYS_fgetxattr, + SYS_listxattr, + SYS_llistxattr, + SYS_flistxattr, + SYS_removexattr, + SYS_lremovexattr, + SYS_fremovexattr, + SYS_tkill, + SYS_time, + SYS_futex, + SYS_sched_setaffinity, + SYS_sched_getaffinity, + SYS_set_thread_area, + SYS_io_setup, + SYS_io_destroy, + SYS_io_getevents, + SYS_io_submit, + SYS_io_cancel, + SYS_get_thread_area, + SYS_lookup_dcookie, + SYS_epoll_create, + SYS_epoll_ctl_old, + SYS_epoll_wait_old, + SYS_remap_file_pages, + SYS_getdents64, + SYS_set_tid_address, + SYS_restart_syscall, + SYS_semtimedop, + SYS_fadvise64, + SYS_timer_create, + SYS_timer_settime, + SYS_timer_gettime, + SYS_timer_getoverrun, + SYS_timer_delete, + SYS_clock_settime, + SYS_clock_gettime, + SYS_clock_getres, + SYS_clock_nanosleep, + SYS_exit_group, + SYS_epoll_wait, + SYS_epoll_ctl, + SYS_tgkill, + SYS_utimes, + SYS_vserver, + SYS_mbind, + SYS_set_mempolicy, + SYS_get_mempolicy, + SYS_mq_open, + SYS_mq_unlink, + SYS_mq_timedsend, + SYS_mq_timedreceive, + SYS_mq_notify, + SYS_mq_getsetattr, + SYS_kexec_load, + SYS_waitid, + SYS_add_key, + SYS_request_key, + SYS_keyctl, + SYS_ioprio_set, + SYS_ioprio_get, + SYS_inotify_init, + SYS_inotify_add_watch, + SYS_inotify_rm_watch, + SYS_migrate_pages, + SYS_openat, + SYS_mkdirat, + SYS_mknodat, + SYS_fchownat, + SYS_futimesat, + SYS_newfstatat, + SYS_unlinkat, + SYS_renameat, + SYS_linkat, + SYS_symlinkat, + SYS_readlinkat, + SYS_fchmodat, + SYS_faccessat, + SYS_pselect6, + SYS_ppoll, + SYS_unshare, + SYS_set_robust_list, + SYS_get_robust_list, + SYS_splice, + SYS_tee, + SYS_sync_file_range, + SYS_vmsplice, + SYS_move_pages, + SYS_utimensat, + SYS_epoll_pwait, + SYS_signalfd, + SYS_timerfd_create, + SYS_eventfd, + SYS_fallocate, + SYS_timerfd_settime, + SYS_timerfd_gettime, + SYS_accept4, + SYS_signalfd4, + SYS_eventfd2, + SYS_epoll_create1, + SYS_dup3, + SYS_pipe2, + SYS_inotify_init1, + SYS_preadv, + SYS_pwritev, + SYS_rt_tgsigqueueinfo, + SYS_perf_event_open, + SYS_recvmmsg, + SYS_fanotify_init, + SYS_fanotify_mark, + SYS_prlimit64, + SYS_name_to_handle_at, + SYS_open_by_handle_at, + SYS_clock_adjtime, + SYS_syncfs, + SYS_sendmmsg, + SYS_setns, + SYS_getcpu, + SYS_process_vm_readv, + SYS_process_vm_writev, + SYS_kcmp, + SYS_finit_module, + SYS_sched_setattr, + SYS_sched_getattr, + SYS_renameat2, + SYS_seccomp, + SYS_getrandom, + SYS_memfd_create, + SYS_kexec_file_load, + SYS_bpf, + SYS_execveat, + SYS_userfaultfd, + SYS_membarrier, + SYS_mlock2, + SYS_copy_file_range, + SYS_preadv2, + SYS_pwritev2, + SYS_pkey_mprotect, + SYS_pkey_alloc, + SYS_pkey_free, + SYS_statx, + SYS_io_pgetevents, + SYS_rseq, + SYS_pidfd_send_signal, + SYS_io_uring_setup, + SYS_io_uring_enter, + SYS_io_uring_register, + SYS_open_tree, + SYS_move_mount, + SYS_fsopen, + SYS_fsconfig, + SYS_fsmount, + SYS_fspick, + SYS_pidfd_open, + SYS_clone3, +]; +impl From for SyscallNo { + fn from(item: i32) -> Self { + if item as usize > SYSCALL_IDS.len() { + panic!("invalid syscall: {}", item) + } else { + SYSCALL_IDS[item as usize] + } + } +} diff --git a/syscalls/src/raw.rs b/reverie-syscalls/src/raw.rs similarity index 100% rename from syscalls/src/raw.rs rename to reverie-syscalls/src/raw.rs diff --git a/sysnum/Cargo.toml b/reverie-sysnum/Cargo.toml similarity index 62% rename from sysnum/Cargo.toml rename to reverie-sysnum/Cargo.toml index 28896f9..341963f 100644 --- a/sysnum/Cargo.toml +++ b/reverie-sysnum/Cargo.toml @@ -1,8 +1,12 @@ [package] -name = "sysnum" +name = "reverie-sysnum" version = "0.1.0" authors = ["Baojun Wang "] edition = "2018" +[lib] +name = "reverie_sysnum" +path = "src/lib.rs" + [dependencies] tempfile = "3.0" diff --git a/sysnum/src/lib.rs b/reverie-sysnum/src/lib.rs similarity index 100% rename from sysnum/src/lib.rs rename to reverie-sysnum/src/lib.rs diff --git a/tools_helper/Cargo.toml b/reverie-tools-helper/Cargo.toml similarity index 68% rename from tools_helper/Cargo.toml rename to reverie-tools-helper/Cargo.toml index 54d4093..22d3bcb 100644 --- a/tools_helper/Cargo.toml +++ b/reverie-tools-helper/Cargo.toml @@ -1,19 +1,19 @@ [package] -name = "tools_helper" +name = "reverie-tools-helper" version = "0.1.0" authors = ["Baojun Wang "] edition = "2018" [lib] -name = "tools_helper" +name = "reverie_tools_helper" crate-type = ["lib"] [features] std = [] [dependencies] -syscalls = { path = "../syscalls" } -common = { path = "../common" } +reverie-syscalls = { path = "../reverie-syscalls" } +reverie-common = { path = "../reverie-common" } log = { version = "0.4", default-features = false } serde = { version = "1.0", default-features = false, features = [ "derive" ] } nix = "0.13" diff --git a/tools_helper/build.rs b/reverie-tools-helper/build.rs similarity index 100% rename from tools_helper/build.rs rename to reverie-tools-helper/build.rs diff --git a/tools_helper/src/counter.rs b/reverie-tools-helper/src/counter.rs similarity index 92% rename from tools_helper/src/counter.rs rename to reverie-tools-helper/src/counter.rs index 518b9eb..35c06f4 100644 --- a/tools_helper/src/counter.rs +++ b/reverie-tools-helper/src/counter.rs @@ -2,7 +2,7 @@ use std::sync::atomic::Ordering; -use common::local_state::*; +use reverie_common::local_state::*; /// syscall events pub enum NoteInfo { diff --git a/tools_helper/src/ffi.rs b/reverie-tools-helper/src/ffi.rs similarity index 98% rename from tools_helper/src/ffi.rs rename to reverie-tools-helper/src/ffi.rs index 06c6564..564a2eb 100644 --- a/tools_helper/src/ffi.rs +++ b/reverie-tools-helper/src/ffi.rs @@ -8,10 +8,10 @@ /// cdylib is built correctly. use core::ffi::c_void; -use common::consts; -use common::local_state::*; +use reverie_common::consts; +use reverie_common::local_state::*; -use syscalls::*; +use reverie_syscalls::*; static SYSCALL_UNTRACED: u64 = 0x7000_0000; static SYSCALL_TRACED: u64 = 0x7000_0004; diff --git a/tools_helper/src/lib.rs b/reverie-tools-helper/src/lib.rs similarity index 56% rename from tools_helper/src/lib.rs rename to reverie-tools-helper/src/lib.rs index 683a5da..664ecfc 100644 --- a/tools_helper/src/lib.rs +++ b/reverie-tools-helper/src/lib.rs @@ -9,9 +9,5 @@ pub mod spinlock; pub mod counter; pub mod ffi; -pub use counter::note_syscall; -pub use counter::NoteInfo; - -pub use common; -pub use common::local_state::ProcessState; - +pub use reverie_common as common; +pub use reverie_syscalls as syscalls; diff --git a/tools_helper/src/logger.rs b/reverie-tools-helper/src/logger.rs similarity index 99% rename from tools_helper/src/logger.rs rename to reverie-tools-helper/src/logger.rs index 95e1349..43ea2a1 100644 --- a/tools_helper/src/logger.rs +++ b/reverie-tools-helper/src/logger.rs @@ -17,7 +17,7 @@ use log::{Log, Level, Metadata, Record, SetLoggerError}; use core::fmt::{Arguments, Error, Write}; -use syscalls::*; +use reverie_syscalls::*; use crate::spinlock::SpinLock; const RING_BUFF_SIZE: usize = 16384; diff --git a/tools_helper/src/raw_syscall.S b/reverie-tools-helper/src/raw_syscall.S similarity index 100% rename from tools_helper/src/raw_syscall.S rename to reverie-tools-helper/src/raw_syscall.S diff --git a/tools_helper/src/remote_call.S b/reverie-tools-helper/src/remote_call.S similarity index 100% rename from tools_helper/src/remote_call.S rename to reverie-tools-helper/src/remote_call.S diff --git a/tools_helper/src/scinfo.h b/reverie-tools-helper/src/scinfo.h similarity index 100% rename from tools_helper/src/scinfo.h rename to reverie-tools-helper/src/scinfo.h diff --git a/tools_helper/src/spinlock.rs b/reverie-tools-helper/src/spinlock.rs similarity index 98% rename from tools_helper/src/spinlock.rs rename to reverie-tools-helper/src/spinlock.rs index a9c604e..a5943fd 100644 --- a/tools_helper/src/spinlock.rs +++ b/reverie-tools-helper/src/spinlock.rs @@ -6,7 +6,7 @@ //! use core::sync::atomic::{AtomicUsize, Ordering}; -use syscalls::syscall; +use reverie_syscalls::syscall; /// spinlock struct #[derive(Default)] diff --git a/tools_helper/src/trampoline.S b/reverie-tools-helper/src/trampoline.S similarity index 100% rename from tools_helper/src/trampoline.S rename to reverie-tools-helper/src/trampoline.S diff --git a/reverie/Cargo.toml b/reverie/Cargo.toml new file mode 100644 index 0000000..e5edbab --- /dev/null +++ b/reverie/Cargo.toml @@ -0,0 +1,33 @@ +[package] +name = "reverie" +version = "0.1.0" +authors = ["Baojun Wang "] +edition = "2018" + +[lib] +name = "reverie" +path = "src/lib.rs" + +[[bin]] +name = "reverie" +path = "src/main.rs" + +[dependencies] +libc = { version = "0.2", default-features = false } +reverie-syscalls = { path = "../reverie-syscalls" } +reverie-common = { path = "../reverie-common" } +nix = "0.13" +goblin = "0.0" +procfs = "0.5" +clap = "2.32" +lazy_static = "1.3" +colored = "1.7" +chrono = "0.4" +log = "0.4" +fern = "0.5" +serde = { version = "1.0", features = [ "derive" ] } +serde_json = "1.0" + +[build-dependencies] +cc = "1.0" +reverie-sysnum = { path = "../reverie-sysnum" } diff --git a/build.rs b/reverie/build.rs similarity index 98% rename from build.rs rename to reverie/build.rs index 4538c49..95e4761 100644 --- a/build.rs +++ b/reverie/build.rs @@ -1,7 +1,7 @@ use std::fs::File; use std::io::{Result, Write}; use std::path::PathBuf; -use sysnum::gen_syscalls; +use reverie_sysnum::gen_syscalls; fn gen_syscall_nrs(dest: PathBuf) -> Result<()> { let mut f = File::create(dest)?; diff --git a/src/aux.rs b/reverie/src/aux.rs similarity index 100% rename from src/aux.rs rename to reverie/src/aux.rs diff --git a/src/auxv.rs b/reverie/src/auxv.rs similarity index 100% rename from src/auxv.rs rename to reverie/src/auxv.rs diff --git a/src/block_events.rs b/reverie/src/block_events.rs similarity index 100% rename from src/block_events.rs rename to reverie/src/block_events.rs diff --git a/src/config.rs b/reverie/src/config.rs similarity index 93% rename from src/config.rs rename to reverie/src/config.rs index 8d00b6f..a1feb4d 100644 --- a/src/config.rs +++ b/reverie/src/config.rs @@ -1,49 +1,49 @@ -use syscalls::*; +use reverie_syscalls::*; /// How should the intrumentor do its job? pub enum InstrumentMode { - /// Fully centralized tool execution inside a tracer process. - /// + /// Fully centralized tool execution inside a tracer process. + /// /// This uses ptrace to handle all events, and for all guest access/modification. FullPtrace, - /// Execute event handlers inside guest process when possible. - /// - /// In this default setting, local handlers communicate with the - /// global state object using ________, the default RPC + /// Execute event handlers inside guest process when possible. + /// + /// In this default setting, local handlers communicate with the + /// global state object using ________, the default RPC /// implementation. Global state methods run centrally in a tracer /// and they read and modify (inject) the guest processes using ptrace. InGuestDefault, - // TODO: in the future we may offer a mode for executing global methods - // in a decentralized fashion, assuming threadsafe implementations and all - // global state managed in shared pages. We're setting aside this option + // TODO: in the future we may offer a mode for executing global methods + // in a decentralized fashion, assuming threadsafe implementations and all + // global state managed in shared pages. We're setting aside this option // for the near and medium term. // // GlobalSharedState } -/// Setting to optionally interupt the guest (fire a timer) causing an event to be +/// Setting to optionally interupt the guest (fire a timer) causing an event to be /// created and handled by the tool. pub enum Heartbeat { - /// No heartbeat. Guests will only yield when they trigger a relevant event, + /// No heartbeat. Guests will only yield when they trigger a relevant event, /// not merely due to the passage of time. NoBeat, - /// Future/TODO: A maximum guest compute quantum, specified in units of - /// retired branch conditionals. This heartbeat can be used to construct + /// Future/TODO: A maximum guest compute quantum, specified in units of + /// retired branch conditionals. This heartbeat can be used to construct /// a deterministic logical clock (DLC), but it is expensive, because current /// (2019) Intel hardware does not support exact interrupts on this perf counter /// so some single-stepping is required (see RR ATC'17 paper). - /// + /// /// The boolean indicates whether other handled events "count" as heartbeats. /// If true, then the heartbeat only triggers if and when the guest exceeds /// its time slice before yielding with a syscall or some other event. ExactRBCs(u64, bool), /// Future/TODO: a nondeterministic heartbeat that is less expensive to implement. - /// This can be useful for updating ones own clock, for example (i.e. in a scenario + /// This can be useful for updating ones own clock, for example (i.e. in a scenario /// where we do not yield on heartbeats, but do publish state). ApproxCyclesRBCs(u64, bool), diff --git a/src/debug.rs b/reverie/src/debug.rs similarity index 100% rename from src/debug.rs rename to reverie/src/debug.rs diff --git a/src/hooks.rs b/reverie/src/hooks.rs similarity index 100% rename from src/hooks.rs rename to reverie/src/hooks.rs diff --git a/src/lib.rs b/reverie/src/lib.rs similarity index 93% rename from src/lib.rs rename to reverie/src/lib.rs index 56c92e0..6bf12d8 100644 --- a/src/lib.rs +++ b/reverie/src/lib.rs @@ -10,8 +10,8 @@ #[macro_use] extern crate lazy_static; -pub use syscalls; -pub use common; +pub use reverie_syscalls; +pub use reverie_common; pub mod hooks; pub mod nr; diff --git a/src/macros.rs b/reverie/src/macros.rs similarity index 100% rename from src/macros.rs rename to reverie/src/macros.rs diff --git a/src/main.rs b/reverie/src/main.rs similarity index 99% rename from src/main.rs rename to reverie/src/main.rs index 8c3156b..bc8514b 100644 --- a/src/main.rs +++ b/reverie/src/main.rs @@ -25,11 +25,11 @@ use reverie::{ns, task, hooks}; use reverie::sched::Scheduler; use reverie::sched_wait::SchedWait; use reverie::task::{RunTask, Task}; -use reverie::common::{state::*, consts}; +use reverie::reverie_common::{state::*, consts}; #[test] fn can_resolve_syscall_hooks() -> Result<()> { - let so = PathBuf::from("lib").join("libecho.so").canonicalize()?; + let so = PathBuf::from("../lib").join("libecho.so").canonicalize()?; let parsed = hooks::resolve_syscall_hooks_from(so)?; assert_ne!(parsed.len(), 0); Ok(()) diff --git a/reverie/src/nr.rs b/reverie/src/nr.rs new file mode 100644 index 0000000..f9f37a0 --- /dev/null +++ b/reverie/src/nr.rs @@ -0,0 +1,1067 @@ +// AUTOMATICALLY GENERATED BY reverie/build.rs. DO NOT EDIT. + +pub use self::SyscallNo::*; +#[allow(non_snake_case, non_camel_case_types, non_upper_case_globals)] + +#[derive(Debug, PartialEq, Eq, Clone, Copy)] +pub enum SyscallNo { + SYS_read = 0, + SYS_write = 1, + SYS_open = 2, + SYS_close = 3, + SYS_stat = 4, + SYS_fstat = 5, + SYS_lstat = 6, + SYS_poll = 7, + SYS_lseek = 8, + SYS_mmap = 9, + SYS_mprotect = 10, + SYS_munmap = 11, + SYS_brk = 12, + SYS_rt_sigaction = 13, + SYS_rt_sigprocmask = 14, + SYS_rt_sigreturn = 15, + SYS_ioctl = 16, + SYS_pread64 = 17, + SYS_pwrite64 = 18, + SYS_readv = 19, + SYS_writev = 20, + SYS_access = 21, + SYS_pipe = 22, + SYS_select = 23, + SYS_sched_yield = 24, + SYS_mremap = 25, + SYS_msync = 26, + SYS_mincore = 27, + SYS_madvise = 28, + SYS_shmget = 29, + SYS_shmat = 30, + SYS_shmctl = 31, + SYS_dup = 32, + SYS_dup2 = 33, + SYS_pause = 34, + SYS_nanosleep = 35, + SYS_getitimer = 36, + SYS_alarm = 37, + SYS_setitimer = 38, + SYS_getpid = 39, + SYS_sendfile = 40, + SYS_socket = 41, + SYS_connect = 42, + SYS_accept = 43, + SYS_sendto = 44, + SYS_recvfrom = 45, + SYS_sendmsg = 46, + SYS_recvmsg = 47, + SYS_shutdown = 48, + SYS_bind = 49, + SYS_listen = 50, + SYS_getsockname = 51, + SYS_getpeername = 52, + SYS_socketpair = 53, + SYS_setsockopt = 54, + SYS_getsockopt = 55, + SYS_clone = 56, + SYS_fork = 57, + SYS_vfork = 58, + SYS_execve = 59, + SYS_exit = 60, + SYS_wait4 = 61, + SYS_kill = 62, + SYS_uname = 63, + SYS_semget = 64, + SYS_semop = 65, + SYS_semctl = 66, + SYS_shmdt = 67, + SYS_msgget = 68, + SYS_msgsnd = 69, + SYS_msgrcv = 70, + SYS_msgctl = 71, + SYS_fcntl = 72, + SYS_flock = 73, + SYS_fsync = 74, + SYS_fdatasync = 75, + SYS_truncate = 76, + SYS_ftruncate = 77, + SYS_getdents = 78, + SYS_getcwd = 79, + SYS_chdir = 80, + SYS_fchdir = 81, + SYS_rename = 82, + SYS_mkdir = 83, + SYS_rmdir = 84, + SYS_creat = 85, + SYS_link = 86, + SYS_unlink = 87, + SYS_symlink = 88, + SYS_readlink = 89, + SYS_chmod = 90, + SYS_fchmod = 91, + SYS_chown = 92, + SYS_fchown = 93, + SYS_lchown = 94, + SYS_umask = 95, + SYS_gettimeofday = 96, + SYS_getrlimit = 97, + SYS_getrusage = 98, + SYS_sysinfo = 99, + SYS_times = 100, + SYS_ptrace = 101, + SYS_getuid = 102, + SYS_syslog = 103, + SYS_getgid = 104, + SYS_setuid = 105, + SYS_setgid = 106, + SYS_geteuid = 107, + SYS_getegid = 108, + SYS_setpgid = 109, + SYS_getppid = 110, + SYS_getpgrp = 111, + SYS_setsid = 112, + SYS_setreuid = 113, + SYS_setregid = 114, + SYS_getgroups = 115, + SYS_setgroups = 116, + SYS_setresuid = 117, + SYS_getresuid = 118, + SYS_setresgid = 119, + SYS_getresgid = 120, + SYS_getpgid = 121, + SYS_setfsuid = 122, + SYS_setfsgid = 123, + SYS_getsid = 124, + SYS_capget = 125, + SYS_capset = 126, + SYS_rt_sigpending = 127, + SYS_rt_sigtimedwait = 128, + SYS_rt_sigqueueinfo = 129, + SYS_rt_sigsuspend = 130, + SYS_sigaltstack = 131, + SYS_utime = 132, + SYS_mknod = 133, + SYS_uselib = 134, + SYS_personality = 135, + SYS_ustat = 136, + SYS_statfs = 137, + SYS_fstatfs = 138, + SYS_sysfs = 139, + SYS_getpriority = 140, + SYS_setpriority = 141, + SYS_sched_setparam = 142, + SYS_sched_getparam = 143, + SYS_sched_setscheduler = 144, + SYS_sched_getscheduler = 145, + SYS_sched_get_priority_max = 146, + SYS_sched_get_priority_min = 147, + SYS_sched_rr_get_interval = 148, + SYS_mlock = 149, + SYS_munlock = 150, + SYS_mlockall = 151, + SYS_munlockall = 152, + SYS_vhangup = 153, + SYS_modify_ldt = 154, + SYS_pivot_root = 155, + SYS__sysctl = 156, + SYS_prctl = 157, + SYS_arch_prctl = 158, + SYS_adjtimex = 159, + SYS_setrlimit = 160, + SYS_chroot = 161, + SYS_sync = 162, + SYS_acct = 163, + SYS_settimeofday = 164, + SYS_mount = 165, + SYS_umount2 = 166, + SYS_swapon = 167, + SYS_swapoff = 168, + SYS_reboot = 169, + SYS_sethostname = 170, + SYS_setdomainname = 171, + SYS_iopl = 172, + SYS_ioperm = 173, + SYS_create_module = 174, + SYS_init_module = 175, + SYS_delete_module = 176, + SYS_get_kernel_syms = 177, + SYS_query_module = 178, + SYS_quotactl = 179, + SYS_nfsservctl = 180, + SYS_getpmsg = 181, + SYS_putpmsg = 182, + SYS_afs_syscall = 183, + SYS_tuxcall = 184, + SYS_security = 185, + SYS_gettid = 186, + SYS_readahead = 187, + SYS_setxattr = 188, + SYS_lsetxattr = 189, + SYS_fsetxattr = 190, + SYS_getxattr = 191, + SYS_lgetxattr = 192, + SYS_fgetxattr = 193, + SYS_listxattr = 194, + SYS_llistxattr = 195, + SYS_flistxattr = 196, + SYS_removexattr = 197, + SYS_lremovexattr = 198, + SYS_fremovexattr = 199, + SYS_tkill = 200, + SYS_time = 201, + SYS_futex = 202, + SYS_sched_setaffinity = 203, + SYS_sched_getaffinity = 204, + SYS_set_thread_area = 205, + SYS_io_setup = 206, + SYS_io_destroy = 207, + SYS_io_getevents = 208, + SYS_io_submit = 209, + SYS_io_cancel = 210, + SYS_get_thread_area = 211, + SYS_lookup_dcookie = 212, + SYS_epoll_create = 213, + SYS_epoll_ctl_old = 214, + SYS_epoll_wait_old = 215, + SYS_remap_file_pages = 216, + SYS_getdents64 = 217, + SYS_set_tid_address = 218, + SYS_restart_syscall = 219, + SYS_semtimedop = 220, + SYS_fadvise64 = 221, + SYS_timer_create = 222, + SYS_timer_settime = 223, + SYS_timer_gettime = 224, + SYS_timer_getoverrun = 225, + SYS_timer_delete = 226, + SYS_clock_settime = 227, + SYS_clock_gettime = 228, + SYS_clock_getres = 229, + SYS_clock_nanosleep = 230, + SYS_exit_group = 231, + SYS_epoll_wait = 232, + SYS_epoll_ctl = 233, + SYS_tgkill = 234, + SYS_utimes = 235, + SYS_vserver = 236, + SYS_mbind = 237, + SYS_set_mempolicy = 238, + SYS_get_mempolicy = 239, + SYS_mq_open = 240, + SYS_mq_unlink = 241, + SYS_mq_timedsend = 242, + SYS_mq_timedreceive = 243, + SYS_mq_notify = 244, + SYS_mq_getsetattr = 245, + SYS_kexec_load = 246, + SYS_waitid = 247, + SYS_add_key = 248, + SYS_request_key = 249, + SYS_keyctl = 250, + SYS_ioprio_set = 251, + SYS_ioprio_get = 252, + SYS_inotify_init = 253, + SYS_inotify_add_watch = 254, + SYS_inotify_rm_watch = 255, + SYS_migrate_pages = 256, + SYS_openat = 257, + SYS_mkdirat = 258, + SYS_mknodat = 259, + SYS_fchownat = 260, + SYS_futimesat = 261, + SYS_newfstatat = 262, + SYS_unlinkat = 263, + SYS_renameat = 264, + SYS_linkat = 265, + SYS_symlinkat = 266, + SYS_readlinkat = 267, + SYS_fchmodat = 268, + SYS_faccessat = 269, + SYS_pselect6 = 270, + SYS_ppoll = 271, + SYS_unshare = 272, + SYS_set_robust_list = 273, + SYS_get_robust_list = 274, + SYS_splice = 275, + SYS_tee = 276, + SYS_sync_file_range = 277, + SYS_vmsplice = 278, + SYS_move_pages = 279, + SYS_utimensat = 280, + SYS_epoll_pwait = 281, + SYS_signalfd = 282, + SYS_timerfd_create = 283, + SYS_eventfd = 284, + SYS_fallocate = 285, + SYS_timerfd_settime = 286, + SYS_timerfd_gettime = 287, + SYS_accept4 = 288, + SYS_signalfd4 = 289, + SYS_eventfd2 = 290, + SYS_epoll_create1 = 291, + SYS_dup3 = 292, + SYS_pipe2 = 293, + SYS_inotify_init1 = 294, + SYS_preadv = 295, + SYS_pwritev = 296, + SYS_rt_tgsigqueueinfo = 297, + SYS_perf_event_open = 298, + SYS_recvmmsg = 299, + SYS_fanotify_init = 300, + SYS_fanotify_mark = 301, + SYS_prlimit64 = 302, + SYS_name_to_handle_at = 303, + SYS_open_by_handle_at = 304, + SYS_clock_adjtime = 305, + SYS_syncfs = 306, + SYS_sendmmsg = 307, + SYS_setns = 308, + SYS_getcpu = 309, + SYS_process_vm_readv = 310, + SYS_process_vm_writev = 311, + SYS_kcmp = 312, + SYS_finit_module = 313, + SYS_sched_setattr = 314, + SYS_sched_getattr = 315, + SYS_renameat2 = 316, + SYS_seccomp = 317, + SYS_getrandom = 318, + SYS_memfd_create = 319, + SYS_kexec_file_load = 320, + SYS_bpf = 321, + SYS_execveat = 322, + SYS_userfaultfd = 323, + SYS_membarrier = 324, + SYS_mlock2 = 325, + SYS_copy_file_range = 326, + SYS_preadv2 = 327, + SYS_pwritev2 = 328, + SYS_pkey_mprotect = 329, + SYS_pkey_alloc = 330, + SYS_pkey_free = 331, + SYS_statx = 332, + SYS_io_pgetevents = 333, + SYS_rseq = 334, + SYS_pidfd_send_signal = 424, + SYS_io_uring_setup = 425, + SYS_io_uring_enter = 426, + SYS_io_uring_register = 427, + SYS_open_tree = 428, + SYS_move_mount = 429, + SYS_fsopen = 430, + SYS_fsconfig = 431, + SYS_fsmount = 432, + SYS_fspick = 433, + SYS_pidfd_open = 434, + SYS_clone3 = 435, +} +static SYSCALL_NAMES: [&str; 347] = [ + "read", + "write", + "open", + "close", + "stat", + "fstat", + "lstat", + "poll", + "lseek", + "mmap", + "mprotect", + "munmap", + "brk", + "rt_sigaction", + "rt_sigprocmask", + "rt_sigreturn", + "ioctl", + "pread64", + "pwrite64", + "readv", + "writev", + "access", + "pipe", + "select", + "sched_yield", + "mremap", + "msync", + "mincore", + "madvise", + "shmget", + "shmat", + "shmctl", + "dup", + "dup2", + "pause", + "nanosleep", + "getitimer", + "alarm", + "setitimer", + "getpid", + "sendfile", + "socket", + "connect", + "accept", + "sendto", + "recvfrom", + "sendmsg", + "recvmsg", + "shutdown", + "bind", + "listen", + "getsockname", + "getpeername", + "socketpair", + "setsockopt", + "getsockopt", + "clone", + "fork", + "vfork", + "execve", + "exit", + "wait4", + "kill", + "uname", + "semget", + "semop", + "semctl", + "shmdt", + "msgget", + "msgsnd", + "msgrcv", + "msgctl", + "fcntl", + "flock", + "fsync", + "fdatasync", + "truncate", + "ftruncate", + "getdents", + "getcwd", + "chdir", + "fchdir", + "rename", + "mkdir", + "rmdir", + "creat", + "link", + "unlink", + "symlink", + "readlink", + "chmod", + "fchmod", + "chown", + "fchown", + "lchown", + "umask", + "gettimeofday", + "getrlimit", + "getrusage", + "sysinfo", + "times", + "ptrace", + "getuid", + "syslog", + "getgid", + "setuid", + "setgid", + "geteuid", + "getegid", + "setpgid", + "getppid", + "getpgrp", + "setsid", + "setreuid", + "setregid", + "getgroups", + "setgroups", + "setresuid", + "getresuid", + "setresgid", + "getresgid", + "getpgid", + "setfsuid", + "setfsgid", + "getsid", + "capget", + "capset", + "rt_sigpending", + "rt_sigtimedwait", + "rt_sigqueueinfo", + "rt_sigsuspend", + "sigaltstack", + "utime", + "mknod", + "uselib", + "personality", + "ustat", + "statfs", + "fstatfs", + "sysfs", + "getpriority", + "setpriority", + "sched_setparam", + "sched_getparam", + "sched_setscheduler", + "sched_getscheduler", + "sched_get_priority_max", + "sched_get_priority_min", + "sched_rr_get_interval", + "mlock", + "munlock", + "mlockall", + "munlockall", + "vhangup", + "modify_ldt", + "pivot_root", + "_sysctl", + "prctl", + "arch_prctl", + "adjtimex", + "setrlimit", + "chroot", + "sync", + "acct", + "settimeofday", + "mount", + "umount2", + "swapon", + "swapoff", + "reboot", + "sethostname", + "setdomainname", + "iopl", + "ioperm", + "create_module", + "init_module", + "delete_module", + "get_kernel_syms", + "query_module", + "quotactl", + "nfsservctl", + "getpmsg", + "putpmsg", + "afs_syscall", + "tuxcall", + "security", + "gettid", + "readahead", + "setxattr", + "lsetxattr", + "fsetxattr", + "getxattr", + "lgetxattr", + "fgetxattr", + "listxattr", + "llistxattr", + "flistxattr", + "removexattr", + "lremovexattr", + "fremovexattr", + "tkill", + "time", + "futex", + "sched_setaffinity", + "sched_getaffinity", + "set_thread_area", + "io_setup", + "io_destroy", + "io_getevents", + "io_submit", + "io_cancel", + "get_thread_area", + "lookup_dcookie", + "epoll_create", + "epoll_ctl_old", + "epoll_wait_old", + "remap_file_pages", + "getdents64", + "set_tid_address", + "restart_syscall", + "semtimedop", + "fadvise64", + "timer_create", + "timer_settime", + "timer_gettime", + "timer_getoverrun", + "timer_delete", + "clock_settime", + "clock_gettime", + "clock_getres", + "clock_nanosleep", + "exit_group", + "epoll_wait", + "epoll_ctl", + "tgkill", + "utimes", + "vserver", + "mbind", + "set_mempolicy", + "get_mempolicy", + "mq_open", + "mq_unlink", + "mq_timedsend", + "mq_timedreceive", + "mq_notify", + "mq_getsetattr", + "kexec_load", + "waitid", + "add_key", + "request_key", + "keyctl", + "ioprio_set", + "ioprio_get", + "inotify_init", + "inotify_add_watch", + "inotify_rm_watch", + "migrate_pages", + "openat", + "mkdirat", + "mknodat", + "fchownat", + "futimesat", + "newfstatat", + "unlinkat", + "renameat", + "linkat", + "symlinkat", + "readlinkat", + "fchmodat", + "faccessat", + "pselect6", + "ppoll", + "unshare", + "set_robust_list", + "get_robust_list", + "splice", + "tee", + "sync_file_range", + "vmsplice", + "move_pages", + "utimensat", + "epoll_pwait", + "signalfd", + "timerfd_create", + "eventfd", + "fallocate", + "timerfd_settime", + "timerfd_gettime", + "accept4", + "signalfd4", + "eventfd2", + "epoll_create1", + "dup3", + "pipe2", + "inotify_init1", + "preadv", + "pwritev", + "rt_tgsigqueueinfo", + "perf_event_open", + "recvmmsg", + "fanotify_init", + "fanotify_mark", + "prlimit64", + "name_to_handle_at", + "open_by_handle_at", + "clock_adjtime", + "syncfs", + "sendmmsg", + "setns", + "getcpu", + "process_vm_readv", + "process_vm_writev", + "kcmp", + "finit_module", + "sched_setattr", + "sched_getattr", + "renameat2", + "seccomp", + "getrandom", + "memfd_create", + "kexec_file_load", + "bpf", + "execveat", + "userfaultfd", + "membarrier", + "mlock2", + "copy_file_range", + "preadv2", + "pwritev2", + "pkey_mprotect", + "pkey_alloc", + "pkey_free", + "statx", + "io_pgetevents", + "rseq", + "pidfd_send_signal", + "io_uring_setup", + "io_uring_enter", + "io_uring_register", + "open_tree", + "move_mount", + "fsopen", + "fsconfig", + "fsmount", + "fspick", + "pidfd_open", + "clone3", +]; +impl ToString for SyscallNo { + fn to_string(&self) -> String { + SYSCALL_NAMES[*self as usize].to_string() + } +} +static SYSCALL_IDS: [SyscallNo; 347] = [ + SYS_read, + SYS_write, + SYS_open, + SYS_close, + SYS_stat, + SYS_fstat, + SYS_lstat, + SYS_poll, + SYS_lseek, + SYS_mmap, + SYS_mprotect, + SYS_munmap, + SYS_brk, + SYS_rt_sigaction, + SYS_rt_sigprocmask, + SYS_rt_sigreturn, + SYS_ioctl, + SYS_pread64, + SYS_pwrite64, + SYS_readv, + SYS_writev, + SYS_access, + SYS_pipe, + SYS_select, + SYS_sched_yield, + SYS_mremap, + SYS_msync, + SYS_mincore, + SYS_madvise, + SYS_shmget, + SYS_shmat, + SYS_shmctl, + SYS_dup, + SYS_dup2, + SYS_pause, + SYS_nanosleep, + SYS_getitimer, + SYS_alarm, + SYS_setitimer, + SYS_getpid, + SYS_sendfile, + SYS_socket, + SYS_connect, + SYS_accept, + SYS_sendto, + SYS_recvfrom, + SYS_sendmsg, + SYS_recvmsg, + SYS_shutdown, + SYS_bind, + SYS_listen, + SYS_getsockname, + SYS_getpeername, + SYS_socketpair, + SYS_setsockopt, + SYS_getsockopt, + SYS_clone, + SYS_fork, + SYS_vfork, + SYS_execve, + SYS_exit, + SYS_wait4, + SYS_kill, + SYS_uname, + SYS_semget, + SYS_semop, + SYS_semctl, + SYS_shmdt, + SYS_msgget, + SYS_msgsnd, + SYS_msgrcv, + SYS_msgctl, + SYS_fcntl, + SYS_flock, + SYS_fsync, + SYS_fdatasync, + SYS_truncate, + SYS_ftruncate, + SYS_getdents, + SYS_getcwd, + SYS_chdir, + SYS_fchdir, + SYS_rename, + SYS_mkdir, + SYS_rmdir, + SYS_creat, + SYS_link, + SYS_unlink, + SYS_symlink, + SYS_readlink, + SYS_chmod, + SYS_fchmod, + SYS_chown, + SYS_fchown, + SYS_lchown, + SYS_umask, + SYS_gettimeofday, + SYS_getrlimit, + SYS_getrusage, + SYS_sysinfo, + SYS_times, + SYS_ptrace, + SYS_getuid, + SYS_syslog, + SYS_getgid, + SYS_setuid, + SYS_setgid, + SYS_geteuid, + SYS_getegid, + SYS_setpgid, + SYS_getppid, + SYS_getpgrp, + SYS_setsid, + SYS_setreuid, + SYS_setregid, + SYS_getgroups, + SYS_setgroups, + SYS_setresuid, + SYS_getresuid, + SYS_setresgid, + SYS_getresgid, + SYS_getpgid, + SYS_setfsuid, + SYS_setfsgid, + SYS_getsid, + SYS_capget, + SYS_capset, + SYS_rt_sigpending, + SYS_rt_sigtimedwait, + SYS_rt_sigqueueinfo, + SYS_rt_sigsuspend, + SYS_sigaltstack, + SYS_utime, + SYS_mknod, + SYS_uselib, + SYS_personality, + SYS_ustat, + SYS_statfs, + SYS_fstatfs, + SYS_sysfs, + SYS_getpriority, + SYS_setpriority, + SYS_sched_setparam, + SYS_sched_getparam, + SYS_sched_setscheduler, + SYS_sched_getscheduler, + SYS_sched_get_priority_max, + SYS_sched_get_priority_min, + SYS_sched_rr_get_interval, + SYS_mlock, + SYS_munlock, + SYS_mlockall, + SYS_munlockall, + SYS_vhangup, + SYS_modify_ldt, + SYS_pivot_root, + SYS__sysctl, + SYS_prctl, + SYS_arch_prctl, + SYS_adjtimex, + SYS_setrlimit, + SYS_chroot, + SYS_sync, + SYS_acct, + SYS_settimeofday, + SYS_mount, + SYS_umount2, + SYS_swapon, + SYS_swapoff, + SYS_reboot, + SYS_sethostname, + SYS_setdomainname, + SYS_iopl, + SYS_ioperm, + SYS_create_module, + SYS_init_module, + SYS_delete_module, + SYS_get_kernel_syms, + SYS_query_module, + SYS_quotactl, + SYS_nfsservctl, + SYS_getpmsg, + SYS_putpmsg, + SYS_afs_syscall, + SYS_tuxcall, + SYS_security, + SYS_gettid, + SYS_readahead, + SYS_setxattr, + SYS_lsetxattr, + SYS_fsetxattr, + SYS_getxattr, + SYS_lgetxattr, + SYS_fgetxattr, + SYS_listxattr, + SYS_llistxattr, + SYS_flistxattr, + SYS_removexattr, + SYS_lremovexattr, + SYS_fremovexattr, + SYS_tkill, + SYS_time, + SYS_futex, + SYS_sched_setaffinity, + SYS_sched_getaffinity, + SYS_set_thread_area, + SYS_io_setup, + SYS_io_destroy, + SYS_io_getevents, + SYS_io_submit, + SYS_io_cancel, + SYS_get_thread_area, + SYS_lookup_dcookie, + SYS_epoll_create, + SYS_epoll_ctl_old, + SYS_epoll_wait_old, + SYS_remap_file_pages, + SYS_getdents64, + SYS_set_tid_address, + SYS_restart_syscall, + SYS_semtimedop, + SYS_fadvise64, + SYS_timer_create, + SYS_timer_settime, + SYS_timer_gettime, + SYS_timer_getoverrun, + SYS_timer_delete, + SYS_clock_settime, + SYS_clock_gettime, + SYS_clock_getres, + SYS_clock_nanosleep, + SYS_exit_group, + SYS_epoll_wait, + SYS_epoll_ctl, + SYS_tgkill, + SYS_utimes, + SYS_vserver, + SYS_mbind, + SYS_set_mempolicy, + SYS_get_mempolicy, + SYS_mq_open, + SYS_mq_unlink, + SYS_mq_timedsend, + SYS_mq_timedreceive, + SYS_mq_notify, + SYS_mq_getsetattr, + SYS_kexec_load, + SYS_waitid, + SYS_add_key, + SYS_request_key, + SYS_keyctl, + SYS_ioprio_set, + SYS_ioprio_get, + SYS_inotify_init, + SYS_inotify_add_watch, + SYS_inotify_rm_watch, + SYS_migrate_pages, + SYS_openat, + SYS_mkdirat, + SYS_mknodat, + SYS_fchownat, + SYS_futimesat, + SYS_newfstatat, + SYS_unlinkat, + SYS_renameat, + SYS_linkat, + SYS_symlinkat, + SYS_readlinkat, + SYS_fchmodat, + SYS_faccessat, + SYS_pselect6, + SYS_ppoll, + SYS_unshare, + SYS_set_robust_list, + SYS_get_robust_list, + SYS_splice, + SYS_tee, + SYS_sync_file_range, + SYS_vmsplice, + SYS_move_pages, + SYS_utimensat, + SYS_epoll_pwait, + SYS_signalfd, + SYS_timerfd_create, + SYS_eventfd, + SYS_fallocate, + SYS_timerfd_settime, + SYS_timerfd_gettime, + SYS_accept4, + SYS_signalfd4, + SYS_eventfd2, + SYS_epoll_create1, + SYS_dup3, + SYS_pipe2, + SYS_inotify_init1, + SYS_preadv, + SYS_pwritev, + SYS_rt_tgsigqueueinfo, + SYS_perf_event_open, + SYS_recvmmsg, + SYS_fanotify_init, + SYS_fanotify_mark, + SYS_prlimit64, + SYS_name_to_handle_at, + SYS_open_by_handle_at, + SYS_clock_adjtime, + SYS_syncfs, + SYS_sendmmsg, + SYS_setns, + SYS_getcpu, + SYS_process_vm_readv, + SYS_process_vm_writev, + SYS_kcmp, + SYS_finit_module, + SYS_sched_setattr, + SYS_sched_getattr, + SYS_renameat2, + SYS_seccomp, + SYS_getrandom, + SYS_memfd_create, + SYS_kexec_file_load, + SYS_bpf, + SYS_execveat, + SYS_userfaultfd, + SYS_membarrier, + SYS_mlock2, + SYS_copy_file_range, + SYS_preadv2, + SYS_pwritev2, + SYS_pkey_mprotect, + SYS_pkey_alloc, + SYS_pkey_free, + SYS_statx, + SYS_io_pgetevents, + SYS_rseq, + SYS_pidfd_send_signal, + SYS_io_uring_setup, + SYS_io_uring_enter, + SYS_io_uring_register, + SYS_open_tree, + SYS_move_mount, + SYS_fsopen, + SYS_fsconfig, + SYS_fsmount, + SYS_fspick, + SYS_pidfd_open, + SYS_clone3, +]; +impl From for SyscallNo { + fn from(item: i32) -> Self { + if item as usize > SYSCALL_IDS.len() { + panic!("invalid syscall: {}", item) + } else { + SYSCALL_IDS[item as usize] + } + } +} diff --git a/src/ns.rs b/reverie/src/ns.rs similarity index 100% rename from src/ns.rs rename to reverie/src/ns.rs diff --git a/src/remote.rs b/reverie/src/remote.rs similarity index 99% rename from src/remote.rs rename to reverie/src/remote.rs index d329a69..d6c277f 100644 --- a/src/remote.rs +++ b/reverie/src/remote.rs @@ -11,8 +11,8 @@ use std::io::{Error, ErrorKind, Result}; use std::path::PathBuf; use std::ptr::NonNull; -use common::consts; -use common::consts::*; +use reverie_common::consts; +use reverie_common::consts::*; use crate::hooks; use crate::nr; diff --git a/src/remote_rwlock.rs b/reverie/src/remote_rwlock.rs similarity index 100% rename from src/remote_rwlock.rs rename to reverie/src/remote_rwlock.rs diff --git a/src/rpc_ptrace.rs b/reverie/src/rpc_ptrace.rs similarity index 98% rename from src/rpc_ptrace.rs rename to reverie/src/rpc_ptrace.rs index ba35995..4d1a550 100644 --- a/src/rpc_ptrace.rs +++ b/reverie/src/rpc_ptrace.rs @@ -6,7 +6,7 @@ //! NB: the tracee must be in a ptrace stop //! -use common::consts; +use reverie_common::consts; use crate::remote::*; use crate::task::Task; diff --git a/src/sched.rs b/reverie/src/sched.rs similarity index 93% rename from src/sched.rs rename to reverie/src/sched.rs index bc48849..c5e5764 100644 --- a/src/sched.rs +++ b/reverie/src/sched.rs @@ -8,7 +8,7 @@ use std::io::{Error, ErrorKind, Result}; use crate::remote::*; use crate::task::Task; -use common::state::ReverieState; +use reverie_common::state::ReverieState; pub trait Scheduler { fn new() -> Self diff --git a/src/sched_wait.rs b/reverie/src/sched_wait.rs similarity index 99% rename from src/sched_wait.rs rename to reverie/src/sched_wait.rs index 58118fd..3120f1a 100644 --- a/src/sched_wait.rs +++ b/reverie/src/sched_wait.rs @@ -11,8 +11,8 @@ use std::sync::atomic::{Ordering, AtomicUsize}; use procfs; -use common::consts; -use common::state::ReverieState; +use reverie_common::consts; +use reverie_common::state::ReverieState; use crate::nr::*; use crate::remote; diff --git a/src/stubs.rs b/reverie/src/stubs.rs similarity index 98% rename from src/stubs.rs rename to reverie/src/stubs.rs index 9945d74..2b1a694 100644 --- a/src/stubs.rs +++ b/reverie/src/stubs.rs @@ -5,7 +5,7 @@ use std::fs::File; use std::io::{Error, ErrorKind, Result, Write}; use std::path::PathBuf; -use common::consts; +use reverie_common::consts; use crate::hooks; diff --git a/src/task.rs b/reverie/src/task.rs similarity index 95% rename from src/task.rs rename to reverie/src/task.rs index 5ff096e..5234820 100644 --- a/src/task.rs +++ b/reverie/src/task.rs @@ -8,8 +8,8 @@ use std::io::{Error, ErrorKind, Result}; use std::path::PathBuf; use std::ptr::NonNull; -use common::consts; -use common::consts::*; +use reverie_common::consts; +use reverie_common::consts::*; use crate::hooks; use crate::nr; diff --git a/src/traced_task.rs b/reverie/src/traced_task.rs similarity index 99% rename from src/traced_task.rs rename to reverie/src/traced_task.rs index 5640887..78ce5b4 100644 --- a/src/traced_task.rs +++ b/reverie/src/traced_task.rs @@ -36,10 +36,10 @@ use std::ffi::c_void; use std::fs::File; use goblin::elf::Elf; -use common::state::*; -use common::local_state::*; -use common::consts; -use common::consts::*; +use reverie_common::state::*; +use reverie_common::local_state::*; +use reverie_common::consts; +use reverie_common::consts::*; use crate::hooks; use crate::nr::*; diff --git a/src/vdso.rs b/reverie/src/vdso.rs similarity index 100% rename from src/vdso.rs rename to reverie/src/vdso.rs From e79722c0c2bc2045137495e1dd408422604e27fd Mon Sep 17 00:00:00 2001 From: Logan Wendholt Date: Tue, 27 Aug 2019 17:13:49 -0400 Subject: [PATCH 8/8] Rename subcrates --- Cargo.lock | 82 +- Cargo.toml | 4 +- examples/counter/Cargo.toml | 2 +- examples/counter/src/lib.rs | 2 +- examples/det/Cargo.toml | 2 +- examples/det/src/lib.rs | 2 +- examples/echo/Cargo.toml | 2 +- examples/echo/src/dpc.rs | 2 +- examples/echo/src/entry.rs | 10 +- examples/echo/src/lib.rs | 2 +- examples/echo/src/show/args.rs | 2 +- examples/echo/src/show/types.rs | 2 +- examples/none/Cargo.toml | 2 +- examples/none/src/lib.rs | 2 +- reverie-common/src/lib.rs | 3 +- .../Cargo.toml | 6 +- .../build.rs | 0 .../src/counter.rs | 0 .../src/ffi.rs | 2 +- .../src/lib.rs | 2 +- .../src/logger.rs | 2 +- .../src/raw_syscall.S | 0 .../src/remote_call.S | 0 .../src/scinfo.h | 0 .../src/spinlock.rs | 2 +- .../src/trampoline.S | 0 reverie-preloader/Cargo.toml | 2 +- reverie-preloader/src/lib.rs | 2 +- reverie-syscalls/src/nr.rs | 1068 ----------------- reverie/Cargo.toml | 4 +- reverie/build.rs | 2 +- reverie/src/config.rs | 2 +- reverie/src/lib.rs | 2 +- {reverie-syscalls => syscalls}/Cargo.toml | 6 +- {reverie-syscalls => syscalls}/build.rs | 2 +- {reverie-syscalls => syscalls}/src/helper.rs | 0 {reverie-syscalls => syscalls}/src/lib.rs | 0 {reverie-syscalls => syscalls}/src/macros.rs | 0 {reverie-syscalls => syscalls}/src/raw.rs | 0 {reverie-sysnum => sysnum}/Cargo.toml | 4 +- {reverie-sysnum => sysnum}/src/lib.rs | 0 41 files changed, 80 insertions(+), 1149 deletions(-) rename {reverie-tools-helper => reverie-helper}/Cargo.toml (78%) rename {reverie-tools-helper => reverie-helper}/build.rs (100%) rename {reverie-tools-helper => reverie-helper}/src/counter.rs (100%) rename {reverie-tools-helper => reverie-helper}/src/ffi.rs (99%) rename {reverie-tools-helper => reverie-helper}/src/lib.rs (83%) rename {reverie-tools-helper => reverie-helper}/src/logger.rs (99%) rename {reverie-tools-helper => reverie-helper}/src/raw_syscall.S (100%) rename {reverie-tools-helper => reverie-helper}/src/remote_call.S (100%) rename {reverie-tools-helper => reverie-helper}/src/scinfo.h (100%) rename {reverie-tools-helper => reverie-helper}/src/spinlock.rs (98%) rename {reverie-tools-helper => reverie-helper}/src/trampoline.S (100%) delete mode 100644 reverie-syscalls/src/nr.rs rename {reverie-syscalls => syscalls}/Cargo.toml (60%) rename {reverie-syscalls => syscalls}/build.rs (98%) rename {reverie-syscalls => syscalls}/src/helper.rs (100%) rename {reverie-syscalls => syscalls}/src/lib.rs (100%) rename {reverie-syscalls => syscalls}/src/macros.rs (100%) rename {reverie-syscalls => syscalls}/src/raw.rs (100%) rename {reverie-sysnum => sysnum}/Cargo.toml (75%) rename {reverie-sysnum => sysnum}/src/lib.rs (100%) diff --git a/Cargo.lock b/Cargo.lock index 7ebc668..9a66264 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -53,7 +53,7 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.40" +version = "1.0.41" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -109,9 +109,9 @@ dependencies = [ name = "counter" version = "0.1.0" dependencies = [ - "cc 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "reverie-tools-helper 0.1.0", + "reverie-helper 0.1.0", "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -127,10 +127,10 @@ dependencies = [ name = "det" version = "0.1.0" dependencies = [ - "cc 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "reverie-tools-helper 0.1.0", + "reverie-helper 0.1.0", "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -138,11 +138,11 @@ dependencies = [ name = "echo" version = "0.1.0" dependencies = [ - "cc 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "reverie-tools-helper 0.1.0", + "reverie-helper 0.1.0", "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -225,7 +225,7 @@ version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cc 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -237,7 +237,7 @@ version = "0.14.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cc 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -247,8 +247,8 @@ dependencies = [ name = "none" version = "0.1.0" dependencies = [ - "cc 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", - "reverie-tools-helper 0.1.0", + "cc 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)", + "reverie-helper 0.1.0", "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -421,7 +421,7 @@ dependencies = [ name = "reverie" version = "0.1.0" dependencies = [ - "cc 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)", "chrono 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", "clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)", "colored 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -433,10 +433,10 @@ dependencies = [ "nix 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", "procfs 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", "reverie-common 0.1.0", - "reverie-syscalls 0.1.0", - "reverie-sysnum 0.1.0", "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", + "syscalls 0.1.0", + "sysnum 0.1.0", ] [[package]] @@ -448,42 +448,28 @@ dependencies = [ ] [[package]] -name = "reverie-preloader" +name = "reverie-helper" version = "0.1.0" dependencies = [ - "cc 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", - "nix 0.14.1 (registry+https://github.com/rust-lang/crates.io-index)", - "procfs 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "nix 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", "reverie-common 0.1.0", - "reverie-syscalls 0.1.0", -] - -[[package]] -name = "reverie-syscalls" -version = "0.1.0" -dependencies = [ - "reverie-sysnum 0.1.0", -] - -[[package]] -name = "reverie-sysnum" -version = "0.1.0" -dependencies = [ + "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", + "syscalls 0.1.0", "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "reverie-tools-helper" +name = "reverie-preloader" version = "0.1.0" dependencies = [ - "cc 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "nix 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", + "nix 0.14.1 (registry+https://github.com/rust-lang/crates.io-index)", + "procfs 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", "reverie-common 0.1.0", - "reverie-syscalls 0.1.0", - "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", - "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "syscalls 0.1.0", ] [[package]] @@ -594,6 +580,20 @@ dependencies = [ "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "syscalls" +version = "0.1.0" +dependencies = [ + "sysnum 0.1.0", +] + +[[package]] +name = "sysnum" +version = "0.1.0" +dependencies = [ + "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "take_mut" version = "0.2.2" @@ -699,7 +699,7 @@ dependencies = [ "checksum bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3d155346769a6855b86399e9bc3814ab343cd3d62c7e985113d46a0ec3c281fd" "checksum byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a7c3dd8985a7111efc5c80b44e23ecdd8c007de8ade3b96595387e812b957cf5" "checksum c2-chacha 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7d64d04786e0f528460fc884753cf8dddcc466be308f6026f8e355c41a0e4101" -"checksum cc 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)" = "b548a4ee81fccb95919d4e22cfea83c7693ebfd78f0495493178db20b3139da7" +"checksum cc 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)" = "8dae9c4b8fedcae85592ba623c4fd08cfdab3e3b72d6df780c6ead964a69bfff" "checksum cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "b486ce3ccf7ffd79fdeb678eac06a9e6c09fc88d33836340becb8fffe87c5e33" "checksum cgmath 0.16.1 (registry+https://github.com/rust-lang/crates.io-index)" = "64a4b57c8f4e3a2e9ac07e0f6abc9c24b6fc9e1b54c3478cfb598f3d0023e51c" "checksum chrono 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)" = "77d81f58b7301084de3b958691458a53c3f7e0b1d702f77e550b6a88e3a88abe" diff --git a/Cargo.toml b/Cargo.toml index e33e231..e2137ce 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,3 +1,3 @@ [workspace] -members= ["reverie", "reverie-syscalls", "reverie-tools-helper", "reverie-common", "reverie-preloader", "examples/none", "examples/echo", "examples/counter", "examples/det" ] -default-members = ["reverie", "reverie-syscalls", "reverie-common", "reverie-preloader" ] +members= ["reverie", "syscalls", "reverie-helper", "reverie-common", "reverie-preloader", "examples/none", "examples/echo", "examples/counter", "examples/det" ] +default-members = ["reverie", "syscalls", "reverie-common", "reverie-preloader" ] diff --git a/examples/counter/Cargo.toml b/examples/counter/Cargo.toml index 5fef11b..aaaf350 100644 --- a/examples/counter/Cargo.toml +++ b/examples/counter/Cargo.toml @@ -10,7 +10,7 @@ crate-type = ["cdylib"] path = "src/lib.rs" [dependencies] -reverie-tools-helper = { path = "../../reverie-tools-helper" } +reverie-helper = { path = "../../reverie-helper" } log = { version = "0.4", default-features = false } [build-dependencies] diff --git a/examples/counter/src/lib.rs b/examples/counter/src/lib.rs index 5207c45..2f71ed2 100644 --- a/examples/counter/src/lib.rs +++ b/examples/counter/src/lib.rs @@ -6,7 +6,7 @@ #[allow(unused_imports)] use std::ffi::CStr; -use reverie_tools_helper::{ syscalls::*, counter::*, common::local_state::ProcessState, logger }; +use reverie_helper::{ syscalls::*, counter::*, common::local_state::ProcessState, logger }; #[cfg_attr(target_os = "linux", link_section = ".ctors")] #[used] diff --git a/examples/det/Cargo.toml b/examples/det/Cargo.toml index 74ef4f7..9cb43fb 100644 --- a/examples/det/Cargo.toml +++ b/examples/det/Cargo.toml @@ -10,7 +10,7 @@ crate-type = ["cdylib"] path = "src/lib.rs" [dependencies] -reverie-tools-helper = { path = "../../reverie-tools-helper" } +reverie-helper = { path = "../../reverie-helper" } log = { version = "0.4", default-features = false } libc = { version = "0.2", default-features = false } diff --git a/examples/det/src/lib.rs b/examples/det/src/lib.rs index 62d1312..082096c 100644 --- a/examples/det/src/lib.rs +++ b/examples/det/src/lib.rs @@ -2,7 +2,7 @@ #![allow(unused_imports)] #![allow(unused_attributes)] -use reverie_tools_helper::{syscalls::*, counter::*, common::local_state::ProcessState, logger}; +use reverie_helper::{syscalls::*, counter::*, common::local_state::ProcessState, logger}; use log::*; #[allow(unused_imports)] diff --git a/examples/echo/Cargo.toml b/examples/echo/Cargo.toml index f65b769..9a2b56a 100644 --- a/examples/echo/Cargo.toml +++ b/examples/echo/Cargo.toml @@ -10,7 +10,7 @@ crate-type = ["cdylib"] path = "src/lib.rs" [dependencies] -reverie-tools-helper = { path = "../../reverie-tools-helper" } +reverie-helper = { path = "../../reverie-helper" } log = { version = "0.4", default-features = false } serde = { version = "1.0", default-features = false, features = [ "derive" ] } libc = { version = "0.2", default-features = false, features = [] } diff --git a/examples/echo/src/dpc.rs b/examples/echo/src/dpc.rs index e2a51f8..cb943db 100644 --- a/examples/echo/src/dpc.rs +++ b/examples/echo/src/dpc.rs @@ -1,7 +1,7 @@ //! deferred precedure calls //! -use reverie_tools_helper::{ common::consts, syscalls::syscall, logger} ; +use reverie_helper::{ common::consts, syscalls::syscall, logger} ; use log::debug; const DPC_PREFIX: &'static str = "/tmp/dpc-task."; diff --git a/examples/echo/src/entry.rs b/examples/echo/src/entry.rs index 1064184..ea92f19 100644 --- a/examples/echo/src/entry.rs +++ b/examples/echo/src/entry.rs @@ -2,12 +2,12 @@ //! use crate::show::*; -use reverie_tools_helper::syscalls::*; -use reverie_tools_helper::counter::{note_syscall, NoteInfo}; -use reverie_tools_helper::common::local_state::{ProcessState, ThreadState}; +use reverie_helper::syscalls::*; +use reverie_helper::counter::{note_syscall, NoteInfo}; +use reverie_helper::common::local_state::{ProcessState, ThreadState}; -use reverie_tools_helper::logger::*; -use reverie_tools_helper::*; +use reverie_helper::logger::*; +use reverie_helper::*; #[macro_export(smsg)] macro_rules! smsg { diff --git a/examples/echo/src/lib.rs b/examples/echo/src/lib.rs index c8c7169..943db2c 100644 --- a/examples/echo/src/lib.rs +++ b/examples/echo/src/lib.rs @@ -1,7 +1,7 @@ #![feature(format_args_nl, slice_internals)] #![allow(unused_attributes)] -use reverie_tools_helper::{counter, common, logger}; +use reverie_helper::{counter, common, logger}; #[macro_use] pub mod macros; diff --git a/examples/echo/src/show/args.rs b/examples/echo/src/show/args.rs index 77256a9..f7a33ab 100644 --- a/examples/echo/src/show/args.rs +++ b/examples/echo/src/show/args.rs @@ -1,5 +1,5 @@ //! pretty print syscalls -use reverie_tools_helper::syscalls::*; +use reverie_helper::syscalls::*; use core::fmt; use core::fmt::Display; use core::ptr::NonNull; diff --git a/examples/echo/src/show/types.rs b/examples/echo/src/show/types.rs index 2a215f4..509e60c 100644 --- a/examples/echo/src/show/types.rs +++ b/examples/echo/src/show/types.rs @@ -1,7 +1,7 @@ use core::ptr::NonNull; use core::ffi::c_void as void; -use reverie_tools_helper::syscalls::SyscallNo; +use reverie_helper::syscalls::SyscallNo; /// syscall return vaules for formatting purpose #[derive(Clone, Copy)] diff --git a/examples/none/Cargo.toml b/examples/none/Cargo.toml index f3ffea8..ef7fdbe 100644 --- a/examples/none/Cargo.toml +++ b/examples/none/Cargo.toml @@ -10,7 +10,7 @@ crate-type = ["cdylib"] path = "src/lib.rs" [dependencies] -reverie-tools-helper = { path = "../../reverie-tools-helper" } +reverie-helper = { path = "../../reverie-helper" } serde = { version = "1.0", default-features = false, features = [ "derive" ] } [build-dependencies] diff --git a/examples/none/src/lib.rs b/examples/none/src/lib.rs index 584b3b5..bdac610 100644 --- a/examples/none/src/lib.rs +++ b/examples/none/src/lib.rs @@ -1,7 +1,7 @@ #![allow(unused_imports)] #![allow(unused_attributes)] -use reverie_tools_helper::{ syscalls::*, common::local_state::ProcessState }; +use reverie_helper::{ syscalls::*, common::local_state::ProcessState }; #[no_mangle] pub extern "C" fn captured_syscall( diff --git a/reverie-common/src/lib.rs b/reverie-common/src/lib.rs index edd4923..b14e520 100644 --- a/reverie-common/src/lib.rs +++ b/reverie-common/src/lib.rs @@ -1,4 +1,4 @@ -//! reverie tools helper +//! reverie common //! #![feature(format_args_nl, slice_internals)] @@ -10,4 +10,3 @@ pub mod consts; pub mod state; pub mod local_state; pub mod profiling; - diff --git a/reverie-tools-helper/Cargo.toml b/reverie-helper/Cargo.toml similarity index 78% rename from reverie-tools-helper/Cargo.toml rename to reverie-helper/Cargo.toml index 22d3bcb..003da01 100644 --- a/reverie-tools-helper/Cargo.toml +++ b/reverie-helper/Cargo.toml @@ -1,18 +1,18 @@ [package] -name = "reverie-tools-helper" +name = "reverie-helper" version = "0.1.0" authors = ["Baojun Wang "] edition = "2018" [lib] -name = "reverie_tools_helper" +name = "reverie_helper" crate-type = ["lib"] [features] std = [] [dependencies] -reverie-syscalls = { path = "../reverie-syscalls" } +syscalls = { path = "../syscalls" } reverie-common = { path = "../reverie-common" } log = { version = "0.4", default-features = false } serde = { version = "1.0", default-features = false, features = [ "derive" ] } diff --git a/reverie-tools-helper/build.rs b/reverie-helper/build.rs similarity index 100% rename from reverie-tools-helper/build.rs rename to reverie-helper/build.rs diff --git a/reverie-tools-helper/src/counter.rs b/reverie-helper/src/counter.rs similarity index 100% rename from reverie-tools-helper/src/counter.rs rename to reverie-helper/src/counter.rs diff --git a/reverie-tools-helper/src/ffi.rs b/reverie-helper/src/ffi.rs similarity index 99% rename from reverie-tools-helper/src/ffi.rs rename to reverie-helper/src/ffi.rs index 564a2eb..98f46ab 100644 --- a/reverie-tools-helper/src/ffi.rs +++ b/reverie-helper/src/ffi.rs @@ -11,7 +11,7 @@ use core::ffi::c_void; use reverie_common::consts; use reverie_common::local_state::*; -use reverie_syscalls::*; +use syscalls::*; static SYSCALL_UNTRACED: u64 = 0x7000_0000; static SYSCALL_TRACED: u64 = 0x7000_0004; diff --git a/reverie-tools-helper/src/lib.rs b/reverie-helper/src/lib.rs similarity index 83% rename from reverie-tools-helper/src/lib.rs rename to reverie-helper/src/lib.rs index 664ecfc..9f2ca7f 100644 --- a/reverie-tools-helper/src/lib.rs +++ b/reverie-helper/src/lib.rs @@ -10,4 +10,4 @@ pub mod counter; pub mod ffi; pub use reverie_common as common; -pub use reverie_syscalls as syscalls; +pub use syscalls; diff --git a/reverie-tools-helper/src/logger.rs b/reverie-helper/src/logger.rs similarity index 99% rename from reverie-tools-helper/src/logger.rs rename to reverie-helper/src/logger.rs index 43ea2a1..95e1349 100644 --- a/reverie-tools-helper/src/logger.rs +++ b/reverie-helper/src/logger.rs @@ -17,7 +17,7 @@ use log::{Log, Level, Metadata, Record, SetLoggerError}; use core::fmt::{Arguments, Error, Write}; -use reverie_syscalls::*; +use syscalls::*; use crate::spinlock::SpinLock; const RING_BUFF_SIZE: usize = 16384; diff --git a/reverie-tools-helper/src/raw_syscall.S b/reverie-helper/src/raw_syscall.S similarity index 100% rename from reverie-tools-helper/src/raw_syscall.S rename to reverie-helper/src/raw_syscall.S diff --git a/reverie-tools-helper/src/remote_call.S b/reverie-helper/src/remote_call.S similarity index 100% rename from reverie-tools-helper/src/remote_call.S rename to reverie-helper/src/remote_call.S diff --git a/reverie-tools-helper/src/scinfo.h b/reverie-helper/src/scinfo.h similarity index 100% rename from reverie-tools-helper/src/scinfo.h rename to reverie-helper/src/scinfo.h diff --git a/reverie-tools-helper/src/spinlock.rs b/reverie-helper/src/spinlock.rs similarity index 98% rename from reverie-tools-helper/src/spinlock.rs rename to reverie-helper/src/spinlock.rs index a5943fd..a9c604e 100644 --- a/reverie-tools-helper/src/spinlock.rs +++ b/reverie-helper/src/spinlock.rs @@ -6,7 +6,7 @@ //! use core::sync::atomic::{AtomicUsize, Ordering}; -use reverie_syscalls::syscall; +use syscalls::syscall; /// spinlock struct #[derive(Default)] diff --git a/reverie-tools-helper/src/trampoline.S b/reverie-helper/src/trampoline.S similarity index 100% rename from reverie-tools-helper/src/trampoline.S rename to reverie-helper/src/trampoline.S diff --git a/reverie-preloader/Cargo.toml b/reverie-preloader/Cargo.toml index c5a2014..6f8204a 100644 --- a/reverie-preloader/Cargo.toml +++ b/reverie-preloader/Cargo.toml @@ -12,7 +12,7 @@ crate-type = ["cdylib"] path = "src/lib.rs" [dependencies] -reverie-syscalls = { path = "../reverie-syscalls" } +syscalls = { path = "../syscalls" } reverie-common = { path = "../reverie-common" } procfs = "0.5" nix = "0.14" diff --git a/reverie-preloader/src/lib.rs b/reverie-preloader/src/lib.rs index 3d0b6c0..d7e7f75 100644 --- a/reverie-preloader/src/lib.rs +++ b/reverie-preloader/src/lib.rs @@ -5,7 +5,7 @@ use std::io::Result; pub mod relink; pub mod seccomp_bpf; -use reverie_syscalls::*; +use syscalls::*; use reverie_common::consts; #[link_section = ".init_array"] diff --git a/reverie-syscalls/src/nr.rs b/reverie-syscalls/src/nr.rs deleted file mode 100644 index 3d85a69..0000000 --- a/reverie-syscalls/src/nr.rs +++ /dev/null @@ -1,1068 +0,0 @@ -// AUTOMATICALLY GENERATED BY reverie/syscalls/build.rs. DO NOT EDIT. - -pub use self::SyscallNo::*; -use core::fmt; -#[allow(non_snake_case, non_camel_case_types, non_upper_case_globals)] - -#[derive(PartialEq, Eq, Clone, Copy)] -pub enum SyscallNo { - SYS_read = 0, - SYS_write = 1, - SYS_open = 2, - SYS_close = 3, - SYS_stat = 4, - SYS_fstat = 5, - SYS_lstat = 6, - SYS_poll = 7, - SYS_lseek = 8, - SYS_mmap = 9, - SYS_mprotect = 10, - SYS_munmap = 11, - SYS_brk = 12, - SYS_rt_sigaction = 13, - SYS_rt_sigprocmask = 14, - SYS_rt_sigreturn = 15, - SYS_ioctl = 16, - SYS_pread64 = 17, - SYS_pwrite64 = 18, - SYS_readv = 19, - SYS_writev = 20, - SYS_access = 21, - SYS_pipe = 22, - SYS_select = 23, - SYS_sched_yield = 24, - SYS_mremap = 25, - SYS_msync = 26, - SYS_mincore = 27, - SYS_madvise = 28, - SYS_shmget = 29, - SYS_shmat = 30, - SYS_shmctl = 31, - SYS_dup = 32, - SYS_dup2 = 33, - SYS_pause = 34, - SYS_nanosleep = 35, - SYS_getitimer = 36, - SYS_alarm = 37, - SYS_setitimer = 38, - SYS_getpid = 39, - SYS_sendfile = 40, - SYS_socket = 41, - SYS_connect = 42, - SYS_accept = 43, - SYS_sendto = 44, - SYS_recvfrom = 45, - SYS_sendmsg = 46, - SYS_recvmsg = 47, - SYS_shutdown = 48, - SYS_bind = 49, - SYS_listen = 50, - SYS_getsockname = 51, - SYS_getpeername = 52, - SYS_socketpair = 53, - SYS_setsockopt = 54, - SYS_getsockopt = 55, - SYS_clone = 56, - SYS_fork = 57, - SYS_vfork = 58, - SYS_execve = 59, - SYS_exit = 60, - SYS_wait4 = 61, - SYS_kill = 62, - SYS_uname = 63, - SYS_semget = 64, - SYS_semop = 65, - SYS_semctl = 66, - SYS_shmdt = 67, - SYS_msgget = 68, - SYS_msgsnd = 69, - SYS_msgrcv = 70, - SYS_msgctl = 71, - SYS_fcntl = 72, - SYS_flock = 73, - SYS_fsync = 74, - SYS_fdatasync = 75, - SYS_truncate = 76, - SYS_ftruncate = 77, - SYS_getdents = 78, - SYS_getcwd = 79, - SYS_chdir = 80, - SYS_fchdir = 81, - SYS_rename = 82, - SYS_mkdir = 83, - SYS_rmdir = 84, - SYS_creat = 85, - SYS_link = 86, - SYS_unlink = 87, - SYS_symlink = 88, - SYS_readlink = 89, - SYS_chmod = 90, - SYS_fchmod = 91, - SYS_chown = 92, - SYS_fchown = 93, - SYS_lchown = 94, - SYS_umask = 95, - SYS_gettimeofday = 96, - SYS_getrlimit = 97, - SYS_getrusage = 98, - SYS_sysinfo = 99, - SYS_times = 100, - SYS_ptrace = 101, - SYS_getuid = 102, - SYS_syslog = 103, - SYS_getgid = 104, - SYS_setuid = 105, - SYS_setgid = 106, - SYS_geteuid = 107, - SYS_getegid = 108, - SYS_setpgid = 109, - SYS_getppid = 110, - SYS_getpgrp = 111, - SYS_setsid = 112, - SYS_setreuid = 113, - SYS_setregid = 114, - SYS_getgroups = 115, - SYS_setgroups = 116, - SYS_setresuid = 117, - SYS_getresuid = 118, - SYS_setresgid = 119, - SYS_getresgid = 120, - SYS_getpgid = 121, - SYS_setfsuid = 122, - SYS_setfsgid = 123, - SYS_getsid = 124, - SYS_capget = 125, - SYS_capset = 126, - SYS_rt_sigpending = 127, - SYS_rt_sigtimedwait = 128, - SYS_rt_sigqueueinfo = 129, - SYS_rt_sigsuspend = 130, - SYS_sigaltstack = 131, - SYS_utime = 132, - SYS_mknod = 133, - SYS_uselib = 134, - SYS_personality = 135, - SYS_ustat = 136, - SYS_statfs = 137, - SYS_fstatfs = 138, - SYS_sysfs = 139, - SYS_getpriority = 140, - SYS_setpriority = 141, - SYS_sched_setparam = 142, - SYS_sched_getparam = 143, - SYS_sched_setscheduler = 144, - SYS_sched_getscheduler = 145, - SYS_sched_get_priority_max = 146, - SYS_sched_get_priority_min = 147, - SYS_sched_rr_get_interval = 148, - SYS_mlock = 149, - SYS_munlock = 150, - SYS_mlockall = 151, - SYS_munlockall = 152, - SYS_vhangup = 153, - SYS_modify_ldt = 154, - SYS_pivot_root = 155, - SYS__sysctl = 156, - SYS_prctl = 157, - SYS_arch_prctl = 158, - SYS_adjtimex = 159, - SYS_setrlimit = 160, - SYS_chroot = 161, - SYS_sync = 162, - SYS_acct = 163, - SYS_settimeofday = 164, - SYS_mount = 165, - SYS_umount2 = 166, - SYS_swapon = 167, - SYS_swapoff = 168, - SYS_reboot = 169, - SYS_sethostname = 170, - SYS_setdomainname = 171, - SYS_iopl = 172, - SYS_ioperm = 173, - SYS_create_module = 174, - SYS_init_module = 175, - SYS_delete_module = 176, - SYS_get_kernel_syms = 177, - SYS_query_module = 178, - SYS_quotactl = 179, - SYS_nfsservctl = 180, - SYS_getpmsg = 181, - SYS_putpmsg = 182, - SYS_afs_syscall = 183, - SYS_tuxcall = 184, - SYS_security = 185, - SYS_gettid = 186, - SYS_readahead = 187, - SYS_setxattr = 188, - SYS_lsetxattr = 189, - SYS_fsetxattr = 190, - SYS_getxattr = 191, - SYS_lgetxattr = 192, - SYS_fgetxattr = 193, - SYS_listxattr = 194, - SYS_llistxattr = 195, - SYS_flistxattr = 196, - SYS_removexattr = 197, - SYS_lremovexattr = 198, - SYS_fremovexattr = 199, - SYS_tkill = 200, - SYS_time = 201, - SYS_futex = 202, - SYS_sched_setaffinity = 203, - SYS_sched_getaffinity = 204, - SYS_set_thread_area = 205, - SYS_io_setup = 206, - SYS_io_destroy = 207, - SYS_io_getevents = 208, - SYS_io_submit = 209, - SYS_io_cancel = 210, - SYS_get_thread_area = 211, - SYS_lookup_dcookie = 212, - SYS_epoll_create = 213, - SYS_epoll_ctl_old = 214, - SYS_epoll_wait_old = 215, - SYS_remap_file_pages = 216, - SYS_getdents64 = 217, - SYS_set_tid_address = 218, - SYS_restart_syscall = 219, - SYS_semtimedop = 220, - SYS_fadvise64 = 221, - SYS_timer_create = 222, - SYS_timer_settime = 223, - SYS_timer_gettime = 224, - SYS_timer_getoverrun = 225, - SYS_timer_delete = 226, - SYS_clock_settime = 227, - SYS_clock_gettime = 228, - SYS_clock_getres = 229, - SYS_clock_nanosleep = 230, - SYS_exit_group = 231, - SYS_epoll_wait = 232, - SYS_epoll_ctl = 233, - SYS_tgkill = 234, - SYS_utimes = 235, - SYS_vserver = 236, - SYS_mbind = 237, - SYS_set_mempolicy = 238, - SYS_get_mempolicy = 239, - SYS_mq_open = 240, - SYS_mq_unlink = 241, - SYS_mq_timedsend = 242, - SYS_mq_timedreceive = 243, - SYS_mq_notify = 244, - SYS_mq_getsetattr = 245, - SYS_kexec_load = 246, - SYS_waitid = 247, - SYS_add_key = 248, - SYS_request_key = 249, - SYS_keyctl = 250, - SYS_ioprio_set = 251, - SYS_ioprio_get = 252, - SYS_inotify_init = 253, - SYS_inotify_add_watch = 254, - SYS_inotify_rm_watch = 255, - SYS_migrate_pages = 256, - SYS_openat = 257, - SYS_mkdirat = 258, - SYS_mknodat = 259, - SYS_fchownat = 260, - SYS_futimesat = 261, - SYS_newfstatat = 262, - SYS_unlinkat = 263, - SYS_renameat = 264, - SYS_linkat = 265, - SYS_symlinkat = 266, - SYS_readlinkat = 267, - SYS_fchmodat = 268, - SYS_faccessat = 269, - SYS_pselect6 = 270, - SYS_ppoll = 271, - SYS_unshare = 272, - SYS_set_robust_list = 273, - SYS_get_robust_list = 274, - SYS_splice = 275, - SYS_tee = 276, - SYS_sync_file_range = 277, - SYS_vmsplice = 278, - SYS_move_pages = 279, - SYS_utimensat = 280, - SYS_epoll_pwait = 281, - SYS_signalfd = 282, - SYS_timerfd_create = 283, - SYS_eventfd = 284, - SYS_fallocate = 285, - SYS_timerfd_settime = 286, - SYS_timerfd_gettime = 287, - SYS_accept4 = 288, - SYS_signalfd4 = 289, - SYS_eventfd2 = 290, - SYS_epoll_create1 = 291, - SYS_dup3 = 292, - SYS_pipe2 = 293, - SYS_inotify_init1 = 294, - SYS_preadv = 295, - SYS_pwritev = 296, - SYS_rt_tgsigqueueinfo = 297, - SYS_perf_event_open = 298, - SYS_recvmmsg = 299, - SYS_fanotify_init = 300, - SYS_fanotify_mark = 301, - SYS_prlimit64 = 302, - SYS_name_to_handle_at = 303, - SYS_open_by_handle_at = 304, - SYS_clock_adjtime = 305, - SYS_syncfs = 306, - SYS_sendmmsg = 307, - SYS_setns = 308, - SYS_getcpu = 309, - SYS_process_vm_readv = 310, - SYS_process_vm_writev = 311, - SYS_kcmp = 312, - SYS_finit_module = 313, - SYS_sched_setattr = 314, - SYS_sched_getattr = 315, - SYS_renameat2 = 316, - SYS_seccomp = 317, - SYS_getrandom = 318, - SYS_memfd_create = 319, - SYS_kexec_file_load = 320, - SYS_bpf = 321, - SYS_execveat = 322, - SYS_userfaultfd = 323, - SYS_membarrier = 324, - SYS_mlock2 = 325, - SYS_copy_file_range = 326, - SYS_preadv2 = 327, - SYS_pwritev2 = 328, - SYS_pkey_mprotect = 329, - SYS_pkey_alloc = 330, - SYS_pkey_free = 331, - SYS_statx = 332, - SYS_io_pgetevents = 333, - SYS_rseq = 334, - SYS_pidfd_send_signal = 424, - SYS_io_uring_setup = 425, - SYS_io_uring_enter = 426, - SYS_io_uring_register = 427, - SYS_open_tree = 428, - SYS_move_mount = 429, - SYS_fsopen = 430, - SYS_fsconfig = 431, - SYS_fsmount = 432, - SYS_fspick = 433, - SYS_pidfd_open = 434, - SYS_clone3 = 435, -} -static SYSCALL_NAMES: [&str; 347] = [ - "read", - "write", - "open", - "close", - "stat", - "fstat", - "lstat", - "poll", - "lseek", - "mmap", - "mprotect", - "munmap", - "brk", - "rt_sigaction", - "rt_sigprocmask", - "rt_sigreturn", - "ioctl", - "pread64", - "pwrite64", - "readv", - "writev", - "access", - "pipe", - "select", - "sched_yield", - "mremap", - "msync", - "mincore", - "madvise", - "shmget", - "shmat", - "shmctl", - "dup", - "dup2", - "pause", - "nanosleep", - "getitimer", - "alarm", - "setitimer", - "getpid", - "sendfile", - "socket", - "connect", - "accept", - "sendto", - "recvfrom", - "sendmsg", - "recvmsg", - "shutdown", - "bind", - "listen", - "getsockname", - "getpeername", - "socketpair", - "setsockopt", - "getsockopt", - "clone", - "fork", - "vfork", - "execve", - "exit", - "wait4", - "kill", - "uname", - "semget", - "semop", - "semctl", - "shmdt", - "msgget", - "msgsnd", - "msgrcv", - "msgctl", - "fcntl", - "flock", - "fsync", - "fdatasync", - "truncate", - "ftruncate", - "getdents", - "getcwd", - "chdir", - "fchdir", - "rename", - "mkdir", - "rmdir", - "creat", - "link", - "unlink", - "symlink", - "readlink", - "chmod", - "fchmod", - "chown", - "fchown", - "lchown", - "umask", - "gettimeofday", - "getrlimit", - "getrusage", - "sysinfo", - "times", - "ptrace", - "getuid", - "syslog", - "getgid", - "setuid", - "setgid", - "geteuid", - "getegid", - "setpgid", - "getppid", - "getpgrp", - "setsid", - "setreuid", - "setregid", - "getgroups", - "setgroups", - "setresuid", - "getresuid", - "setresgid", - "getresgid", - "getpgid", - "setfsuid", - "setfsgid", - "getsid", - "capget", - "capset", - "rt_sigpending", - "rt_sigtimedwait", - "rt_sigqueueinfo", - "rt_sigsuspend", - "sigaltstack", - "utime", - "mknod", - "uselib", - "personality", - "ustat", - "statfs", - "fstatfs", - "sysfs", - "getpriority", - "setpriority", - "sched_setparam", - "sched_getparam", - "sched_setscheduler", - "sched_getscheduler", - "sched_get_priority_max", - "sched_get_priority_min", - "sched_rr_get_interval", - "mlock", - "munlock", - "mlockall", - "munlockall", - "vhangup", - "modify_ldt", - "pivot_root", - "_sysctl", - "prctl", - "arch_prctl", - "adjtimex", - "setrlimit", - "chroot", - "sync", - "acct", - "settimeofday", - "mount", - "umount2", - "swapon", - "swapoff", - "reboot", - "sethostname", - "setdomainname", - "iopl", - "ioperm", - "create_module", - "init_module", - "delete_module", - "get_kernel_syms", - "query_module", - "quotactl", - "nfsservctl", - "getpmsg", - "putpmsg", - "afs_syscall", - "tuxcall", - "security", - "gettid", - "readahead", - "setxattr", - "lsetxattr", - "fsetxattr", - "getxattr", - "lgetxattr", - "fgetxattr", - "listxattr", - "llistxattr", - "flistxattr", - "removexattr", - "lremovexattr", - "fremovexattr", - "tkill", - "time", - "futex", - "sched_setaffinity", - "sched_getaffinity", - "set_thread_area", - "io_setup", - "io_destroy", - "io_getevents", - "io_submit", - "io_cancel", - "get_thread_area", - "lookup_dcookie", - "epoll_create", - "epoll_ctl_old", - "epoll_wait_old", - "remap_file_pages", - "getdents64", - "set_tid_address", - "restart_syscall", - "semtimedop", - "fadvise64", - "timer_create", - "timer_settime", - "timer_gettime", - "timer_getoverrun", - "timer_delete", - "clock_settime", - "clock_gettime", - "clock_getres", - "clock_nanosleep", - "exit_group", - "epoll_wait", - "epoll_ctl", - "tgkill", - "utimes", - "vserver", - "mbind", - "set_mempolicy", - "get_mempolicy", - "mq_open", - "mq_unlink", - "mq_timedsend", - "mq_timedreceive", - "mq_notify", - "mq_getsetattr", - "kexec_load", - "waitid", - "add_key", - "request_key", - "keyctl", - "ioprio_set", - "ioprio_get", - "inotify_init", - "inotify_add_watch", - "inotify_rm_watch", - "migrate_pages", - "openat", - "mkdirat", - "mknodat", - "fchownat", - "futimesat", - "newfstatat", - "unlinkat", - "renameat", - "linkat", - "symlinkat", - "readlinkat", - "fchmodat", - "faccessat", - "pselect6", - "ppoll", - "unshare", - "set_robust_list", - "get_robust_list", - "splice", - "tee", - "sync_file_range", - "vmsplice", - "move_pages", - "utimensat", - "epoll_pwait", - "signalfd", - "timerfd_create", - "eventfd", - "fallocate", - "timerfd_settime", - "timerfd_gettime", - "accept4", - "signalfd4", - "eventfd2", - "epoll_create1", - "dup3", - "pipe2", - "inotify_init1", - "preadv", - "pwritev", - "rt_tgsigqueueinfo", - "perf_event_open", - "recvmmsg", - "fanotify_init", - "fanotify_mark", - "prlimit64", - "name_to_handle_at", - "open_by_handle_at", - "clock_adjtime", - "syncfs", - "sendmmsg", - "setns", - "getcpu", - "process_vm_readv", - "process_vm_writev", - "kcmp", - "finit_module", - "sched_setattr", - "sched_getattr", - "renameat2", - "seccomp", - "getrandom", - "memfd_create", - "kexec_file_load", - "bpf", - "execveat", - "userfaultfd", - "membarrier", - "mlock2", - "copy_file_range", - "preadv2", - "pwritev2", - "pkey_mprotect", - "pkey_alloc", - "pkey_free", - "statx", - "io_pgetevents", - "rseq", - "pidfd_send_signal", - "io_uring_setup", - "io_uring_enter", - "io_uring_register", - "open_tree", - "move_mount", - "fsopen", - "fsconfig", - "fsmount", - "fspick", - "pidfd_open", - "clone3", -]; -impl fmt::Debug for SyscallNo { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "{}", SYSCALL_NAMES[self.clone() as usize]) - } -} -static SYSCALL_IDS: [SyscallNo; 347] = [ - SYS_read, - SYS_write, - SYS_open, - SYS_close, - SYS_stat, - SYS_fstat, - SYS_lstat, - SYS_poll, - SYS_lseek, - SYS_mmap, - SYS_mprotect, - SYS_munmap, - SYS_brk, - SYS_rt_sigaction, - SYS_rt_sigprocmask, - SYS_rt_sigreturn, - SYS_ioctl, - SYS_pread64, - SYS_pwrite64, - SYS_readv, - SYS_writev, - SYS_access, - SYS_pipe, - SYS_select, - SYS_sched_yield, - SYS_mremap, - SYS_msync, - SYS_mincore, - SYS_madvise, - SYS_shmget, - SYS_shmat, - SYS_shmctl, - SYS_dup, - SYS_dup2, - SYS_pause, - SYS_nanosleep, - SYS_getitimer, - SYS_alarm, - SYS_setitimer, - SYS_getpid, - SYS_sendfile, - SYS_socket, - SYS_connect, - SYS_accept, - SYS_sendto, - SYS_recvfrom, - SYS_sendmsg, - SYS_recvmsg, - SYS_shutdown, - SYS_bind, - SYS_listen, - SYS_getsockname, - SYS_getpeername, - SYS_socketpair, - SYS_setsockopt, - SYS_getsockopt, - SYS_clone, - SYS_fork, - SYS_vfork, - SYS_execve, - SYS_exit, - SYS_wait4, - SYS_kill, - SYS_uname, - SYS_semget, - SYS_semop, - SYS_semctl, - SYS_shmdt, - SYS_msgget, - SYS_msgsnd, - SYS_msgrcv, - SYS_msgctl, - SYS_fcntl, - SYS_flock, - SYS_fsync, - SYS_fdatasync, - SYS_truncate, - SYS_ftruncate, - SYS_getdents, - SYS_getcwd, - SYS_chdir, - SYS_fchdir, - SYS_rename, - SYS_mkdir, - SYS_rmdir, - SYS_creat, - SYS_link, - SYS_unlink, - SYS_symlink, - SYS_readlink, - SYS_chmod, - SYS_fchmod, - SYS_chown, - SYS_fchown, - SYS_lchown, - SYS_umask, - SYS_gettimeofday, - SYS_getrlimit, - SYS_getrusage, - SYS_sysinfo, - SYS_times, - SYS_ptrace, - SYS_getuid, - SYS_syslog, - SYS_getgid, - SYS_setuid, - SYS_setgid, - SYS_geteuid, - SYS_getegid, - SYS_setpgid, - SYS_getppid, - SYS_getpgrp, - SYS_setsid, - SYS_setreuid, - SYS_setregid, - SYS_getgroups, - SYS_setgroups, - SYS_setresuid, - SYS_getresuid, - SYS_setresgid, - SYS_getresgid, - SYS_getpgid, - SYS_setfsuid, - SYS_setfsgid, - SYS_getsid, - SYS_capget, - SYS_capset, - SYS_rt_sigpending, - SYS_rt_sigtimedwait, - SYS_rt_sigqueueinfo, - SYS_rt_sigsuspend, - SYS_sigaltstack, - SYS_utime, - SYS_mknod, - SYS_uselib, - SYS_personality, - SYS_ustat, - SYS_statfs, - SYS_fstatfs, - SYS_sysfs, - SYS_getpriority, - SYS_setpriority, - SYS_sched_setparam, - SYS_sched_getparam, - SYS_sched_setscheduler, - SYS_sched_getscheduler, - SYS_sched_get_priority_max, - SYS_sched_get_priority_min, - SYS_sched_rr_get_interval, - SYS_mlock, - SYS_munlock, - SYS_mlockall, - SYS_munlockall, - SYS_vhangup, - SYS_modify_ldt, - SYS_pivot_root, - SYS__sysctl, - SYS_prctl, - SYS_arch_prctl, - SYS_adjtimex, - SYS_setrlimit, - SYS_chroot, - SYS_sync, - SYS_acct, - SYS_settimeofday, - SYS_mount, - SYS_umount2, - SYS_swapon, - SYS_swapoff, - SYS_reboot, - SYS_sethostname, - SYS_setdomainname, - SYS_iopl, - SYS_ioperm, - SYS_create_module, - SYS_init_module, - SYS_delete_module, - SYS_get_kernel_syms, - SYS_query_module, - SYS_quotactl, - SYS_nfsservctl, - SYS_getpmsg, - SYS_putpmsg, - SYS_afs_syscall, - SYS_tuxcall, - SYS_security, - SYS_gettid, - SYS_readahead, - SYS_setxattr, - SYS_lsetxattr, - SYS_fsetxattr, - SYS_getxattr, - SYS_lgetxattr, - SYS_fgetxattr, - SYS_listxattr, - SYS_llistxattr, - SYS_flistxattr, - SYS_removexattr, - SYS_lremovexattr, - SYS_fremovexattr, - SYS_tkill, - SYS_time, - SYS_futex, - SYS_sched_setaffinity, - SYS_sched_getaffinity, - SYS_set_thread_area, - SYS_io_setup, - SYS_io_destroy, - SYS_io_getevents, - SYS_io_submit, - SYS_io_cancel, - SYS_get_thread_area, - SYS_lookup_dcookie, - SYS_epoll_create, - SYS_epoll_ctl_old, - SYS_epoll_wait_old, - SYS_remap_file_pages, - SYS_getdents64, - SYS_set_tid_address, - SYS_restart_syscall, - SYS_semtimedop, - SYS_fadvise64, - SYS_timer_create, - SYS_timer_settime, - SYS_timer_gettime, - SYS_timer_getoverrun, - SYS_timer_delete, - SYS_clock_settime, - SYS_clock_gettime, - SYS_clock_getres, - SYS_clock_nanosleep, - SYS_exit_group, - SYS_epoll_wait, - SYS_epoll_ctl, - SYS_tgkill, - SYS_utimes, - SYS_vserver, - SYS_mbind, - SYS_set_mempolicy, - SYS_get_mempolicy, - SYS_mq_open, - SYS_mq_unlink, - SYS_mq_timedsend, - SYS_mq_timedreceive, - SYS_mq_notify, - SYS_mq_getsetattr, - SYS_kexec_load, - SYS_waitid, - SYS_add_key, - SYS_request_key, - SYS_keyctl, - SYS_ioprio_set, - SYS_ioprio_get, - SYS_inotify_init, - SYS_inotify_add_watch, - SYS_inotify_rm_watch, - SYS_migrate_pages, - SYS_openat, - SYS_mkdirat, - SYS_mknodat, - SYS_fchownat, - SYS_futimesat, - SYS_newfstatat, - SYS_unlinkat, - SYS_renameat, - SYS_linkat, - SYS_symlinkat, - SYS_readlinkat, - SYS_fchmodat, - SYS_faccessat, - SYS_pselect6, - SYS_ppoll, - SYS_unshare, - SYS_set_robust_list, - SYS_get_robust_list, - SYS_splice, - SYS_tee, - SYS_sync_file_range, - SYS_vmsplice, - SYS_move_pages, - SYS_utimensat, - SYS_epoll_pwait, - SYS_signalfd, - SYS_timerfd_create, - SYS_eventfd, - SYS_fallocate, - SYS_timerfd_settime, - SYS_timerfd_gettime, - SYS_accept4, - SYS_signalfd4, - SYS_eventfd2, - SYS_epoll_create1, - SYS_dup3, - SYS_pipe2, - SYS_inotify_init1, - SYS_preadv, - SYS_pwritev, - SYS_rt_tgsigqueueinfo, - SYS_perf_event_open, - SYS_recvmmsg, - SYS_fanotify_init, - SYS_fanotify_mark, - SYS_prlimit64, - SYS_name_to_handle_at, - SYS_open_by_handle_at, - SYS_clock_adjtime, - SYS_syncfs, - SYS_sendmmsg, - SYS_setns, - SYS_getcpu, - SYS_process_vm_readv, - SYS_process_vm_writev, - SYS_kcmp, - SYS_finit_module, - SYS_sched_setattr, - SYS_sched_getattr, - SYS_renameat2, - SYS_seccomp, - SYS_getrandom, - SYS_memfd_create, - SYS_kexec_file_load, - SYS_bpf, - SYS_execveat, - SYS_userfaultfd, - SYS_membarrier, - SYS_mlock2, - SYS_copy_file_range, - SYS_preadv2, - SYS_pwritev2, - SYS_pkey_mprotect, - SYS_pkey_alloc, - SYS_pkey_free, - SYS_statx, - SYS_io_pgetevents, - SYS_rseq, - SYS_pidfd_send_signal, - SYS_io_uring_setup, - SYS_io_uring_enter, - SYS_io_uring_register, - SYS_open_tree, - SYS_move_mount, - SYS_fsopen, - SYS_fsconfig, - SYS_fsmount, - SYS_fspick, - SYS_pidfd_open, - SYS_clone3, -]; -impl From for SyscallNo { - fn from(item: i32) -> Self { - if item as usize > SYSCALL_IDS.len() { - panic!("invalid syscall: {}", item) - } else { - SYSCALL_IDS[item as usize] - } - } -} diff --git a/reverie/Cargo.toml b/reverie/Cargo.toml index e5edbab..71af41b 100644 --- a/reverie/Cargo.toml +++ b/reverie/Cargo.toml @@ -14,7 +14,7 @@ path = "src/main.rs" [dependencies] libc = { version = "0.2", default-features = false } -reverie-syscalls = { path = "../reverie-syscalls" } +syscalls = { path = "../syscalls" } reverie-common = { path = "../reverie-common" } nix = "0.13" goblin = "0.0" @@ -30,4 +30,4 @@ serde_json = "1.0" [build-dependencies] cc = "1.0" -reverie-sysnum = { path = "../reverie-sysnum" } +sysnum = { path = "../sysnum" } diff --git a/reverie/build.rs b/reverie/build.rs index 95e4761..4538c49 100644 --- a/reverie/build.rs +++ b/reverie/build.rs @@ -1,7 +1,7 @@ use std::fs::File; use std::io::{Result, Write}; use std::path::PathBuf; -use reverie_sysnum::gen_syscalls; +use sysnum::gen_syscalls; fn gen_syscall_nrs(dest: PathBuf) -> Result<()> { let mut f = File::create(dest)?; diff --git a/reverie/src/config.rs b/reverie/src/config.rs index a1feb4d..b0d90e3 100644 --- a/reverie/src/config.rs +++ b/reverie/src/config.rs @@ -1,5 +1,5 @@ -use reverie_syscalls::*; +use syscalls::*; /// How should the intrumentor do its job? pub enum InstrumentMode { diff --git a/reverie/src/lib.rs b/reverie/src/lib.rs index 6bf12d8..3a96061 100644 --- a/reverie/src/lib.rs +++ b/reverie/src/lib.rs @@ -10,7 +10,7 @@ #[macro_use] extern crate lazy_static; -pub use reverie_syscalls; +pub use syscalls; pub use reverie_common; pub mod hooks; diff --git a/reverie-syscalls/Cargo.toml b/syscalls/Cargo.toml similarity index 60% rename from reverie-syscalls/Cargo.toml rename to syscalls/Cargo.toml index 205df38..70e1548 100644 --- a/reverie-syscalls/Cargo.toml +++ b/syscalls/Cargo.toml @@ -1,14 +1,14 @@ [package] -name = "reverie-syscalls" +name = "syscalls" version = "0.1.0" authors = ["Baojun Wang "] edition = "2018" [lib] -name = "reverie_syscalls" +name = "syscalls" path = "src/lib.rs" [dependencies] [build-dependencies] -reverie-sysnum = { path = "../reverie-sysnum" } +sysnum = { path = "../sysnum" } diff --git a/reverie-syscalls/build.rs b/syscalls/build.rs similarity index 98% rename from reverie-syscalls/build.rs rename to syscalls/build.rs index 2e0f9ae..1529cfb 100644 --- a/reverie-syscalls/build.rs +++ b/syscalls/build.rs @@ -1,7 +1,7 @@ use std::fs::File; use std::io::{Result, Write}; use std::path::PathBuf; -use reverie_sysnum::gen_syscalls; +use sysnum::gen_syscalls; fn gen_syscall_nrs(dest: PathBuf) -> Result<()> { let mut f = File::create(dest)?; diff --git a/reverie-syscalls/src/helper.rs b/syscalls/src/helper.rs similarity index 100% rename from reverie-syscalls/src/helper.rs rename to syscalls/src/helper.rs diff --git a/reverie-syscalls/src/lib.rs b/syscalls/src/lib.rs similarity index 100% rename from reverie-syscalls/src/lib.rs rename to syscalls/src/lib.rs diff --git a/reverie-syscalls/src/macros.rs b/syscalls/src/macros.rs similarity index 100% rename from reverie-syscalls/src/macros.rs rename to syscalls/src/macros.rs diff --git a/reverie-syscalls/src/raw.rs b/syscalls/src/raw.rs similarity index 100% rename from reverie-syscalls/src/raw.rs rename to syscalls/src/raw.rs diff --git a/reverie-sysnum/Cargo.toml b/sysnum/Cargo.toml similarity index 75% rename from reverie-sysnum/Cargo.toml rename to sysnum/Cargo.toml index 341963f..b2c42fe 100644 --- a/reverie-sysnum/Cargo.toml +++ b/sysnum/Cargo.toml @@ -1,11 +1,11 @@ [package] -name = "reverie-sysnum" +name = "sysnum" version = "0.1.0" authors = ["Baojun Wang "] edition = "2018" [lib] -name = "reverie_sysnum" +name = "sysnum" path = "src/lib.rs" [dependencies] diff --git a/reverie-sysnum/src/lib.rs b/sysnum/src/lib.rs similarity index 100% rename from reverie-sysnum/src/lib.rs rename to sysnum/src/lib.rs